Skip to content
Sign in
TemplatesAI SaaS starterMenu

AI SaaS starterPro

A complete AI product on mocks, routed by state in one component: sign in with an email code, onboarding in three steps, the chat app with model picker and tool calls, credits every message spends, billing, and settings for the profile, API keys and usage.

ProFrom the first screen: sign in with any email and any 6 digits (000000 shows the wrong code state), walk onboarding, then chat. Every message spends credits.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/ai-saas-starter

The template installs as a folder under components/chatcn/pro/ai-saas-starter/: the router, the auth and onboarding screens, billing, settings and the mock backend.

Usage

tsx
import { AiSaasStarter } from "@/components/chatcn/pro/ai-saas-starter/ai-saas-starter"

<AiSaasStarter product="Quire" defaultRoute="sign-in" />

Routing is state, so the whole product runs in one preview. To ship it, map route to your router and replace saas-mock.ts: the transport with your AI SDK route, the threads and histories with your database, the code check and purchases with your auth and billing calls. The screens take plain props and never import a runtime.

Examples

Signed in

On the Free plan with 12 credits: the first question runs a web search and answers with a table. A few messages later the banner offers more credits, or a switch to a cheaper model.

ProThe chat on the Free plan with 12 credits: a web search, a table answer, and the banner once credits run low.

What is inside

  • Sign in with an email code: one real input under six drawn cells, so paste, autofill and screen readers see a single field. A wrong code (000000 in the demo) says how to fix it; resend unlocks after 30 s.
  • Onboarding in three steps: name the workspace, pick a use case, pick a default model with its cost per message.
  • The chat app on ChatLayout, ChatSidebar and the free Chatbot block, on AI SDK useChat with a mock transport: reasoning, a streamed web search and a Markdown answer.
  • Credits on CreditBalance: every message spends its model's cost up front. RateLimitBanner warns when a few messages are left and offers Buy credits or a cheaper model once they run out.
  • Billing with CreditTopUp, InAppPlanPicker and invoices. An upgrade adds the difference in credits right away.
  • Settings on SettingsPanel: profile and appearance, workspace API keys with the secret shown once and a two step revoke, a bring your own key field on ApiKeyInput, and usage on UsageMeter.

Props

PropTypeNotes
productstringWordmark and headings. Default "Quire"
defaultRoute"sign-in" | "verify" | "onboarding" | "chat" | "billing" | "settings"Default sign-in
autoStartbooleanSend the first message when the chat opens, for demos
user{ name, email }The signed in account
creditsnumberBalance at the start. Default 24
plans, defaultPlanIdPickerPlan[], stringFor billing. Default Free, Pro, Team
packsCreditPack[]Credit packs for the top up
models, providers, modelCreditsModelOption[], ModelProvider[], Record<string, number>The composer's model picker and the cost per message
threadsChatThread[]The sidebar at the start
layout"auto" | "desktop" | "mobile"Force the phone layout inside a device frame

Keyboard

KeyAction
EnterSend the code, continue onboarding, send a message
Shift+EnterNew line in the composer
Cmd+B or Ctrl+BCollapse or expand the sidebar
Cmd+Shift+O or Ctrl+Shift+ONew chat
EscapeCancel creating an API key, close menus and dialogs

Accessibility

  • Every screen has one heading level 1. Onboarding moves focus to the step heading, so screen readers hear the new step.
  • Errors sit under their field, linked with aria-describedby, with an icon and words, never color alone.
  • The code field is one input with autocomplete="one-time-code"; the cells are decoration.
  • Credits, key creation and revokes are announced politely. The composed chat parts keep their own live regions.

Motion

  • Moving between screens is instant: the route changes from keys and clicks alike.
  • The composed parts keep their own motion: the drawer, menus and dialogs, the streaming thread, rolling credits and prices.
  • Under reduced motion only short fades remain.