ChatJS
Stop rebuilding the same AI chat infrastructure. ChatJS gives you a production-ready foundation with authentication, 120+ models, streaming, and tools so you can focus on what makes your app unique.
CLI
Create a new ChatJS app:
npx @chat-js/cli@latest create my-app
The CLI walks you through gateway, features, and auth choices, generates chat.config.ts, and lists the env vars required by your selections.
Features
- 120+ Models: Claude, GPT, Gemini, Grok via one API
- Auth: GitHub, Google, anonymous. Ready to go.
- Attachments: Images, PDFs, docs. Drag and drop.
- Resumable Streams: Continue generation after page refresh
- Branching: Fork conversations, explore alternatives
- Sharing: Share conversations with public links
- Web Search: Real-time web search integration
- Image Generation: AI-powered image creation
- Code Execution: Run code snippets in sandbox
- MCP: Model Context Protocol support
- Desktop App: Package as a native macOS, Windows, or Linux app with Electron
Stack
- Next.js - App Router, React Server Components
- TypeScript - Full type safety
- AI SDK - The AI Toolkit for TypeScript
- AI Gateway - Unified access to 120+ AI models
- Better Auth - Authentication & authorization
- Drizzle ORM - Type-safe database queries
- PostgreSQL - Primary database
- Redis - Caching & resumable streams
- Vercel Blob - Blob storage
- Shadcn/UI - Beautiful, accessible components
- Tailwind CSS - Styling
- tRPC - End-to-end type-safe APIs
- Zod - Schema validation
- Zustand - State management
- Motion - Animations
- t3-env - Environment variables
- Pino - Structured Logging
- Langfuse - LLM observability & analytics
- Vercel Analytics - Web analytics
- Oxlint and Oxfmt - Code linting and formatting
- Ultracite - Oxlint and Oxfmt presets for humans and AI
- Streamdown - Markdown for AI streaming
- AI Elements - AI-native Components
- AI SDK Tools - Developer tools for AI SDK
Monorepo Layout
apps/site: Landing page (chatjs.dev)apps/chat: Next.js chat app (demo.chatjs.dev)apps/docs: Blume docs (chatjs.dev/docs)packages/cli: interactive scaffold CLI
Development
bun dev: run chat appbun dev:info: print this worktree's assigned app URLsbun dev:docs: run docsbun lint: check repository-wide Oxlint rules and Oxfmt formatting, plus docs healthbun format: format the repository with Oxfmtbun lint:fix: apply safe Oxlint fixesbun test:types: type-check the workspaces
oxlint-baseline.json files temporarily disable existing violations by file and rule; remove entries as the code is cleaned up. New files receive the full presets. Oxfmt skips build output and the five generated registration indexes whose exact content hashes are verified by chat-js sync.
Set CHATJS_DEV_SLOT in .env.worktree.local to reserve a stable range of ten ports per worktree. Within each range, chat uses offset 0, Electron uses 1, and the site uses 2, as configured in .worktree-env.json. The local file is ignored by Git and kept separate from Vercel-managed .env.local. Run bun dev:info instead of assuming a port.
Releases
Releases are driven by Changesets for the whole repository.
- Add a changeset for each releasable package you change.
- Merge the generated version PR from the Changesets workflow.
- Public packages such as
@chat-js/clipublish to npm. - Desktop installers for
@chat-js/electronpublish to GitHub Releases.
License
Apache-2.0