App template
AI chat
An assistant people talk to all day: chats in a searchable sidebar, answers that stream, other versions to compare, files, voice, and a link to share.
Use this template
Installs the whole app into your project: its pages, routes, services with sample data, agent tools and the browser entry. Every file is yours to edit.
npx shadcn@latest add checkfu/uicontext/ai-chat- Run itLoad from your page’s script. It builds the app with
createApp: the browser’s router, the agent tools, an offline notice, and sign-in when you turn it on. Inside an app that already routes, renderAiChat, which brings its own in-memory router. - Connect your backendEvery read and write goes through
Chatsin . Implement it over your API and pointChatsLiveat your Layer. - Make it yoursPages are one file per route. Delete the ones you don’t need, and the sample data in .
Screens
New chat
/A greeting, prompts to start from, the model picker and the composer.
Chat
/c/:idThe conversation: streamed answers with Stop, Retry with any model, versions, edits that branch, ratings, read aloud and share.
Where your backend plugs in
Pages never call a backend. They read through the queries in queries/ and write through Commands kept beside the component that runs them; both capture the Chats service. Implement its interface in over HTTP, a sync engine or a database client, then change one line:
export const ChatsLive = Chats.sample
// becomes your Layer, such as
export const ChatsLive = Layer.effect(Chats, makeHttpChats)The root provides it once, so every page shares one instance. Sign-in is one line: delete auth: false in once your backend serves the session routes, and the sidebar shows who signed in.
What to delete
- services/seed.ts, and Chats.sample in services/Chats.ts, which writes the sample answers
- The voice button, if you have no speech-to-text: VoiceInput in pages/chats/ChatPage.ts
To drop a screen, delete its file in pages/ and its route in ; TypeScript points at every link that still prints it. The agent tools are in .