chore(web): improve docs

This commit is contained in:
Aman Varshney
2025-08-09 22:23:07 +05:30
parent 38403fe863
commit 52d2af5184
17 changed files with 986 additions and 369 deletions

View File

@@ -1,68 +0,0 @@
---
title: add
description: Add addons or deployment to an existing project
---
## Usage
<Tabs items={['bun', 'pnpm', 'npm']}>
<Tab value="bun">
```bash
bun create better-t-stack@latest add
```
</Tab>
<Tab value="pnpm">
```bash
pnpm create better-t-stack@latest add
```
</Tab>
<Tab value="npm">
```bash
npx create-better-t-stack@latest add
```
</Tab>
</Tabs>
## Flags
### Addons
- `--addons` Multiple values to add features
- Values: `pwa`, `tauri`, `starlight`, `biome`, `husky`, `turborepo`, `fumadocs`, `ultracite`, `oxlint`, `none`
- Do not combine `none` with other values
### Deployment
- `--web-deploy` One of: `workers`, `none`
- Requires that the project includes a web frontend
### Project directory and install
- `--project-dir` Path to target project (default: current directory)
- `--install` / `--no-install` Install dependencies after applying changes
- `--package-manager` One of: `bun`, `pnpm`, `npm`
## Examples
```bash
# Add PWA and Turborepo to the current project
bun create better-t-stack@latest add --addons pwa turborepo --install
```
```bash
# Add Cloudflare Workers deployment
bun create better-t-stack@latest add --web-deploy workers
```
```bash
# Operate on a specific project directory using bun
bun create better-t-stack@latest add --project-dir ./apps/web --addons biome --package-manager bun
```
## Compatibility notes
- Web deployment requires a web frontend to be present
- Addons must be compatible with the selected frontend; the CLI validates this and fails with a clear error if incompatible
For general compatibility rules, see the main CLI reference.

View File

@@ -1,26 +0,0 @@
---
title: builder
description: Open the web-based stack builder
---
## Usage
<Tabs items={['bun', 'pnpm', 'npm']}>
<Tab value="bun">
```bash
bun create better-t-stack@latest builder
```
</Tab>
<Tab value="pnpm">
```bash
pnpm create better-t-stack@latest builder
```
</Tab>
<Tab value="npm">
```bash
npx create-better-t-stack@latest builder
```
</Tab>
</Tabs>
This command has no flags.

View File

@@ -0,0 +1,219 @@
---
title: Compatibility Rules
description: Understanding compatibility rules and restrictions between different CLI options
---
## Overview
The CLI validates option combinations to ensure generated projects work correctly. Here are the key compatibility rules and restrictions.
## Database & ORM Compatibility
### Required Combinations
| Database | Compatible ORMs | Notes |
|----------|----------------|-------|
| `sqlite` | `drizzle`, `prisma` | Lightweight, file-based database |
| `postgres` | `drizzle`, `prisma` | Advanced relational database |
| `mysql` | `drizzle`, `prisma` | Traditional relational database |
| `mongodb` | `mongoose`, `prisma` | Document database, requires specific ORMs |
| `none` | `none` | No database setup |
### Restrictions
- **MongoDB + Drizzle**: ❌ Not supported - Drizzle doesn't support MongoDB
- **Database without ORM**: ❌ Not supported - Database requires an ORM for code generation
- **ORM without Database**: ❌ Not supported - ORM requires a database target
```bash
# ❌ Invalid - MongoDB with Drizzle
create-better-t-stack --database mongodb --orm drizzle
# ✅ Valid - MongoDB with Mongoose
create-better-t-stack --database mongodb --orm mongoose
```
## Backend & Runtime Compatibility
### Cloudflare Workers Restrictions
Cloudflare Workers has specific compatibility requirements:
| Component | Requirement | Reason |
|-----------|-------------|--------|
| Backend | Must be `hono` | Only Hono supports Workers runtime |
| ORM | Must be `drizzle` or `none` | Workers doesn't support Prisma/Mongoose |
| Database | Cannot be `mongodb` | MongoDB requires Prisma/Mongoose |
| Database Setup | Cannot be `docker` | Workers is serverless, no Docker support |
```bash
# ❌ Invalid - Workers with Express
create-better-t-stack --runtime workers --backend express
# ✅ Valid - Workers with Hono
create-better-t-stack --runtime workers --backend hono --database sqlite --orm drizzle --db-setup d1
```
### Backend Presets
#### Convex Backend
When using `--backend convex`, the following options are automatically set:
- `--auth false` (Convex handles auth)
- `--database none` (Convex provides database)
- `--orm none` (Convex provides data layer)
- `--api none` (Convex provides API)
- `--runtime none` (Convex manages runtime)
- `--db-setup none` (Convex manages hosting)
- `--examples todo` (Todo example works with Convex)
#### No Backend
When using `--backend none`, the following options are automatically set:
- `--auth false` (No backend for auth)
- `--database none` (No backend for database)
- `--orm none` (No database)
- `--api none` (No backend for API)
- `--runtime none` (No backend to run)
- `--db-setup none` (No database to host)
- `--examples none` (Examples require backend)
## Frontend & API Compatibility
### API Framework Support
| Frontend | tRPC Support | oRPC Support | Notes |
|----------|-------------|-------------|-------|
| `tanstack-router` | ✅ | ✅ | Full support |
| `react-router` | ✅ | ✅ | Full support |
| `tanstack-start` | ✅ | ✅ | Full support |
| `next` | ✅ | ✅ | Full support |
| `nuxt` | ❌ | ✅ | tRPC not supported |
| `svelte` | ❌ | ✅ | tRPC not supported |
| `solid` | ❌ | ✅ | tRPC not supported |
| Native frameworks | ✅ | ✅ | Full support |
```bash
# ❌ Invalid - Nuxt with tRPC
create-better-t-stack --frontend nuxt --api trpc
# ✅ Valid - Nuxt with oRPC
create-better-t-stack --frontend nuxt --api orpc
```
### Frontend Restrictions
- **Multiple Web Frontends**: ❌ Only one web framework allowed
- **Multiple Native Frontends**: ❌ Only one native framework allowed
- **Web + Native**: ✅ One web and one native framework allowed
```bash
# ❌ Invalid - Multiple web frontends
create-better-t-stack --frontend next tanstack-router
# ✅ Valid - Web + native
create-better-t-stack --frontend next native-nativewind
```
## Database Setup Compatibility
### Provider Requirements
| Setup Provider | Required Database | Notes |
|---------------|------------------|-------|
| `turso` | `sqlite` | Distributed SQLite |
| `d1` | `sqlite` | Cloudflare D1 (requires Workers runtime) |
| `neon` | `postgres` | Serverless PostgreSQL |
| `supabase` | `postgres` | PostgreSQL with additional features |
| `prisma-postgres` | `postgres` | Managed PostgreSQL via Prisma |
| `mongodb-atlas` | `mongodb` | Managed MongoDB |
| `docker` | `postgres`, `mysql`, `mongodb` | Not compatible with `sqlite` or Workers |
### Special Cases
#### Cloudflare D1
- Requires `--database sqlite`
- Requires `--runtime workers`
- Requires `--backend hono`
#### Docker Setup
- Cannot be used with `sqlite` (file-based database)
- Cannot be used with `workers` runtime (serverless environment)
## Addon Compatibility
### PWA Support
- Requires web frontend
- Compatible frontends: `tanstack-router`, `react-router`, `next`, `solid`
- Not compatible with native-only projects
### Tauri (Desktop Apps)
- Requires web frontend
- Compatible frontends: `tanstack-router`, `react-router`, `nuxt`, `svelte`, `solid`
- Cannot be combined with native frameworks
### Web Deployment
- `--web-deploy workers` requires a web frontend
- Cannot be used with native-only projects
## Authentication Requirements
Authentication requires:
- A backend framework (cannot be `none`)
- A database (cannot be `none`)
- An ORM (cannot be `none`)
```bash
# ❌ Invalid - Auth without database
create-better-t-stack --auth --database none
# ✅ Valid - Auth with full stack
create-better-t-stack --auth --database postgres --orm drizzle --backend hono
```
## Example Compatibility
### Todo Example
- Requires a database when backend is present (except Convex)
- Cannot be used with `--backend none` and `--database none`
### AI Example
- Not compatible with `--backend elysia`
- Not compatible with `--frontend solid`
## Common Error Messages
### "Mongoose ORM requires MongoDB database"
```bash
# Fix by using MongoDB
create-better-t-stack --database mongodb --orm mongoose
```
### "Cloudflare Workers runtime is only supported with Hono backend"
```bash
# Fix by using Hono
create-better-t-stack --runtime workers --backend hono
```
### "Cannot select multiple web frameworks"
```bash
# Fix by choosing one web framework
create-better-t-stack --frontend tanstack-router
```
### "Authentication requires a database"
```bash
# Fix by adding database
create-better-t-stack --auth --database postgres --orm drizzle
```
## Validation Strategy
The CLI validates compatibility in this order:
1. **Basic validation**: Required parameters, valid enum values
2. **Combination validation**: Database + ORM, Backend + Runtime compatibility
3. **Feature validation**: Auth requirements, addon compatibility
4. **Example validation**: Example + stack compatibility
Understanding these rules helps you create valid configurations and troubleshoot issues when the CLI reports compatibility errors.

View File

@@ -1,26 +0,0 @@
---
title: docs
description: Open the documentation
---
## Usage
<Tabs items={['bun', 'pnpm', 'npm']}>
<Tab value="bun">
```bash
bun create better-t-stack@latest docs
```
</Tab>
<Tab value="pnpm">
```bash
pnpm create better-t-stack@latest docs
```
</Tab>
<Tab value="npm">
```bash
npx create-better-t-stack@latest docs
```
</Tab>
</Tabs>
This command has no flags.

View File

@@ -1,23 +1,149 @@
---
title: CLI
description: Command reference index
title: Commands
description: Complete reference for all CLI commands
---
<Cards>
<Card href="/docs/cli/init" title="init">
Create a new BetterTStack project (prompts or --yes)
</Card>
<Card href="/docs/cli/add" title="add">
Add addons or deployment to an existing project
</Card>
<Card href="/docs/cli/builder" title="builder">
Open the web-based Stack Builder
</Card>
<Card href="/docs/cli/docs" title="docs">
Open documentation
</Card>
<Card href="/docs/cli/sponsors" title="sponsors">
View project sponsors
</Card>
</Cards>
## Overview
The Better-T Stack CLI provides several commands to manage your TypeScript projects.
## `init` (Default Command)
Creates a new Better-T Stack project.
```bash
create-better-t-stack [project-directory] [options]
```
### Parameters
- `project-directory` (optional): Name or path for your project directory
### Key Options
- `--yes, -y`: Use default configuration (skips prompts)
- `--package-manager <pm>`: `npm`, `pnpm`, `bun`
- `--install / --no-install`: Install dependencies after creation
- `--git / --no-git`: Initialize Git repository
- `--frontend <types...>`: Web and/or native frameworks (see [Options](/docs/cli/options#frontend))
- `--backend <framework>`: `hono`, `express`, `fastify`, `elysia`, `next`, `convex`, `none`
- `--runtime <runtime>`: `bun`, `node`, `workers` (`none` only with `--backend convex` or `--backend none`)
- `--database <type>`: `none`, `sqlite`, `postgres`, `mysql`, `mongodb`
- `--orm <type>`: `none`, `drizzle`, `prisma`, `mongoose`
- `--api <type>`: `none`, `trpc`, `orpc`
- `--db-setup <setup>`: `none`, `turso`, `d1`, `neon`, `supabase`, `prisma-postgres`, `mongodb-atlas`, `docker`
- `--examples <types...>`: `none`, `todo`, `ai`
- `--web-deploy <setup>`: `none`, `workers`
See the full reference in [Options](/docs/cli/options).
### Examples
```bash
# Default setup with prompts
create-better-t-stack
# Quick setup with defaults
create-better-t-stack --yes
# Specific configuration
create-better-t-stack --database postgres --backend hono --frontend tanstack-router
```
## `add`
Adds addons or deployment configurations to an existing Better-T Stack project.
```bash
create-better-t-stack add [options]
```
### Options
- `--addons <types...>`: Addons to add (see [Addons](/docs/cli/options#addons))
- `--web-deploy <setup>`: Web deployment setup (`workers`, `none`)
- `--project-dir <path>`: Project directory (defaults to current directory)
- `--install`: Install dependencies after adding
- `--package-manager <pm>`: Package manager to use
### Examples
```bash
# Add addons interactively
create-better-t-stack add
# Add specific addons
create-better-t-stack add --addons pwa tauri --install
# Add deployment setup
create-better-t-stack add --web-deploy workers
```
## `sponsors`
Displays Better-T Stack sponsors.
```bash
create-better-t-stack sponsors
```
Shows a list of project sponsors and supporters.
## `docs`
Opens the Better-T Stack documentation in your default browser.
```bash
create-better-t-stack docs
```
Opens `https://better-t-stack.dev/docs` in your browser.
## `builder`
Opens the web-based stack builder in your default browser.
```bash
create-better-t-stack builder
```
Opens `https://better-t-stack.dev/new` where you can configure your stack visually.
## Global Options
These options work with any command:
- `--help, -h`: Display help information
- `--version, -V`: Display CLI version
## Command Examples
### Create a Full-Stack App
```bash
create-better-t-stack \
--database postgres \
--orm drizzle \
--backend hono \
--frontend tanstack-router \
--auth \
--addons pwa biome
```
### Create a Backend-Only Project
```bash
create-better-t-stack api-server \
--frontend none \
--backend hono \
--database postgres \
--orm drizzle \
--api trpc
```
### Add Features to Existing Project
```bash
cd my-existing-project
create-better-t-stack add --addons tauri starlight --install
```

View File

@@ -1,151 +0,0 @@
---
title: init
description: Create a new Better-T-Stack project
---
## Usage
<Tabs items={['bun', 'pnpm', 'npm']}>
<Tab value="bun">
```bash
bun create better-t-stack@latest [project-directory]
```
</Tab>
<Tab value="pnpm">
```bash
pnpm create better-t-stack@latest [project-directory]
```
</Tab>
<Tab value="npm">
```bash
npx create-better-t-stack@latest [project-directory]
```
</Tab>
</Tabs>
You can pass `.` to use the current directory.
### Skip prompts
```bash
bun create better-t-stack@latest my-app --yes
```
## Flags Reference
### General
- `--yes, -y` Skip all prompts and use defaults
- `--help, -h` Show help
- `--version, -V` Show CLI version
### Frontend
- `--frontend` Choose one web frontend and optionally one native frontend
- Web: `tanstack-router`, `react-router`, `tanstack-start`, `next`, `nuxt`, `svelte`, `solid`
- Native: `native-nativewind`, `native-unistyles`
- Special: `none`
- Notes: At most one from each group; do not combine `none` with others
### Backend
- `--backend` One of: `hono`, `express`, `fastify`, `next`, `elysia`, `convex`, `none`
### Runtime
- `--runtime` One of: `bun`, `node`, `workers`, `none`
- `workers` only with `--backend hono`
- `none` only with `--backend convex` or `--backend none`
### Database
- `--database` One of: `sqlite`, `postgres`, `mysql`, `mongodb`, `none`
### ORM
- `--orm` One of: `drizzle`, `prisma`, `mongoose`, `none`
- `mongoose` requires `--database mongodb`
- `drizzle` is not compatible with `--database mongodb`
### API
- `--api` One of: `trpc`, `orpc`, `none`
- Use `orpc` with `nuxt`, `svelte`, or `solid` (tRPC not supported there)
### Authentication
- `--auth` Enable auth
- `--no-auth` Disable auth
- Auth requires a non-`none` database
### Addons
- `--addons` Multiple values: `pwa`, `tauri`, `starlight`, `biome`, `husky`, `turborepo`, `fumadocs`, `ultracite`, `oxlint`, `none`
- Do not combine `none` with other values
### Examples
- `--examples` Multiple values: `todo`, `ai`, `none`
- Do not combine `none` with other values
### Database setup
- `--db-setup` One of: `turso`, `neon`, `prisma-postgres`, `mongodb-atlas`, `supabase`, `d1`, `docker`, `none`
- `turso` → requires `--database sqlite`
- `neon`, `prisma-postgres`, `supabase` → require `--database postgres`
- `mongodb-atlas` → requires `--database mongodb`
- `d1` → requires `--database sqlite` and `--runtime workers`
- `docker` → not compatible with `--database sqlite` or `--runtime workers`
### Web deployment
- `--web-deploy` One of: `workers`, `none`
- Requires selecting a web frontend
### Project setup
- `--git` / `--no-git` Initialize git repository
- `--install` / `--no-install` Install dependencies
- `--package-manager` One of: `bun`, `pnpm`, `npm`
## Examples
```bash
# Full-stack web app
bun create better-t-stack@latest my-webapp \
--frontend tanstack-router \
--backend hono \
--runtime bun \
--database postgres \
--orm drizzle \
--api trpc \
--auth \
--db-setup neon \
--addons pwa turborepo \
--examples todo
```
```bash
# Cloudflare Workers
bun create better-t-stack@latest my-workers \
--frontend tanstack-router \
--backend hono \
--runtime workers \
--database sqlite \
--orm drizzle \
--db-setup d1 \
--web-deploy workers
```
## Compatibility notes
- Workers runtime only with `--backend hono` and `--orm drizzle` or `--orm none`
- MongoDB requires `--orm mongoose` or `--orm prisma`
- Convex backend forces: no auth, no db, no orm, no api, no runtime, no db-setup; Solid is not supported
- Todo example requires a database when a non-Convex backend is selected
- AI example is not compatible with `--backend elysia` or `--frontend solid`
The CLI validates incompatible combinations and fails fast with clear messages.
See also: Compatibility overview in the main CLI reference.

View File

@@ -1,5 +1,9 @@
{
"title": "CLI",
"defaultOpen": true,
"pages": ["index", "init", "add", "builder", "docs", "sponsors"]
}
"pages": [
"index",
"options",
"compatibility"
]
}

View File

@@ -0,0 +1,253 @@
---
title: Options Reference
description: Complete reference for all CLI options and flags
---
## General Options
### `--yes, -y`
Use default configuration and skip interactive prompts.
```bash
create-better-t-stack --yes
```
### `--package-manager <pm>`
Choose package manager: `npm`, `pnpm`, or `bun`.
```bash
create-better-t-stack --package-manager bun
```
### `--install / --no-install`
Control dependency installation after project creation.
```bash
create-better-t-stack --no-install
```
### `--git / --no-git`
Control Git repository initialization.
```bash
create-better-t-stack --no-git
```
## Database Options
### `--database <type>`
Database type to use:
- `none`: No database
- `sqlite`: SQLite database
- `postgres`: PostgreSQL database
- `mysql`: MySQL database
- `mongodb`: MongoDB database
```bash
create-better-t-stack --database postgres
```
### `--orm <type>`
ORM to use with your database:
- `none`: No ORM
- `drizzle`: Drizzle ORM (TypeScript-first)
- `prisma`: Prisma ORM (feature-rich)
- `mongoose`: Mongoose ODM (for MongoDB)
```bash
create-better-t-stack --database postgres --orm drizzle
```
### `--db-setup <setup>`
Database hosting/setup provider:
- `none`: Manual setup
- `turso`: Turso (SQLite)
- `d1`: Cloudflare D1 (SQLite)
- `neon`: Neon (PostgreSQL)
- `supabase`: Supabase (PostgreSQL)
- `prisma-postgres`: Prisma Postgres via Prisma Accelerate
- `mongodb-atlas`: MongoDB Atlas
- `docker`: Local Docker containers
```bash
create-better-t-stack --database postgres --db-setup neon
```
## Backend Options
### `--backend <framework>`
Backend framework to use:
- `none`: No backend
- `hono`: Hono (fast, lightweight)
- `express`: Express.js (popular, mature)
- `fastify`: Fastify (fast, plugin-based)
- `elysia`: Elysia (Bun-native)
- `next`: Next.js API routes
- `convex`: Convex backend
```bash
create-better-t-stack --backend hono
```
### `--runtime <runtime>`
Runtime environment:
- `none`: No specific runtime (only with `convex` or `none` backend)
- `bun`: Bun runtime
- `node`: Node.js runtime
- `workers`: Cloudflare Workers
```bash
create-better-t-stack --backend hono --runtime bun
```
### `--api <type>`
API layer type:
- `none`: No API layer
- `trpc`: tRPC (type-safe)
- `orpc`: oRPC (OpenAPI-compatible)
```bash
create-better-t-stack --api trpc
```
## Frontend Options
### `--frontend <types...>`
Frontend frameworks (can specify multiple):
**Web Frameworks:**
- `tanstack-router`: React with TanStack Router
- `react-router`: React with React Router
- `tanstack-start`: React with TanStack Start (SSR)
- `next`: Next.js
- `nuxt`: Nuxt (Vue)
- `svelte`: SvelteKit
- `solid`: SolidJS
**Native Frameworks:**
- `native-nativewind`: React Native with NativeWind
- `native-unistyles`: React Native with Unistyles
**No Frontend:**
- `none`: Backend-only project
```bash
# Single web frontend
create-better-t-stack --frontend tanstack-router
# Web + native frontend
create-better-t-stack --frontend next native-nativewind
# Backend-only
create-better-t-stack --frontend none
```
## Authentication
### `--auth / --no-auth`
Include or exclude authentication setup using Better-Auth.
```bash
create-better-t-stack --auth
create-better-t-stack --no-auth
```
## Addons
### `--addons <types...>`
Additional features to include:
- `none`: No addons
- `pwa`: Progressive Web App support
- `tauri`: Desktop app support
- `starlight`: Starlight documentation site
- `fumadocs`: Fumadocs documentation site
- `biome`: Biome linting and formatting
- `husky`: Git hooks with Husky
- `turborepo`: Turborepo monorepo setup
- `ultracite`: Ultracite configuration
- `oxlint`: Oxlint fast linting
- `vibe-rules`: Vibe Rules configuration
```bash
create-better-t-stack --addons pwa biome husky
```
## Examples
### `--examples <types...>`
Example implementations to include:
- `none`: No examples
- `todo`: Todo app example
- `ai`: AI chat interface example
```bash
create-better-t-stack --examples todo ai
```
## Deployment
### `--web-deploy <setup>`
Web deployment configuration:
- `none`: No deployment setup
- `workers`: Cloudflare Workers deployment
```bash
create-better-t-stack --web-deploy workers
```
## Option Validation
The CLI validates option combinations and will show errors for incompatible selections. See the [Compatibility](/docs/cli/compatibility) page for detailed rules.
## Examples
### Full Configuration
```bash
create-better-t-stack \
--database postgres \
--orm drizzle \
--backend hono \
--runtime bun \
--frontend tanstack-router \
--api trpc \
--auth \
--addons pwa biome \
--examples todo \
--package-manager bun \
--install
```
### Minimal Setup
```bash
create-better-t-stack \
--backend none \
--frontend tanstack-router \
--addons none \
--examples none
```

View File

@@ -1,26 +0,0 @@
---
title: sponsors
description: View project sponsors
---
## Usage
<Tabs items={['bun', 'pnpm', 'npm']}>
<Tab value="bun">
```bash
bun create better-t-stack@latest sponsors
```
</Tab>
<Tab value="pnpm">
```bash
pnpm create better-t-stack@latest sponsors
```
</Tab>
<Tab value="npm">
```bash
npx create-better-t-stack@latest sponsors
```
</Tab>
</Tabs>
This command has no flags.