CLI Reference
@chat-js/cli command reference
Overview
@chat-js/cli scaffolds new ChatJS applications. It walks you through selecting an AI gateway, features, and auth providers, then generates a fully configured Next.js project.
Installation
No installation required — run it directly with npx:
npx @chat-js/cli@latest create my-app
Or install globally:
npm install -g @chat-js/cli
chat-js create my-app
Commands
create
Scaffold a new ChatJS app. This is the default command — you can omit the word create and pass the directory directly.
npx @chat-js/cli@latest create [directory] [options]
npx @chat-js/cli@latest [directory] [options]
Arguments
| Argument | Description |
|---|---|
directory |
Target directory for the project. Prompted interactively if omitted. |
Options
| Flag | Default | Description |
|---|---|---|
-y, --yes |
false |
Skip all prompts and use defaults (Vercel gateway, GitHub auth, no extra features). |
--no-install |
— | Skip automatic dependency installation. |
--package-manager <bun|npm|pnpm|yarn> |
— | Override which package manager the CLI uses for install + next steps. |
--from-git <url> |
— | Clone from a git repository instead of the built-in template. |
-v, --version |
— | Print the CLI version. |
The CLI keeps pnpm, yarn, and bun when launched from those tools. If you launch through npx/npm, it defaults the generated app to Bun unless you pass --package-manager.
After scaffolding, the CLI prints the exact environment variables required for your chosen configuration.
add
npx @chat-js/cli@latest add [components...]
Add a component or feature to an existing ChatJS project.
Status: not yet implemented. This command is reserved for a future release that will let you add features, auth providers, and gateways to existing projects without re-scaffolding.
What gets generated
The create command copies the built-in template and then writes a tailored chat.config.ts. The generated project structure is:
my-app/
├── app/ # Next.js App Router pages and layouts
│ ├── (auth)/ # Auth-related routes
│ ├── (chat)/ # Chat interface routes
│ ├── api/ # API route handlers
│ └── layout.tsx
├── components/ # Shared UI components
├── hooks/ # React hooks
├── lib/ # Core logic (AI, auth, DB, config schema)
├── providers/ # React context providers
├── trpc/ # tRPC router
├── chat.config.ts # Your app configuration (generated)
├── drizzle.config.ts # Database schema config
├── next.config.ts
├── package.json
└── tsconfig.json
chat.config.ts is written with your chosen gateway, features, and auth providers pre-filled. All other config fields are set to sensible defaults with inline comments.
Examples
Interactive setup (recommended)
npx @chat-js/cli@latest create my-chat-app
Skip prompts, use all defaults
npx @chat-js/cli@latest create my-chat-app --yes
Defaults: Vercel AI Gateway, GitHub OAuth, Follow-up Suggestions only, bun install.
Create without installing dependencies
npx @chat-js/cli@latest create my-chat-app --no-install
Use npm for install + printed next steps
npx @chat-js/cli@latest create my-chat-app --package-manager npm
Clone from a custom git repository
npx @chat-js/cli@latest create my-chat-app --from-git https://github.com/your-org/your-fork
Full flow after scaffolding
npx @chat-js/cli@latest create my-chat-app
cd my-chat-app
cp .env.example .env.local
# Fill in the env vars printed by the CLI
bun run db:push
bun run dev