|
| 1 | +--- |
| 2 | +title: Compatibility Rules |
| 3 | +description: Understanding compatibility rules and restrictions between different CLI options |
| 4 | +--- |
| 5 | + |
| 6 | +## Overview |
| 7 | + |
| 8 | +The CLI validates option combinations to ensure generated projects work correctly. Here are the key compatibility rules and restrictions. |
| 9 | + |
| 10 | +## Database & ORM Compatibility |
| 11 | + |
| 12 | +### Required Combinations |
| 13 | + |
| 14 | +| Database | Compatible ORMs | Notes | |
| 15 | +|----------|----------------|-------| |
| 16 | +| `sqlite` | `drizzle`, `prisma` | Lightweight, file-based database | |
| 17 | +| `postgres` | `drizzle`, `prisma` | Advanced relational database | |
| 18 | +| `mysql` | `drizzle`, `prisma` | Traditional relational database | |
| 19 | +| `mongodb` | `mongoose`, `prisma` | Document database, requires specific ORMs | |
| 20 | +| `none` | `none` | No database setup | |
| 21 | + |
| 22 | +### Restrictions |
| 23 | + |
| 24 | +- **MongoDB + Drizzle**: ❌ Not supported - Drizzle doesn't support MongoDB |
| 25 | +- **Database without ORM**: ❌ Not supported - Database requires an ORM for code generation |
| 26 | +- **ORM without Database**: ❌ Not supported - ORM requires a database target |
| 27 | + |
| 28 | +```bash |
| 29 | +# ❌ Invalid - MongoDB with Drizzle |
| 30 | +create-better-t-stack --database mongodb --orm drizzle |
| 31 | + |
| 32 | +# ✅ Valid - MongoDB with Mongoose |
| 33 | +create-better-t-stack --database mongodb --orm mongoose |
| 34 | +``` |
| 35 | + |
| 36 | +## Backend & Runtime Compatibility |
| 37 | + |
| 38 | +### Cloudflare Workers Restrictions |
| 39 | + |
| 40 | +Cloudflare Workers has specific compatibility requirements: |
| 41 | + |
| 42 | +| Component | Requirement | Reason | |
| 43 | +|-----------|-------------|--------| |
| 44 | +| Backend | Must be `hono` | Only Hono supports Workers runtime | |
| 45 | +| ORM | Must be `drizzle` or `none` | Workers doesn't support Prisma/Mongoose | |
| 46 | +| Database | Cannot be `mongodb` | MongoDB requires Prisma/Mongoose | |
| 47 | +| Database Setup | Cannot be `docker` | Workers is serverless, no Docker support | |
| 48 | + |
| 49 | +```bash |
| 50 | +# ❌ Invalid - Workers with Express |
| 51 | +create-better-t-stack --runtime workers --backend express |
| 52 | + |
| 53 | +# ✅ Valid - Workers with Hono |
| 54 | +create-better-t-stack --runtime workers --backend hono --database sqlite --orm drizzle --db-setup d1 |
| 55 | +``` |
| 56 | + |
| 57 | +### Backend Presets |
| 58 | + |
| 59 | +#### Convex Backend |
| 60 | +When using `--backend convex`, the following options are automatically set: |
| 61 | + |
| 62 | +- `--auth false` (Convex handles auth) |
| 63 | +- `--database none` (Convex provides database) |
| 64 | +- `--orm none` (Convex provides data layer) |
| 65 | +- `--api none` (Convex provides API) |
| 66 | +- `--runtime none` (Convex manages runtime) |
| 67 | +- `--db-setup none` (Convex manages hosting) |
| 68 | +- `--examples todo` (Todo example works with Convex) |
| 69 | + |
| 70 | +#### No Backend |
| 71 | +When using `--backend none`, the following options are automatically set: |
| 72 | + |
| 73 | +- `--auth false` (No backend for auth) |
| 74 | +- `--database none` (No backend for database) |
| 75 | +- `--orm none` (No database) |
| 76 | +- `--api none` (No backend for API) |
| 77 | +- `--runtime none` (No backend to run) |
| 78 | +- `--db-setup none` (No database to host) |
| 79 | +- `--examples none` (Examples require backend) |
| 80 | + |
| 81 | +## Frontend & API Compatibility |
| 82 | + |
| 83 | +### API Framework Support |
| 84 | + |
| 85 | +| Frontend | tRPC Support | oRPC Support | Notes | |
| 86 | +|----------|-------------|-------------|-------| |
| 87 | +| `tanstack-router` | ✅ | ✅ | Full support | |
| 88 | +| `react-router` | ✅ | ✅ | Full support | |
| 89 | +| `tanstack-start` | ✅ | ✅ | Full support | |
| 90 | +| `next` | ✅ | ✅ | Full support | |
| 91 | +| `nuxt` | ❌ | ✅ | tRPC not supported | |
| 92 | +| `svelte` | ❌ | ✅ | tRPC not supported | |
| 93 | +| `solid` | ❌ | ✅ | tRPC not supported | |
| 94 | +| Native frameworks | ✅ | ✅ | Full support | |
| 95 | + |
| 96 | +```bash |
| 97 | +# ❌ Invalid - Nuxt with tRPC |
| 98 | +create-better-t-stack --frontend nuxt --api trpc |
| 99 | + |
| 100 | +# ✅ Valid - Nuxt with oRPC |
| 101 | +create-better-t-stack --frontend nuxt --api orpc |
| 102 | +``` |
| 103 | + |
| 104 | +### Frontend Restrictions |
| 105 | + |
| 106 | +- **Multiple Web Frontends**: ❌ Only one web framework allowed |
| 107 | +- **Multiple Native Frontends**: ❌ Only one native framework allowed |
| 108 | +- **Web + Native**: ✅ One web and one native framework allowed |
| 109 | + |
| 110 | +```bash |
| 111 | +# ❌ Invalid - Multiple web frontends |
| 112 | +create-better-t-stack --frontend next tanstack-router |
| 113 | + |
| 114 | +# ✅ Valid - Web + native |
| 115 | +create-better-t-stack --frontend next native-nativewind |
| 116 | +``` |
| 117 | + |
| 118 | +## Database Setup Compatibility |
| 119 | + |
| 120 | +### Provider Requirements |
| 121 | + |
| 122 | +| Setup Provider | Required Database | Notes | |
| 123 | +|---------------|------------------|-------| |
| 124 | +| `turso` | `sqlite` | Distributed SQLite | |
| 125 | +| `d1` | `sqlite` | Cloudflare D1 (requires Workers runtime) | |
| 126 | +| `neon` | `postgres` | Serverless PostgreSQL | |
| 127 | +| `supabase` | `postgres` | PostgreSQL with additional features | |
| 128 | +| `prisma-postgres` | `postgres` | Managed PostgreSQL via Prisma | |
| 129 | +| `mongodb-atlas` | `mongodb` | Managed MongoDB | |
| 130 | +| `docker` | `postgres`, `mysql`, `mongodb` | Not compatible with `sqlite` or Workers | |
| 131 | + |
| 132 | +### Special Cases |
| 133 | + |
| 134 | +#### Cloudflare D1 |
| 135 | +- Requires `--database sqlite` |
| 136 | +- Requires `--runtime workers` |
| 137 | +- Requires `--backend hono` |
| 138 | + |
| 139 | +#### Docker Setup |
| 140 | +- Cannot be used with `sqlite` (file-based database) |
| 141 | +- Cannot be used with `workers` runtime (serverless environment) |
| 142 | + |
| 143 | +## Addon Compatibility |
| 144 | + |
| 145 | +### PWA Support |
| 146 | +- Requires web frontend |
| 147 | +- Compatible frontends: `tanstack-router`, `react-router`, `next`, `solid` |
| 148 | +- Not compatible with native-only projects |
| 149 | + |
| 150 | +### Tauri (Desktop Apps) |
| 151 | +- Requires web frontend |
| 152 | +- Compatible frontends: `tanstack-router`, `react-router`, `nuxt`, `svelte`, `solid` |
| 153 | +- Cannot be combined with native frameworks |
| 154 | + |
| 155 | +### Web Deployment |
| 156 | +- `--web-deploy workers` requires a web frontend |
| 157 | +- Cannot be used with native-only projects |
| 158 | + |
| 159 | +## Authentication Requirements |
| 160 | + |
| 161 | +Authentication requires: |
| 162 | +- A backend framework (cannot be `none`) |
| 163 | +- A database (cannot be `none`) |
| 164 | +- An ORM (cannot be `none`) |
| 165 | + |
| 166 | +```bash |
| 167 | +# ❌ Invalid - Auth without database |
| 168 | +create-better-t-stack --auth --database none |
| 169 | + |
| 170 | +# ✅ Valid - Auth with full stack |
| 171 | +create-better-t-stack --auth --database postgres --orm drizzle --backend hono |
| 172 | +``` |
| 173 | + |
| 174 | +## Example Compatibility |
| 175 | + |
| 176 | +### Todo Example |
| 177 | +- Requires a database when backend is present (except Convex) |
| 178 | +- Cannot be used with `--backend none` and `--database none` |
| 179 | + |
| 180 | +### AI Example |
| 181 | +- Not compatible with `--backend elysia` |
| 182 | +- Not compatible with `--frontend solid` |
| 183 | + |
| 184 | +## Common Error Messages |
| 185 | + |
| 186 | +### "Mongoose ORM requires MongoDB database" |
| 187 | +```bash |
| 188 | +# Fix by using MongoDB |
| 189 | +create-better-t-stack --database mongodb --orm mongoose |
| 190 | +``` |
| 191 | + |
| 192 | +### "Cloudflare Workers runtime is only supported with Hono backend" |
| 193 | +```bash |
| 194 | +# Fix by using Hono |
| 195 | +create-better-t-stack --runtime workers --backend hono |
| 196 | +``` |
| 197 | + |
| 198 | +### "Cannot select multiple web frameworks" |
| 199 | +```bash |
| 200 | +# Fix by choosing one web framework |
| 201 | +create-better-t-stack --frontend tanstack-router |
| 202 | +``` |
| 203 | + |
| 204 | +### "Authentication requires a database" |
| 205 | +```bash |
| 206 | +# Fix by adding database |
| 207 | +create-better-t-stack --auth --database postgres --orm drizzle |
| 208 | +``` |
| 209 | + |
| 210 | +## Validation Strategy |
| 211 | + |
| 212 | +The CLI validates compatibility in this order: |
| 213 | + |
| 214 | +1. **Basic validation**: Required parameters, valid enum values |
| 215 | +2. **Combination validation**: Database + ORM, Backend + Runtime compatibility |
| 216 | +3. **Feature validation**: Auth requirements, addon compatibility |
| 217 | +4. **Example validation**: Example + stack compatibility |
| 218 | + |
| 219 | +Understanding these rules helps you create valid configurations and troubleshoot issues when the CLI reports compatibility errors. |
0 commit comments