|
| 1 | +# TanStack CLI |
| 2 | + |
| 3 | +## Quick Reference |
| 4 | + |
| 5 | +```bash |
| 6 | +# Create TanStack Start app |
| 7 | +npx @tanstack/cli create my-app |
| 8 | + |
| 9 | +# With add-ons |
| 10 | +npx @tanstack/cli create my-app --add-ons clerk,drizzle,tanstack-query |
| 11 | + |
| 12 | +# Add to existing project |
| 13 | +npx @tanstack/cli add clerk drizzle |
| 14 | + |
| 15 | +# List available add-ons |
| 16 | +npx @tanstack/cli create --list-add-ons |
| 17 | +``` |
| 18 | + |
| 19 | +## Monorepo Structure |
| 20 | + |
| 21 | +``` |
| 22 | +cli/ |
| 23 | +├── packages/ |
| 24 | +│ ├── cli/ # @tanstack/cli - Main CLI |
| 25 | +│ ├── create/ # @tanstack/create - Core engine + frameworks |
| 26 | +│ │ └── src/frameworks/ |
| 27 | +│ │ ├── react/ # React framework + add-ons |
| 28 | +│ │ └── solid/ # Solid framework + add-ons |
| 29 | +│ └── create-ui/ # @tanstack/create-ui - Web UI |
| 30 | +└── cli-aliases/ # Deprecated wrappers (create-tsrouter-app, etc.) |
| 31 | +``` |
| 32 | + |
| 33 | +## Development |
| 34 | + |
| 35 | +```bash |
| 36 | +pnpm install && pnpm build # Setup |
| 37 | +pnpm dev # Watch mode |
| 38 | + |
| 39 | +# Test from peer directory (not inside monorepo) |
| 40 | +node ../cli/packages/cli/dist/index.js create my-app |
| 41 | +``` |
| 42 | + |
| 43 | +## Key Terminology |
| 44 | + |
| 45 | +| Term | Definition | CLI Flag | |
| 46 | +| --------- | ---------------------------------------- | ------------- | |
| 47 | +| Add-on | Plugin that extends apps (auth, DB, etc) | `--add-ons` | |
| 48 | +| Starter | Reusable preset of add-ons (config only) | `--starter` | |
| 49 | +| Framework | React or Solid | `--framework` | |
| 50 | + |
| 51 | +## CLI Commands |
| 52 | + |
| 53 | +| Command | Description | |
| 54 | +| ------------------------------- | ------------------------- | |
| 55 | +| `tanstack create [name]` | Create TanStack Start app | |
| 56 | +| `tanstack add [add-ons]` | Add to existing project | |
| 57 | +| `tanstack add-on init/compile` | Create custom add-on | |
| 58 | +| `tanstack starter init/compile` | Create custom starter | |
| 59 | +| `tanstack mcp [--sse]` | Start MCP server | |
| 60 | +| `tanstack pin-versions` | Pin TanStack packages | |
| 61 | + |
| 62 | +## Create Options |
| 63 | + |
| 64 | +| Flag | Description | |
| 65 | +| -------------------- | ------------------------------------------------------- | |
| 66 | +| `--add-ons <ids>` | Comma-separated add-on IDs | |
| 67 | +| `--framework <name>` | React or Solid | |
| 68 | +| `--toolchain <id>` | Toolchain (use `--list-add-ons` to see options) | |
| 69 | +| `--deployment <id>` | Deployment target (use `--list-add-ons` to see options) | |
| 70 | +| `--starter <url>` | Use starter preset | |
| 71 | +| `--no-git` | Skip git init | |
| 72 | +| `--no-install` | Skip npm install | |
| 73 | +| `-y` | Accept defaults | |
| 74 | +| `-f, --force` | Overwrite existing | |
| 75 | +| `--ui` | Launch visual builder | |
| 76 | + |
| 77 | +## EJS Template Variables |
| 78 | + |
| 79 | +| Variable | Type | Description | |
| 80 | +| ---------------- | ------- | ---------------------------------------- | |
| 81 | +| `projectName` | string | Project name | |
| 82 | +| `typescript` | boolean | Always true (TanStack Start requires TS) | |
| 83 | +| `tailwind` | boolean | Always true (Tailwind always enabled) | |
| 84 | +| `fileRouter` | boolean | Always true | |
| 85 | +| `addOnEnabled` | object | `{ [id]: boolean }` | |
| 86 | +| `addOnOption` | object | `{ [id]: options }` | |
| 87 | +| `packageManager` | string | npm/pnpm/yarn/bun/deno | |
| 88 | +| `js` | string | Always `ts` | |
| 89 | +| `jsx` | string | Always `tsx` | |
| 90 | + |
| 91 | +## Testing Add-ons Locally |
| 92 | + |
| 93 | +```bash |
| 94 | +# Serve add-on |
| 95 | +npx serve .add-on -l 9080 |
| 96 | + |
| 97 | +# Use in create |
| 98 | +node packages/cli/dist/index.js create test --add-ons http://localhost:9080/info.json |
| 99 | +``` |
| 100 | + |
| 101 | +## MCP Server Config |
| 102 | + |
| 103 | +```json |
| 104 | +{ |
| 105 | + "mcpServers": { |
| 106 | + "tanstack": { |
| 107 | + "command": "npx", |
| 108 | + "args": ["@tanstack/cli", "mcp"] |
| 109 | + } |
| 110 | + } |
| 111 | +} |
| 112 | +``` |
| 113 | + |
| 114 | +## Key Files |
| 115 | + |
| 116 | +| File | Purpose | |
| 117 | +| --------------------------------- | ------------------------- | |
| 118 | +| `packages/cli/src/cli.ts` | CLI command definitions | |
| 119 | +| `packages/create/src/frameworks/` | Framework implementations | |
| 120 | +| `packages/create/src/app-*.ts` | App creation logic | |
| 121 | +| `.tanstack.json` | Generated project config | |
0 commit comments