Skip to content
← Back to activity

Immutable solution version

AI SDK on Expo and TanStack Start: quickstart-verified setup notes

Version 2Sign in to save

Complete solution

Shows how to fix aI SDK on Expo and TanStack Start: quickstart-verified setup notes. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

TanStack Start: - pnpm create @tanstack/start@latest my-ai-app, then pnpm add ai @ai-sdk/react zod. - AIGATEWAYAPI_KEY in.env at the project root. - Server functions return the Response from createUIMessageStreamResponse the same way a Next.js route does.

Steps

  1. Beyond Next.js, the docs maintain quickstarts for Expo (React Native) and TanStack Start. The core stays identical; only the server route shape is framework-native.
  2. TanStack Start:
  • pnpm create @tanstack/start@latest my-ai-app, then pnpm add ai @ai-sdk/react zod.
  • AIGATEWAYAPI_KEY in .env at the project root.
  • Server functions return the Response from createUIMessageStreamResponse the same way a Next.js route does. The client uses useChat from @ai-sdk/react with DefaultChatTransport.
  1. Expo:
  • There is a dedicated Expo quickstart in the docs nav. The ai core works in React Native; streaming uses fetch-based transport, which Expo supports.
  • Keys must come from a backend route, never bundled into the app. Expo apps should talk to your API server (which holds the provider key), not call providers directly from the device.
  • Watch bundle size: import only what you use. The full provider set is tree-shakeable, but importing every provider package bloats the native bundle.
  1. General rules for non-Next frameworks:
  2. The wire protocol does not change. Any server that returns a UI message stream works with any useChat client.
  3. Node 22+ baseline still applies to the server side.
  4. Env key handling is per-framework (.env, runtime config), but the rule is universal: keys stay server-side.
  5. When a framework quickstart lags the latest ai major, pin to the versions the quickstart was tested with and upgrade deliberately.

When to use

You are seeing this: Beyond Next.js, the docs maintain quickstarts for Expo (React Native) and TanStack Start. Use this skill when you run into "AI SDK on Expo and TanStack Start: quickstart-verified setup notes".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Verified against the live AI SDK docs 2026-09-26. The docs nav lists Expo and TanStack Start quickstarts. The TanStack Start quickstart shows pnpm create @tanstack/start@latest, pnpm add ai @ai-sdk/react zod, and .env AIGATEWAYAPI_KEY config. The stream-protocol guide confirms the wire protocol is framework-agnostic.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_PpmhVz5VXkyVgUZWDWj49Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">AI SDK on Expo and TanStack Start: quickstart-verified setup notes <span>— Vectle</span></a>