Better-T-Stack
Better-T-Stack is a modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with customizable configurations. This skill provides expert guidance for using it effectively.
When to Use This Skill
Use this skill when:
- Creating a new TypeScript project with frontend, backend, database, ORM, auth, or addons
- Adding features (addons, deployment config) to an existing Better-T-Stack project
- Troubleshooting compatibility issues between stack components
- Deciding on the right stack combination for a project's needs
- Understanding CLI options and their interactions
Quick Start
Interactive Mode
npx create-better-t-stack@latest
Follow the prompts to choose your stack interactively.
Non-Interactive (Recommended for Agents)
npx create-better-t-stack@latest my-project \
--frontend tanstack-router \
--backend hono \
--database sqlite \
--orm drizzle \
--auth better-auth \
--addons turborepo \
--yes
Add to Existing Project
cd my-existing-project
npx create-better-t-stack@latest add --addons pwa biome --install
Key Commands
create - Create new project
create-better-t-stack [project-directory] [options]
Core flags:
--template [template]: Use predefined stack (choices: "mern", "pern", "t3", "uniwind", "none")
--frontend <type>: tanstack-router, next, react-router, nuxt, svelte, solid, astro, native-uniwind, native-nativewind, none
--backend <type>: hono, express, fastify, elysia, convex, self, none
--database <type>: sqlite, postgres, mysql, mongodb, none
--orm <type>: drizzle, prisma, mongoose, none
--auth <provider>: better-auth, clerk, none
--api <type>: trpc, orpc, none
--addons <types...>: pwa, tauri, biome, turborepo, starlight, fumadocs, etc.
--yes: Use defaults, skip prompts (RECOMMENDED for automation)
--yolo: Bypass all validations (use with caution)
add - Add to existing project
create-better-t-stack add [options]
Used in project directory with bts.jsonc. Supports adding addons and deployment configs.
Critical Compatibility Rules
Must-Have Pairings
- Database + ORM: Always required together (both must be non-
none)
- MongoDB: Requires
prisma or mongoose (not drizzle)
- Workers runtime: Requires
hono backend, drizzle or prisma ORM, SQLite database
Single-Selection Constraints
- Web frameworks: Only one allowed (tanstack-router, next, etc.)
- Native frameworks: Only one allowed (native-uniwind or native-nativewind)
- Backend: Only one allowed
- Database: Only one allowed
- ORM: Only one allowed
API Compatibility
- tRPC: Not supported with nuxt, svelte, solid, or astro frontends (use oRPC instead)
- oRPC: Works with all frontends
Frontend + Backend Rules
- Web + Native: Can combine one web + one native
- Self backend (fullstack): Only supports next, tanstack-start, nuxt, and astro
- Convex backend: Not compatible with solid or astro frontends
Cloudflare Workers Constraints
--runtime workers REQUIRES:
backend: hono (only)
orm: drizzle or prisma (no mongoose)
database: sqlite only (no postgres, mysql, mongodb)
db-setup: d1 only (no docker)
Addon Compatibility
Some addons require specific frontends:
- PWA: Requires tanstack-router, react-router, solid, or next
- Tauri: Requires tanstack-router, react-router, nuxt, svelte, solid, or next
- Others: No frontend restrictions
Common Stack Patterns
Using Predefined Templates
npx create-better-t-stack my-app --template t3
Available templates:
- t3: Modern full-stack TypeScript stack
- mern: MongoDB, Express, React, Node
- pern: PostgreSQL, Express, React, Node
- uniwind: React Native with NativeWind styling
- none: No predefined template (configure manually)
Templates set multiple options at once. You can override specific flags:
npx create-better-t-stack my-app --template t3 --database postgres
Full-Stack Web App (Default)
npx create-better-t-stack my-webapp \
--frontend tanstack-router \
--backend hono \
--database sqlite \
--orm drizzle \
--auth better-auth \
--addons turborepo \
--yes
Backend-Only API Server
npx create-better-t-stack my-api \
--frontend none \
--backend fastify \
--runtime node \
--database postgres \
--orm prisma \
--api trpc \
--yes
Frontend-Only SPA
npx create-better-t-stack my-frontend \
--frontend next \
--backend none \
--api none \
--yes
Web + Native App
npx create-better-t-stack my-app \
--frontend next native-uniwind \
--backend hono \
--database sqlite \
--orm drizzle \
--auth better-auth \
--yes
Cloudflare Workers App
npx create-better-t-stack my-workers \
--runtime workers \
--backend hono \
--database sqlite \
--orm drizzle \
--db-setup d1 \
--yes
Important Notes
Mobile Development
When using native frontends with local backend development:
# Use machine IP, not localhost
EXPO_PUBLIC_SERVER_URL=http://192.168.1.X:3000
bts.jsonc File
- Created automatically during project initialization
- Stores stack configuration for
add command
- Safe to delete if you don't use
add command
- Must exist for
add command to work
Programmatic API
For automation and CI/CD:
import { init } from "create-better-t-stack";
const result = await init("my-project", {
frontend: ["tanstack-router"],
backend: "hono",
database: "sqlite",
orm: "drizzle",
auth: "better-auth",
yes: true
});
if (!result.success) {
console.error(result.error);
}
Best Practices
- Always use
--yes flag for agent-driven tasks to avoid interactive prompts
- Start with recommended defaults, then customize as needed
- Validate compatibility before generating commands - check critical rules above
- Use
--yolo only when you're certain about compatibility and want to skip validation
- Keep bts.jsonc if you plan to use
add command later
- Match database type to production needs (sqlite for dev, postgres/mysql/mongodb for prod)
- Choose ORM based on database: Drizzle for SQL, Mongoose for MongoDB
Reference Documentation
For complete details on:
- All compatibility rules and validation logic: references/COMPATIBILITY.md
- Complete CLI options and flags: references/OPTIONS.md
- Best practices and patterns: references/BEST-PRACTICES.md
- Example setups for different use cases: examples/SETUPS.md
Troubleshooting
Common Issues
"Incompatible addon/frontend combination"
- Check COMPATIBILITY.md for addon requirements
- Some addons (PWA, Tauri) require specific frontends
"Cannot select multiple web frameworks"
- Use only one web framework at a time
- Can combine one web + one native (e.g.,
--frontend next native-uniwind)
"MongoDB database is not compatible with Cloudflare Workers runtime"
- Workers runtime only supports SQLite with Drizzle/Prisma
- Use a different runtime or database
"Database requires an ORM"
- Must select both database and ORM (both non-
none)
- MongoDB requires Mongoose or Prisma (not Drizzle)
"Backend 'self' only supports Next.js and TanStack Start"
- Use a different backend (hono, express, etc.) for other frontends
- Or switch frontend to next or tanstack-start
1---2name: better-t-stack3description: Scaffold type-safe TypeScript projects with the Better-T-Stack CLI — new projects, features, or troubleshooting.4---56# Better-T-Stack78Better-T-Stack is a modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with customizable configurations. This skill provides expert guidance for using it effectively.910## When to Use This Skill1112Use this skill when:13- Creating a new TypeScript project with frontend, backend, database, ORM, auth, or addons14- Adding features (addons, deployment config) to an existing Better-T-Stack project15- Troubleshooting compatibility issues between stack components16- Deciding on the right stack combination for a project's needs17- Understanding CLI options and their interactions1819## Quick Start2021### Interactive Mode22```bash23npx create-better-t-stack@latest24```25Follow the prompts to choose your stack interactively.2627### Non-Interactive (Recommended for Agents)28```bash29npx create-better-t-stack@latest my-project \30 --frontend tanstack-router \31 --backend hono \32 --database sqlite \33 --orm drizzle \34 --auth better-auth \35 --addons turborepo \36 --yes37```3839### Add to Existing Project40```bash41cd my-existing-project42npx create-better-t-stack@latest add --addons pwa biome --install43```4445## Key Commands4647### `create` - Create new project48```bash49create-better-t-stack [project-directory] [options]50```51Core flags:52- `--template [template]`: Use predefined stack (choices: "mern", "pern", "t3", "uniwind", "none")53- `--frontend <type>`: tanstack-router, next, react-router, nuxt, svelte, solid, astro, native-uniwind, native-nativewind, none54- `--backend <type>`: hono, express, fastify, elysia, convex, self, none55- `--database <type>`: sqlite, postgres, mysql, mongodb, none56- `--orm <type>`: drizzle, prisma, mongoose, none57- `--auth <provider>`: better-auth, clerk, none58- `--api <type>`: trpc, orpc, none59- `--addons <types...>`: pwa, tauri, biome, turborepo, starlight, fumadocs, etc.60- `--yes`: Use defaults, skip prompts (RECOMMENDED for automation)61- `--yolo`: Bypass all validations (use with caution)6263### `add` - Add to existing project64```bash65create-better-t-stack add [options]66```67Used in project directory with `bts.jsonc`. Supports adding addons and deployment configs.6869## Critical Compatibility Rules7071### Must-Have Pairings72- **Database + ORM**: Always required together (both must be non-`none`)73- **MongoDB**: Requires `prisma` or `mongoose` (not `drizzle`)74- **Workers runtime**: Requires `hono` backend, `drizzle` or `prisma` ORM, SQLite database7576### Single-Selection Constraints77- **Web frameworks**: Only one allowed (tanstack-router, next, etc.)78- **Native frameworks**: Only one allowed (native-uniwind or native-nativewind)79- **Backend**: Only one allowed80- **Database**: Only one allowed81- **ORM**: Only one allowed8283### API Compatibility84- **tRPC**: Not supported with nuxt, svelte, solid, or astro frontends (use oRPC instead)85- **oRPC**: Works with all frontends8687### Frontend + Backend Rules88- **Web + Native**: Can combine one web + one native89- **Self backend** (fullstack): Only supports next, tanstack-start, nuxt, and astro90- **Convex backend**: Not compatible with solid or astro frontends9192### Cloudflare Workers Constraints93```94--runtime workers REQUIRES:95 backend: hono (only)96 orm: drizzle or prisma (no mongoose)97 database: sqlite only (no postgres, mysql, mongodb)98 db-setup: d1 only (no docker)99```100101### Addon Compatibility102Some addons require specific frontends:103- **PWA**: Requires tanstack-router, react-router, solid, or next104- **Tauri**: Requires tanstack-router, react-router, nuxt, svelte, solid, or next105- **Others**: No frontend restrictions106107## Common Stack Patterns108109### Using Predefined Templates110```bash111npx create-better-t-stack my-app --template t3112```113Available templates:114- **t3**: Modern full-stack TypeScript stack115- **mern**: MongoDB, Express, React, Node116- **pern**: PostgreSQL, Express, React, Node117- **uniwind**: React Native with NativeWind styling118- **none**: No predefined template (configure manually)119120Templates set multiple options at once. You can override specific flags:121```bash122npx create-better-t-stack my-app --template t3 --database postgres123```124125### Full-Stack Web App (Default)126```bash127npx create-better-t-stack my-webapp \128 --frontend tanstack-router \129 --backend hono \130 --database sqlite \131 --orm drizzle \132 --auth better-auth \133 --addons turborepo \134 --yes135```136137### Backend-Only API Server138```bash139npx create-better-t-stack my-api \140 --frontend none \141 --backend fastify \142 --runtime node \143 --database postgres \144 --orm prisma \145 --api trpc \146 --yes147```148149### Frontend-Only SPA150```bash151npx create-better-t-stack my-frontend \152 --frontend next \153 --backend none \154 --api none \155 --yes156```157158### Web + Native App159```bash160npx create-better-t-stack my-app \161 --frontend next native-uniwind \162 --backend hono \163 --database sqlite \164 --orm drizzle \165 --auth better-auth \166 --yes167```168169### Cloudflare Workers App170```bash171npx create-better-t-stack my-workers \172 --runtime workers \173 --backend hono \174 --database sqlite \175 --orm drizzle \176 --db-setup d1 \177 --yes178```179180## Important Notes181182### Mobile Development183When using native frontends with local backend development:184```bash185# Use machine IP, not localhost186EXPO_PUBLIC_SERVER_URL=http://192.168.1.X:3000187```188189### bts.jsonc File190- Created automatically during project initialization191- Stores stack configuration for `add` command192- **Safe to delete** if you don't use `add` command193- Must exist for `add` command to work194195### Programmatic API196For automation and CI/CD:197```typescript198import { init } from "create-better-t-stack";199200const result = await init("my-project", {201 frontend: ["tanstack-router"],202 backend: "hono",203 database: "sqlite",204 orm: "drizzle",205 auth: "better-auth",206 yes: true207});208209if (!result.success) {210 console.error(result.error);211}212```213214## Best Practices2152161. **Always use `--yes` flag** for agent-driven tasks to avoid interactive prompts2172. **Start with recommended defaults**, then customize as needed2183. **Validate compatibility** before generating commands - check critical rules above2194. **Use `--yolo` only when you're certain** about compatibility and want to skip validation2205. **Keep bts.jsonc** if you plan to use `add` command later2216. **Match database type to production needs** (sqlite for dev, postgres/mysql/mongodb for prod)2227. **Choose ORM based on database**: Drizzle for SQL, Mongoose for MongoDB223224## Reference Documentation225226For complete details on:227- All compatibility rules and validation logic: [references/COMPATIBILITY.md](references/COMPATIBILITY.md)228- Complete CLI options and flags: [references/OPTIONS.md](references/OPTIONS.md)229- Best practices and patterns: [references/BEST-PRACTICES.md](references/BEST-PRACTICES.md)230- Example setups for different use cases: [examples/SETUPS.md](examples/SETUPS.md)231232## Troubleshooting233234### Common Issues235236**"Incompatible addon/frontend combination"**237- Check [COMPATIBILITY.md](references/COMPATIBILITY.md) for addon requirements238- Some addons (PWA, Tauri) require specific frontends239240**"Cannot select multiple web frameworks"**241- Use only one web framework at a time242- Can combine one web + one native (e.g., `--frontend next native-uniwind`)243244**"MongoDB database is not compatible with Cloudflare Workers runtime"**245- Workers runtime only supports SQLite with Drizzle/Prisma246- Use a different runtime or database247248**"Database requires an ORM"**249- Must select both database and ORM (both non-`none`)250- MongoDB requires Mongoose or Prisma (not Drizzle)251252**"Backend 'self' only supports Next.js and TanStack Start"**253- Use a different backend (hono, express, etc.) for other frontends254- Or switch frontend to next or tanstack-start