TanStack Start Integration
Use createIntentFormServerFn to run the engine inside a TanStack Start server function. The function executes on the server; the client calls it like a normal async function.
Install
Section titled “Install”pnpm add @intentform/server @tanstack/react-startServer function
Section titled “Server function”import { createIntentFormServerFn } from '@intentform/server'import { createIntentForm } from '@intentform/core'import { openaiProvider } from '@intentform/provider-openai'import { myModels } from '../models'
const engine = createIntentForm({ provider: openaiProvider({ apiKey: process.env.OPENAI_API_KEY! }), models: myModels,})
export const resolveIntent = createIntentFormServerFn(engine)Client component
Section titled “Client component”import { IntentForm } from '@intentform/react'import { createClientIntentForm } from '@intentform/client'import { resolveIntent } from '../server/intent'import { myModels } from '../models'
const engine = createClientIntentForm({ serverFn: resolveIntent, models: myModels,})
export default function IndexPage() { return <IntentForm engine={engine} onSubmit={(v) => console.log(v)} />}The server function runs in the server bundle. No fetch configuration or CORS needed — TanStack Start handles RPC serialization.
See Server-Side Architecture for a full comparison of patterns.