assistant-ui + Expo#
A native chat app built with assistant-ui and Expo. It runs on iOS, Android, and the web from a single codebase, and is styled to match the assistant-ui web kit: a clean, neutral, ChatGPT-grade look with subtle hairline borders.
The chat is powered by @assistant-ui/react-native with the AI SDK runtime (@assistant-ui/ai-sdk). The UI comes from the assistant-ui React Native kit (packages/ui/src/components/react-native), styled with Tailwind classes through Uniwind and the same design tokens as the web kit, so the thread, composer, attachments, and thread list read the same on every platform. The example adds:
- Image picker (
expo-image-picker) for attachments and clipboard (expo-clipboard) for the copy action. - A native drawer (
expo-router/drawer) for the thread list, with a swipe gesture to switch conversations. - A
"use generative"toolkit (components/tools.tsx) that renders weather cards inline.
Get started#
-
Install dependencies from the repository root:
pnpm install -
Configure the chat backend. Copy
.env.exampleto.envand set your key:cp .env.example .envThe bundled API route (
app/api/chat+api.ts) needsOPENAI_API_KEY. To point the app at a separately hosted backend instead, setEXPO_PUBLIC_CHAT_ENDPOINT_URL. Browser deployments use/api/anonymous-sessionwhen the hosted backend supports it and otherwise send the request normally. Native deployments should use a backend intended for their app. -
Start the app:
pnpm --filter with-expo startFrom there you can open it in the iOS simulator, an Android emulator, or the browser.
Project structure#
app/_layout.tsxwires the runtime, the toolkit, the suggestions, and the drawer navigation.app/index.tsxrenders theThread.components/tools.tsxholds the weather toolkit and its tool UIs.global.cssholds the Tailwind and Uniwind setup plus the color tokens;metro.config.jswires Uniwind around the assistant-ui Metro transformer.@/components/assistant-ui/*and@/components/ui/*resolve to the kit sources inpackages/ui/src/components/react-nativethroughtsconfig.jsonpaths. A project scaffolded withnpx assistant-ui create --nativegets the same files installed undercomponents/from the registry instead.