create-better-tanstacked
v3.44.4
Published
A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations
Maintainers
Readme
create-better-tanstacked CLI
A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations
Sponsors

Quick Start
Run without installing globally:
# Using bun (recommended)
bun create better-tanstacked@latest
# Using pnpm
pnpm create better-tanstacked@latest
# Using npm
npx create-better-tanstacked@latestFollow the prompts to configure your project or use the --yes flag for defaults.
Requirements
- Node.js 22 or newer to run the CLI with Node.js. The selected framework may require a newer release; the CLI checks the exact stack before writing files.
- Bun 1.4 or newer is recommended. Bun 1.2.14 remains the minimum because generated workspaces use dependency catalogs.
- pnpm 10.26.0 or newer when using pnpm (catalogs and
allowBuilds). - npm 11.16.0 or newer when using npm (
allowScripts).
Docker Compose 2.24 or newer is required by generated Docker stacks. Git, Rust, Docker, and platform SDKs otherwise remain optional and are only needed when you use their corresponding generated commands.
Features
| Category | Options | | ------------------------ | ---------------------------------------------------------------------------------------------------- | | TypeScript | End-to-end type safety across the generated application | | Frontend | TanStack Router, TanStack Start, or none | | Backend | Hono, Elysia, TanStack Start fullstack, or none | | API Layer | tRPC, oRPC, or none | | Runtime | Bun, Node.js, Cloudflare Workers, or none | | Database | SQLite, PostgreSQL, or none | | ORM | Drizzle or none | | Database Setup | Turso, Cloudflare D1, Neon, Supabase, Prisma Postgres, PlanetScale, Docker, or none | | Authentication | Better Auth, Clerk, or none | | Styling | Tailwind CSS with a shared shadcn/ui package for React web apps | | Addons | PWA, Tauri, Electrobun, Fumadocs, Oxlint, Lefthook, Turborepo, Vite+, evlog, MCP, Skills, or OpenTUI | | Examples | Todo app or AI chat interface (Vercel AI SDK) | | Developer Experience | Git initialization, package manager choice (npm, pnpm, bun), and automatic dependency installation |
Usage
Usage: create-better-tanstacked [project-directory] [options]
Options:
-V, --version Output the version number
-y, --yes Use default configuration
--template <type> Use a template (uniwind, none)
--database <type> Database type (none, sqlite, postgres)
--orm <type> ORM type (none, drizzle)
--dry-run Validate configuration without writing files
--auth <provider> Authentication (better-auth, clerk, none)
--payments <provider> Payments provider (polar, none)
--frontend <type> Frontend (tanstack-router, tanstack-start, none)
--addons <types...> Additional addons (pwa, tauri, electrobun, lefthook, mcp, turborepo, vite-plus, fumadocs, oxlint, opentui, skills, evlog, none)
--examples <types...> Examples to include (todo, ai, none)
--git Initialize git repository
--no-git Skip git initialization
--package-manager <pm> Package manager (npm, pnpm, bun)
--install Install dependencies
--no-install Skip installing dependencies
--open <target> Open in an editor, IDE, or coding agent after creation
--db-setup <setup> Database setup (turso, d1, neon, supabase, prisma-postgres, planetscale, docker, none)
--web-deploy <setup> Web deployment (cloudflare, docker, vercel, none)
--server-deploy <setup> Server deployment (cloudflare, docker, vercel, none)
--backend <framework> Backend framework (hono, elysia, self, none)
--runtime <runtime> Runtime (bun, node, workers, none)
--api <type> API type (trpc, orpc, none)
--directory-conflict <strategy> Directory strategy (merge, overwrite, increment, error)
--manual-db Skip automatic database setup prompts
-h, --help Display helpAgent-Focused Commands
# Raw JSON payload input (agent-friendly)
create-better-tanstacked create-json --input '{"projectName":"my-app","yes":true,"dryRun":true}'
create-better-tanstacked add-json --input '{"projectDir":"./my-app","addons":["opentui"],"addonOptions":{"opentui":{"template":"core"}}}'
create-better-tanstacked create-json --input '{"projectName":"db-app","database":"postgres","orm":"drizzle","dbSetup":"neon","dbSetupOptions":{"mode":"manual"}}'
# Runtime schema/introspection output
create-better-tanstacked schema --name all
create-better-tanstacked schema --name createInput
create-better-tanstacked schema --name addInput
create-better-tanstacked schema --name addonOptions
create-better-tanstacked schema --name dbSetupOptions
create-better-tanstacked schema --name cli
# Local stdio MCP server
npx create-better-tanstacked@latest mcpTo install Better T Stack into supported agent configs with add-mcp and avoid relying on a global CLI install:
npx -y add-mcp@latest "npx -y create-better-tanstacked@latest mcp"When you scaffold with the mcp addon, Better T Stack itself can also be installed into supported agent configs through add-mcp using a package runner command instead of assuming a global CLI install. For Bun projects, the generated config uses the equivalent bunx create-better-tanstacked@latest mcp server command inside add-mcp.
For MCP project creation, prefer install: false. Long dependency installs can exceed common MCP client request timeouts, so the safest flow is to scaffold first and run your package manager install command afterward in the project directory.
Telemetry
This CLI collects anonymous usage data to help improve the tool. The data collected includes:
- Configuration options selected
- CLI version
- Node.js version
- Platform (OS)
- How the CLI was driven (prompts, flags,
--yes, JSON, the programmatic API, or the MCP server)
Separately, one anonymous failure event is sent when a scaffold breaks (stage and error class, never full messages or paths). See the analytics documentation for details.
Telemetry is enabled by default in published versions to help us understand usage patterns and improve the tool.
Disabling Telemetry
You can disable telemetry by setting the BTS_TELEMETRY_DISABLED environment variable:
# Disable telemetry for a single run
BTS_TELEMETRY_DISABLED=1 npx create-better-tanstacked
# Disable telemetry globally in your shell profile (.bashrc, .zshrc, etc.)
export BTS_TELEMETRY_DISABLED=1The CLI also honors the cross-tool DO_NOT_TRACK=1 convention (https://consoledonottrack.com), and --disable-analytics skips telemetry for a single run.
Examples
Create a project with default configuration:
npx create-better-tanstacked --yesValidate a command without writing files:
npx create-better-tanstacked --yes --dry-runCreate a project with specific options:
npx create-better-tanstacked --database postgres --orm drizzle --auth better-auth --addons pwa oxlintCreate a project with Elysia backend and Node.js runtime:
npx create-better-tanstacked --backend elysia --runtime nodeCreate a project with a TanStack Start frontend:
npx create-better-tanstacked --frontend tanstack-startCreate a project with examples:
npx create-better-tanstacked --examples todo aiCreate a project with Turso database setup:
npx create-better-tanstacked --database sqlite --orm drizzle --db-setup tursoCreate a project with Supabase PostgreSQL setup:
npx create-better-tanstacked --database postgres --orm drizzle --db-setup supabase --auth better-authCreate a fullstack project with TanStack Start:
npx create-better-tanstacked --backend self --frontend tanstack-startCreate a project with a Fumadocs site:
npx create-better-tanstacked --addons fumadocsCreate a minimal TypeScript project with no backend:
npx create-better-tanstacked --backend none --frontend tanstack-routerCreate a backend-only project with no frontend:
npx create-better-tanstacked --frontend none --backend hono --database postgres --orm drizzleCreate a simple frontend-only project:
npx create-better-tanstacked --backend none --frontend tanstack-router --addons none --examples noneCreate a Cloudflare Workers project:
npx create-better-tanstacked --backend hono --runtime workers --database sqlite --orm drizzle --db-setup d1Create a self-hosted fullstack project on Cloudflare with D1:
npx create-better-tanstacked --backend self --frontend tanstack-start --runtime none --api trpc --database sqlite --orm drizzle --db-setup d1 --web-deploy cloudflareCreate a self-hosted project that ships as Docker containers (web + server + database via Docker Compose):
npx create-better-tanstacked --frontend tanstack-router --backend hono --runtime bun --database postgres --orm drizzle --db-setup docker --web-deploy docker --server-deploy dockerCreate a minimal API-only project:
npx create-better-tanstacked --frontend none --backend hono --api trpc --database none --addons noneCompatibility Notes
- Backend
selfuses TanStack Start server routes and requires the TanStack Start frontend. - Backend
nonedisables API, ORM, database, authentication, and runtime setup. - Frontend
nonecreates a backend-only project. - API
nonedisables tRPC and oRPC setup. - Database
nonedisables database setup and requires ORMnone. - Runtime
noneis available with backendnoneorself. - Cloudflare Workers supports the Hono backend and SQLite databases.
- Cloudflare D1 requires SQLite and either Workers with Cloudflare server deployment or TanStack Start fullstack with Cloudflare web deployment.
- PWA requires TanStack Router. Tauri and Electrobun support TanStack Router and TanStack Start.
- Addons
noneskips all addons. Examplesnoneskips all example implementations.
Project Structure
The created project follows a clean monorepo structure:
my-better-t-app/
├── apps/
│ ├── web/ # Frontend application
│ ├── server/ # Backend API
│ └── docs/ # (optional) Documentation site
├── packages/ # Shared packages
└── README.md # Auto-generated project documentationAfter project creation, you'll receive detailed instructions for next steps and additional setup requirements.
