FlowstackProvider
The root provider that wraps a built app and supplies backend config (baseUrl, tenantId, mode, appScope) to all Flowstack hooks.
import { FlowstackProvider } from 'flowstack-sdk'Wrap your entire app in FlowstackProvider (Quick Start step 1). It supplies the backend connection config consumed by every Flowstack hook.
For built apps the critical field is appScope — it scopes all data to the app and the build pipeline fills __SITE_ID__ with the hex site_id. Built apps do NOT use workspaces; the backend creates them automatically.
Generated sites always run in mode: 'production' — auth, agent chat, and data all connect to real infrastructure at sage-api.flowstack.fun. Do not use mock mode for deployed sites. No Privy app ID, privyConfig.appId, or wallet peer deps are needed for the broker auth flow.
Signature
<FlowstackProvider config={config}>{children}</FlowstackProvider>Parameters
| Param | Type | Notes | Description |
|---|---|---|---|
config | FlowstackConfig | required | Backend configuration object (see fields below). |
config.baseUrl | string | required | API base URL, e.g. 'https://sage-api.flowstack.fun'. |
config.tenantId | string | — | Optional. For authenticated calls the backend derives the tenant from the brokered-login JWT and ignores any client-sent value, so built apps should not set it. Required only for usePublicCollection (anonymous access has no token to derive from); if missing there, that hook raises a clear error rather than using a default. |
config.mode | 'production' | 'development' | 'mock' | required | Connection mode. Generated/built sites must use 'production' (real infrastructure at sage-api.flowstack.fun). 'mock' and 'development' are for local SDK development only — never deploy a built app with them. |
config.appScope | string | required | Built apps only — hex site ID that scopes all data to this app. The build pipeline auto-fills __SITE_ID__. |
config.jwtSecret | string | — | Casino platform config, e.g. 'flowstack-cdn-site'. |
config.passwordSecret | string | — | Casino platform config, e.g. 'flowstack-cdn-site'. |
children | ReactNode | required | The app tree that consumes Flowstack hooks. |
Examples
import { FlowstackProvider, useFlowstack, BrokeredLoginButton } from 'flowstack-sdk';
function App() {
return (
<FlowstackProvider config={{
baseUrl: 'https://sage-api.flowstack.fun',
mode: 'production',
appScope: '__SITE_ID__', // Hex site ID — auto-filled by build pipeline
// No tenantId — derived from the brokered-login JWT.
}}>
<AuthGate />
</FlowstackProvider>
);
}import { FlowstackProvider } from 'flowstack-sdk';
const config = {
baseUrl: 'https://sage-api.flowstack.fun',
tenantId: 't_6fe54402be43',
mode: 'production',
jwtSecret: 'flowstack-cdn-site',
passwordSecret: 'flowstack-cdn-site',
};
export default function App({ children }) {
return (
<FlowstackProvider config={config}>
{children}
</FlowstackProvider>
);
}__SITE_ID__ with the hex site_id.sage-api.flowstack.fun. Do not use mock mode for deployed sites.privyConfig.appId or wallet peer deps (@privy-io/react-auth, wagmi, viem) are needed for the broker auth flow.X-Tenant-ID. The only place it must be set explicitly is usePublicCollection (anonymous, no token).See also
useFlowstack · BrokeredLoginButton · AuthGuard · useCollection · useAgent
Source: README.md#built-apps--generated-site-pattern · Also available in llms-full.txt and registry.json.