@flight-framework/cli 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +544 -544
  3. package/dist/bin.js +975 -947
  4. package/dist/bin.js.map +1 -1
  5. package/dist/index.js +975 -947
  6. package/dist/index.js.map +1 -1
  7. package/package.json +2 -2
  8. package/templates/angular/index.html +13 -13
  9. package/templates/angular/package.json.template +25 -25
  10. package/templates/angular/src/app.component.ts +13 -13
  11. package/templates/angular/src/main.server.ts +11 -11
  12. package/templates/angular/src/main.ts +4 -4
  13. package/templates/angular/tsconfig.json +16 -16
  14. package/templates/base/README.md.template +26 -26
  15. package/templates/base/_gitignore +25 -25
  16. package/templates/base/flight.config.ts.template +15 -15
  17. package/templates/base/styles/global.css +58 -58
  18. package/templates/htmx/index.html +18 -18
  19. package/templates/htmx/package.json.template +18 -18
  20. package/templates/htmx/vite.config.ts +6 -6
  21. package/templates/lit/index.html +14 -14
  22. package/templates/lit/package.json.template +21 -21
  23. package/templates/lit/src/app-root.ts +18 -18
  24. package/templates/lit/src/entry-client.ts +5 -5
  25. package/templates/lit/src/entry-server.ts +9 -9
  26. package/templates/lit/tsconfig.json +18 -18
  27. package/templates/lit/vite.config.ts +6 -6
  28. package/templates/preact/index.html +14 -14
  29. package/templates/preact/package.json.template +22 -22
  30. package/templates/preact/src/App.tsx +8 -8
  31. package/templates/preact/src/entry-client.tsx +11 -11
  32. package/templates/preact/src/entry-server.tsx +6 -6
  33. package/templates/preact/tsconfig.json +18 -18
  34. package/templates/preact/vite.config.ts +8 -8
  35. package/templates/qwik/index.html +14 -14
  36. package/templates/qwik/package.json.template +20 -20
  37. package/templates/qwik/src/App.tsx +10 -10
  38. package/templates/qwik/src/entry-client.tsx +4 -4
  39. package/templates/qwik/src/entry-server.tsx +9 -9
  40. package/templates/qwik/tsconfig.json +18 -18
  41. package/templates/qwik/vite.config.ts +8 -8
  42. package/templates/react/index.html +13 -13
  43. package/templates/react/package.json.template +24 -24
  44. package/templates/react/src/App.tsx +13 -13
  45. package/templates/react/src/context/RouterContext.tsx +63 -63
  46. package/templates/react/src/entry-client.tsx +19 -19
  47. package/templates/react/src/entry-server.tsx +17 -17
  48. package/templates/react/tsconfig.json +19 -19
  49. package/templates/react/vite.config.ts +12 -12
  50. package/templates/solid/index.html +14 -14
  51. package/templates/solid/package.json.template +21 -21
  52. package/templates/solid/src/App.tsx +8 -8
  53. package/templates/solid/src/entry-client.tsx +11 -11
  54. package/templates/solid/src/entry-server.tsx +6 -6
  55. package/templates/solid/tsconfig.json +18 -18
  56. package/templates/solid/vite.config.ts +8 -8
  57. package/templates/svelte/index.html +14 -14
  58. package/templates/svelte/package.json.template +21 -21
  59. package/templates/svelte/src/App.svelte +4 -4
  60. package/templates/svelte/src/entry-client.ts +7 -7
  61. package/templates/svelte/src/entry-server.ts +7 -7
  62. package/templates/svelte/tsconfig.json +17 -17
  63. package/templates/svelte/vite.config.ts +8 -8
  64. package/templates/use-cases/api/README.md +41 -41
  65. package/templates/use-cases/api/package.json.template +14 -14
  66. package/templates/use-cases/api/src/routes/api/health.get.ts.template +3 -3
  67. package/templates/use-cases/blog/README.md +47 -47
  68. package/templates/use-cases/blog/flight.config.ts.template +11 -11
  69. package/templates/use-cases/blog/package.json.template +15 -15
  70. package/templates/use-cases/blog/src/routes/blog/[slug].page.tsx.template +23 -23
  71. package/templates/use-cases/blog/src/routes/index.page.tsx.template +9 -9
  72. package/templates/use-cases/docs/README.md +49 -49
  73. package/templates/use-cases/docs/package.json.template +15 -15
  74. package/templates/use-cases/docs/src/content/index.md.template +16 -16
  75. package/templates/use-cases/ecommerce/README.md +32 -32
  76. package/templates/use-cases/ecommerce/package.json.template +16 -16
  77. package/templates/use-cases/ecommerce/src/routes/index.page.tsx.template +9 -9
  78. package/templates/use-cases/saas/README.md +34 -34
  79. package/templates/use-cases/saas/package.json.template +15 -15
  80. package/templates/use-cases/saas/src/routes/index.page.tsx.template +9 -9
  81. package/templates/vanilla/index.html +14 -14
  82. package/templates/vanilla/package.json.template +19 -19
  83. package/templates/vanilla/src/main.ts +10 -10
  84. package/templates/vanilla/tsconfig.json +16 -16
  85. package/templates/vanilla/vite.config.ts +6 -6
  86. package/templates/vue/index.html +14 -14
  87. package/templates/vue/package.json.template +21 -21
  88. package/templates/vue/src/App.vue +6 -6
  89. package/templates/vue/src/entry-client.ts +12 -12
  90. package/templates/vue/src/entry-server.ts +8 -8
  91. package/templates/vue/tsconfig.json +17 -17
  92. package/templates/vue/vite.config.ts +8 -8
package/README.md CHANGED
@@ -1,544 +1,544 @@
1
- # @flight-framework/cli
2
-
3
- The command-line interface for Flight Framework. Create, develop, build, and deploy full-stack applications with a single tool.
4
-
5
- ## Table of Contents
6
-
7
- - [Installation](#installation)
8
- - [Creating a Project](#creating-a-project)
9
- - [Development](#development)
10
- - [Building for Production](#building-for-production)
11
- - [Running in Production](#running-in-production)
12
- - [Generate Commands](#generate-commands)
13
- - [Configuration](#configuration)
14
- - [Environment Variables](#environment-variables)
15
- - [All Commands Reference](#all-commands-reference)
16
- - [Troubleshooting](#troubleshooting)
17
- - [License](#license)
18
-
19
- ---
20
-
21
- ## Installation
22
-
23
- ### Global Installation (Recommended)
24
-
25
- ```bash
26
- npm install -g @flight-framework/cli
27
- ```
28
-
29
- After installation, the `flight` command is available globally:
30
-
31
- ```bash
32
- flight --version
33
- flight --help
34
- ```
35
-
36
- ### Using npx (No Installation)
37
-
38
- Run commands without installing:
39
-
40
- ```bash
41
- npx @flight-framework/cli create my-app
42
- npx @flight-framework/cli dev
43
- ```
44
-
45
- ### Using pnpm or yarn
46
-
47
- ```bash
48
- pnpm add -g @flight-framework/cli
49
- # or
50
- yarn global add @flight-framework/cli
51
- ```
52
-
53
- ---
54
-
55
- ## Creating a Project
56
-
57
- ### Interactive Mode
58
-
59
- Run `create` without arguments for the interactive wizard:
60
-
61
- ```bash
62
- flight create
63
- ```
64
-
65
- The wizard guides you through:
66
- 1. Project name
67
- 2. UI framework selection
68
- 3. TypeScript or JavaScript
69
- 4. Additional features (forms, auth, i18n, etc.)
70
-
71
- ### Quick Start
72
-
73
- Create a project with defaults (React + TypeScript):
74
-
75
- ```bash
76
- flight create my-app
77
- cd my-app
78
- npm install
79
- flight dev
80
- ```
81
-
82
- ### With Options
83
-
84
- Specify options to skip prompts:
85
-
86
- ```bash
87
- # React with TypeScript (default)
88
- flight create my-app
89
-
90
- # Vue with TypeScript
91
- flight create my-app --ui vue
92
-
93
- # Svelte with JavaScript
94
- flight create my-app --ui svelte --no-typescript
95
-
96
- # Solid with all features
97
- flight create my-app --ui solid --features forms,auth,i18n
98
- ```
99
-
100
- ### Available UI Frameworks
101
-
102
- | Framework | Option | Description |
103
- |-----------|--------|-------------|
104
- | React | `--ui react` | Default. Best ecosystem support |
105
- | Vue | `--ui vue` | Composition API with SFC support |
106
- | Svelte | `--ui svelte` | Compiler-based, minimal runtime |
107
- | Solid | `--ui solid` | Fine-grained reactivity |
108
- | Preact | `--ui preact` | Lightweight React alternative |
109
- | Qwik | `--ui qwik` | Resumability-first |
110
- | Lit | `--ui lit` | Web Components |
111
- | HTMX | `--ui htmx` | HTML-driven interactivity |
112
-
113
- ### Create Options
114
-
115
- | Option | Description |
116
- |--------|-------------|
117
- | `--ui <framework>` | UI framework to use |
118
- | `--typescript` | Use TypeScript (default) |
119
- | `--no-typescript` | Use JavaScript |
120
- | `--features <list>` | Comma-separated features: forms, auth, i18n, db |
121
- | `--package-manager <pm>` | npm, pnpm, yarn, or bun |
122
- | `--git` | Initialize git repository (default: true) |
123
- | `--no-git` | Skip git initialization |
124
- | `--install` | Install dependencies (default: true) |
125
- | `--no-install` | Skip dependency installation |
126
- | `--raw` | Create raw project (100% Web Standards, zero dependencies) |
127
- | `--empty` | Create empty project (just package.json) |
128
- | `--minimal` | Create minimal project (single server file) |
129
-
130
- ### Toolbox Mode (Zero Lock-in)
131
-
132
- Start with the minimum and add what you need:
133
-
134
- ```bash
135
- # Raw project - 100% Web Standards, ZERO dependencies
136
- # Works on Bun, Deno, Node 22+, Cloudflare Workers
137
- flight create my-app --raw
138
-
139
- # Empty project - just package.json
140
- flight create my-app --empty
141
-
142
- # Minimal project - single server file with Flight
143
- flight create my-app --minimal
144
-
145
- # Then add packages as needed
146
- cd my-app
147
- flight add http
148
- flight add db
149
- flight add cache
150
- ```
151
-
152
- The `--raw` mode generates code with **zero Flight dependencies**. You can run it on any runtime and add Flight packages later if you want.
153
-
154
- ---
155
-
156
- ## Adding Packages
157
-
158
- Add Flight packages to an existing project:
159
-
160
- ```bash
161
- flight add [package]
162
- ```
163
-
164
- ### Available Packages
165
-
166
- | Package | Description |
167
- |---------|-------------|
168
- | `http` | HTTP server with routing and middleware |
169
- | `core` | File-based routing and configuration |
170
- | `db` | Database abstraction layer |
171
- | `cache` | Caching with multiple adapters |
172
- | `auth` | Authentication adapters |
173
- | `forms` | Type-safe form handling |
174
- | `i18n` | Internationalization |
175
- | `seo` | SEO utilities |
176
- | `image` | Image optimization |
177
- | `email` | Email sending |
178
- | `realtime` | WebSocket and real-time features |
179
- | `helpers` | Optional helper utilities |
180
-
181
- ### Examples
182
-
183
- ```bash
184
- # Add HTTP server
185
- flight add http
186
-
187
- # Add database support
188
- flight add db
189
-
190
- # Add authentication
191
- flight add auth
192
-
193
- # See all packages
194
- flight add
195
- ```
196
-
197
- ---
198
-
199
- ## Development
200
-
201
- Start the development server with hot module replacement:
202
-
203
- ```bash
204
- flight dev
205
- ```
206
-
207
- The dev server includes:
208
- - Hot Module Replacement (HMR)
209
- - Server-Side Rendering (if enabled)
210
- - API routes with hot reload
211
- - TypeScript type checking
212
- - Error overlay with source maps
213
-
214
- ### Dev Options
215
-
216
- | Option | Default | Description |
217
- |--------|---------|-------------|
218
- | `-p, --port <number>` | `5173` | Port number |
219
- | `-h, --host <host>` | `localhost` | Host to bind |
220
- | `--open` | `false` | Open browser automatically |
221
- | `--https` | `false` | Enable HTTPS with self-signed cert |
222
- | `--ssr` | from config | Enable/disable SSR |
223
- | `--no-ssr` | - | Disable SSR for this session |
224
- | `--force` | `false` | Force re-optimization of dependencies |
225
-
226
- ### Examples
227
-
228
- ```bash
229
- # Start on port 3000
230
- flight dev -p 3000
231
-
232
- # Bind to all interfaces (for network access)
233
- flight dev --host 0.0.0.0
234
-
235
- # Open browser and enable HTTPS
236
- flight dev --open --https
237
-
238
- # Disable SSR temporarily
239
- flight dev --no-ssr
240
- ```
241
-
242
- ---
243
-
244
- ## Building for Production
245
-
246
- Build optimized bundles for production:
247
-
248
- ```bash
249
- flight build
250
- ```
251
-
252
- The build process:
253
- 1. Type checks the project
254
- 2. Bundles client and server code
255
- 3. Optimizes assets (minification, tree-shaking)
256
- 4. Generates static pages (if configured)
257
- 5. Creates deployment artifacts
258
-
259
- ### Build Options
260
-
261
- | Option | Default | Description |
262
- |--------|---------|-------------|
263
- | `--target <adapter>` | from config | Deployment target |
264
- | `--analyze` | `false` | Generate bundle analysis |
265
- | `--sourcemap` | `false` | Include source maps |
266
- | `--no-minify` | - | Skip minification |
267
-
268
- ### Deployment Targets
269
-
270
- ```bash
271
- # Node.js server (default)
272
- flight build --target node
273
-
274
- # Cloudflare Workers
275
- flight build --target cloudflare
276
-
277
- # Vercel
278
- flight build --target vercel
279
-
280
- # Netlify
281
- flight build --target netlify
282
-
283
- # Static site
284
- flight build --target static
285
-
286
- # Docker
287
- flight build --target docker
288
- ```
289
-
290
- ### Build Output
291
-
292
- ```
293
- dist/
294
- client/ # Browser bundles
295
- assets/
296
- index.html
297
- server/ # Server code
298
- index.js
299
- static/ # Pre-rendered pages
300
- ```
301
-
302
- ---
303
-
304
- ## Running in Production
305
-
306
- Start the production server:
307
-
308
- ```bash
309
- flight start
310
- ```
311
-
312
- This runs the optimized build with:
313
- - Compression enabled
314
- - Static asset caching
315
- - Production error handling
316
- - Health check endpoint at `/_health`
317
-
318
- ### Start Options
319
-
320
- | Option | Default | Description |
321
- |--------|---------|-------------|
322
- | `-p, --port <number>` | `3000` | Port number |
323
- | `-h, --host <host>` | `0.0.0.0` | Host to bind |
324
- | `--cluster` | `false` | Enable cluster mode |
325
- | `--workers <number>` | CPU cores | Number of workers |
326
-
327
- ### Examples
328
-
329
- ```bash
330
- # Start on port 8080
331
- flight start -p 8080
332
-
333
- # Enable cluster mode for multi-core
334
- flight start --cluster --workers 4
335
- ```
336
-
337
- ---
338
-
339
- ## Generate Commands
340
-
341
- Scaffold new files with correct structure:
342
-
343
- ```bash
344
- flight generate <type> <name>
345
- # or shorthand
346
- flight g <type> <name>
347
- ```
348
-
349
- ### Available Generators
350
-
351
- | Type | Alias | Description |
352
- |------|-------|-------------|
353
- | `page` | `p` | New page component |
354
- | `api` | `a` | API route handler |
355
- | `component` | `c` | UI component |
356
- | `action` | `act` | Server action |
357
- | `middleware` | `mw` | Middleware function |
358
- | `layout` | `l` | Layout component |
359
-
360
- ### Examples
361
-
362
- ```bash
363
- # Generate a page at /dashboard
364
- flight g page dashboard
365
-
366
- # Generate an API route at /api/users
367
- flight g api users
368
-
369
- # Generate a reusable component
370
- flight g component Button
371
-
372
- # Generate a server action
373
- flight g action submitForm
374
-
375
- # Generate middleware
376
- flight g middleware auth
377
- ```
378
-
379
- ### Generated Files
380
-
381
- ```bash
382
- flight g page dashboard
383
- # Creates: src/routes/dashboard.page.tsx
384
-
385
- flight g api users
386
- # Creates: src/routes/api/users.get.ts
387
- # src/routes/api/users.post.ts
388
-
389
- flight g component Button
390
- # Creates: src/components/Button.tsx
391
- # src/components/Button.css
392
- ```
393
-
394
- ---
395
-
396
- ## Configuration
397
-
398
- Flight uses `flight.config.ts` (or `.js`) in the project root:
399
-
400
- ```typescript
401
- // flight.config.ts
402
- import { defineConfig } from '@flight-framework/core';
403
-
404
- export default defineConfig({
405
- // Server configuration
406
- server: {
407
- port: 3000,
408
- host: 'localhost',
409
- },
410
-
411
- // Rendering options
412
- render: {
413
- defaultMode: 'ssr', // 'ssr' | 'ssg' | 'spa'
414
- streaming: true,
415
- },
416
-
417
- // Build options
418
- build: {
419
- outDir: 'dist',
420
- target: 'node', // Deployment target
421
- minify: true,
422
- sourcemap: false,
423
- },
424
-
425
- // Routes configuration
426
- routes: {
427
- directory: 'src/routes',
428
- },
429
- });
430
- ```
431
-
432
- ---
433
-
434
- ## Environment Variables
435
-
436
- Flight automatically loads environment variables:
437
-
438
- | File | Environment | Priority |
439
- |------|-------------|---------|
440
- | `.env` | All | 1 (lowest) |
441
- | `.env.local` | All | 2 |
442
- | `.env.development` | Development | 3 |
443
- | `.env.production` | Production | 3 |
444
- | `.env.development.local` | Development | 4 (highest) |
445
- | `.env.production.local` | Production | 4 (highest) |
446
-
447
- ### Accessing Variables
448
-
449
- ```typescript
450
- // Server-side (full access)
451
- const apiKey = process.env.API_KEY;
452
-
453
- // Client-side (only PUBLIC_ prefix)
454
- const publicUrl = process.env.PUBLIC_API_URL;
455
- ```
456
-
457
- Only variables prefixed with `PUBLIC_` are exposed to the browser.
458
-
459
- ---
460
-
461
- ## All Commands Reference
462
-
463
- | Command | Description |
464
- |---------|-------------|
465
- | `flight create [name]` | Create new project |
466
- | `flight dev` | Start development server |
467
- | `flight build` | Build for production |
468
- | `flight start` | Start production server |
469
- | `flight generate <type> <name>` | Generate files |
470
- | `flight typecheck` | Run TypeScript type checking |
471
- | `flight lint` | Run ESLint |
472
- | `flight test` | Run tests |
473
- | `flight preview` | Preview production build locally |
474
- | `flight upgrade` | Upgrade Flight packages |
475
- | `flight info` | Display project information |
476
-
477
- ### Global Options
478
-
479
- Available on all commands:
480
-
481
- | Option | Description |
482
- |--------|-------------|
483
- | `--help` | Show help |
484
- | `--version` | Show version |
485
- | `--config <path>` | Path to config file |
486
- | `--cwd <path>` | Working directory |
487
- | `--verbose` | Verbose output |
488
- | `--quiet` | Minimal output |
489
-
490
- ---
491
-
492
- ## Troubleshooting
493
-
494
- ### Port Already in Use
495
-
496
- ```bash
497
- # Use a different port
498
- flight dev -p 3001
499
-
500
- # Or kill the process using the port
501
- npx kill-port 5173
502
- ```
503
-
504
- ### TypeScript Errors on Start
505
-
506
- ```bash
507
- # Force rebuild of type cache
508
- flight dev --force
509
- ```
510
-
511
- ### Permission Denied (Global Install)
512
-
513
- ```bash
514
- # Fix npm permissions
515
- npm config set prefix ~/.npm-global
516
- export PATH=~/.npm-global/bin:$PATH
517
-
518
- # Or use npx instead
519
- npx @flight-framework/cli dev
520
- ```
521
-
522
- ### Slow Dev Server
523
-
524
- Check for large `node_modules` in the routes directory, or try:
525
-
526
- ```bash
527
- # Clear Vite cache
528
- rm -rf node_modules/.vite
529
- flight dev
530
- ```
531
-
532
- ### Build Fails with Memory Error
533
-
534
- Increase Node.js memory limit:
535
-
536
- ```bash
537
- NODE_OPTIONS="--max-old-space-size=8192" flight build
538
- ```
539
-
540
- ---
541
-
542
- ## License
543
-
544
- MIT
1
+ # @flight-framework/cli
2
+
3
+ The command-line interface for Flight Framework. Create, develop, build, and deploy full-stack applications with a single tool.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Installation](#installation)
8
+ - [Creating a Project](#creating-a-project)
9
+ - [Development](#development)
10
+ - [Building for Production](#building-for-production)
11
+ - [Running in Production](#running-in-production)
12
+ - [Generate Commands](#generate-commands)
13
+ - [Configuration](#configuration)
14
+ - [Environment Variables](#environment-variables)
15
+ - [All Commands Reference](#all-commands-reference)
16
+ - [Troubleshooting](#troubleshooting)
17
+ - [License](#license)
18
+
19
+ ---
20
+
21
+ ## Installation
22
+
23
+ ### Global Installation (Recommended)
24
+
25
+ ```bash
26
+ npm install -g @flight-framework/cli
27
+ ```
28
+
29
+ After installation, the `flight` command is available globally:
30
+
31
+ ```bash
32
+ flight --version
33
+ flight --help
34
+ ```
35
+
36
+ ### Using npx (No Installation)
37
+
38
+ Run commands without installing:
39
+
40
+ ```bash
41
+ npx @flight-framework/cli create my-app
42
+ npx @flight-framework/cli dev
43
+ ```
44
+
45
+ ### Using pnpm or yarn
46
+
47
+ ```bash
48
+ pnpm add -g @flight-framework/cli
49
+ # or
50
+ yarn global add @flight-framework/cli
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Creating a Project
56
+
57
+ ### Interactive Mode
58
+
59
+ Run `create` without arguments for the interactive wizard:
60
+
61
+ ```bash
62
+ flight create
63
+ ```
64
+
65
+ The wizard guides you through:
66
+ 1. Project name
67
+ 2. UI framework selection
68
+ 3. TypeScript or JavaScript
69
+ 4. Additional features (forms, auth, i18n, etc.)
70
+
71
+ ### Quick Start
72
+
73
+ Create a project with defaults (React + TypeScript):
74
+
75
+ ```bash
76
+ flight create my-app
77
+ cd my-app
78
+ npm install
79
+ flight dev
80
+ ```
81
+
82
+ ### With Options
83
+
84
+ Specify options to skip prompts:
85
+
86
+ ```bash
87
+ # React with TypeScript (default)
88
+ flight create my-app
89
+
90
+ # Vue with TypeScript
91
+ flight create my-app --ui vue
92
+
93
+ # Svelte with JavaScript
94
+ flight create my-app --ui svelte --no-typescript
95
+
96
+ # Solid with all features
97
+ flight create my-app --ui solid --features forms,auth,i18n
98
+ ```
99
+
100
+ ### Available UI Frameworks
101
+
102
+ | Framework | Option | Description |
103
+ |-----------|--------|-------------|
104
+ | React | `--ui react` | Default. Best ecosystem support |
105
+ | Vue | `--ui vue` | Composition API with SFC support |
106
+ | Svelte | `--ui svelte` | Compiler-based, minimal runtime |
107
+ | Solid | `--ui solid` | Fine-grained reactivity |
108
+ | Preact | `--ui preact` | Lightweight React alternative |
109
+ | Qwik | `--ui qwik` | Resumability-first |
110
+ | Lit | `--ui lit` | Web Components |
111
+ | HTMX | `--ui htmx` | HTML-driven interactivity |
112
+
113
+ ### Create Options
114
+
115
+ | Option | Description |
116
+ |--------|-------------|
117
+ | `--ui <framework>` | UI framework to use |
118
+ | `--typescript` | Use TypeScript (default) |
119
+ | `--no-typescript` | Use JavaScript |
120
+ | `--features <list>` | Comma-separated features: forms, auth, i18n, db |
121
+ | `--package-manager <pm>` | npm, pnpm, yarn, or bun |
122
+ | `--git` | Initialize git repository (default: true) |
123
+ | `--no-git` | Skip git initialization |
124
+ | `--install` | Install dependencies (default: true) |
125
+ | `--no-install` | Skip dependency installation |
126
+ | `--raw` | Create raw project (100% Web Standards, zero dependencies) |
127
+ | `--empty` | Create empty project (just package.json) |
128
+ | `--minimal` | Create minimal project (single server file) |
129
+
130
+ ### Toolbox Mode (Zero Lock-in)
131
+
132
+ Start with the minimum and add what you need:
133
+
134
+ ```bash
135
+ # Raw project - 100% Web Standards, ZERO dependencies
136
+ # Works on Bun, Deno, Node 22+, Cloudflare Workers
137
+ flight create my-app --raw
138
+
139
+ # Empty project - just package.json
140
+ flight create my-app --empty
141
+
142
+ # Minimal project - single server file with Flight
143
+ flight create my-app --minimal
144
+
145
+ # Then add packages as needed
146
+ cd my-app
147
+ flight add http
148
+ flight add db
149
+ flight add cache
150
+ ```
151
+
152
+ The `--raw` mode generates code with **zero Flight dependencies**. You can run it on any runtime and add Flight packages later if you want.
153
+
154
+ ---
155
+
156
+ ## Adding Packages
157
+
158
+ Add Flight packages to an existing project:
159
+
160
+ ```bash
161
+ flight add [package]
162
+ ```
163
+
164
+ ### Available Packages
165
+
166
+ | Package | Description |
167
+ |---------|-------------|
168
+ | `http` | HTTP server with routing and middleware |
169
+ | `core` | File-based routing and configuration |
170
+ | `db` | Database abstraction layer |
171
+ | `cache` | Caching with multiple adapters |
172
+ | `auth` | Authentication adapters |
173
+ | `forms` | Type-safe form handling |
174
+ | `i18n` | Internationalization |
175
+ | `seo` | SEO utilities |
176
+ | `image` | Image optimization |
177
+ | `email` | Email sending |
178
+ | `realtime` | WebSocket and real-time features |
179
+ | `helpers` | Optional helper utilities |
180
+
181
+ ### Examples
182
+
183
+ ```bash
184
+ # Add HTTP server
185
+ flight add http
186
+
187
+ # Add database support
188
+ flight add db
189
+
190
+ # Add authentication
191
+ flight add auth
192
+
193
+ # See all packages
194
+ flight add
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Development
200
+
201
+ Start the development server with hot module replacement:
202
+
203
+ ```bash
204
+ flight dev
205
+ ```
206
+
207
+ The dev server includes:
208
+ - Hot Module Replacement (HMR)
209
+ - Server-Side Rendering (if enabled)
210
+ - API routes with hot reload
211
+ - TypeScript type checking
212
+ - Error overlay with source maps
213
+
214
+ ### Dev Options
215
+
216
+ | Option | Default | Description |
217
+ |--------|---------|-------------|
218
+ | `-p, --port <number>` | `5173` | Port number |
219
+ | `-h, --host <host>` | `localhost` | Host to bind |
220
+ | `--open` | `false` | Open browser automatically |
221
+ | `--https` | `false` | Enable HTTPS with self-signed cert |
222
+ | `--ssr` | from config | Enable/disable SSR |
223
+ | `--no-ssr` | - | Disable SSR for this session |
224
+ | `--force` | `false` | Force re-optimization of dependencies |
225
+
226
+ ### Examples
227
+
228
+ ```bash
229
+ # Start on port 3000
230
+ flight dev -p 3000
231
+
232
+ # Bind to all interfaces (for network access)
233
+ flight dev --host 0.0.0.0
234
+
235
+ # Open browser and enable HTTPS
236
+ flight dev --open --https
237
+
238
+ # Disable SSR temporarily
239
+ flight dev --no-ssr
240
+ ```
241
+
242
+ ---
243
+
244
+ ## Building for Production
245
+
246
+ Build optimized bundles for production:
247
+
248
+ ```bash
249
+ flight build
250
+ ```
251
+
252
+ The build process:
253
+ 1. Type checks the project
254
+ 2. Bundles client and server code
255
+ 3. Optimizes assets (minification, tree-shaking)
256
+ 4. Generates static pages (if configured)
257
+ 5. Creates deployment artifacts
258
+
259
+ ### Build Options
260
+
261
+ | Option | Default | Description |
262
+ |--------|---------|-------------|
263
+ | `--target <adapter>` | from config | Deployment target |
264
+ | `--analyze` | `false` | Generate bundle analysis |
265
+ | `--sourcemap` | `false` | Include source maps |
266
+ | `--no-minify` | - | Skip minification |
267
+
268
+ ### Deployment Targets
269
+
270
+ ```bash
271
+ # Node.js server (default)
272
+ flight build --target node
273
+
274
+ # Cloudflare Workers
275
+ flight build --target cloudflare
276
+
277
+ # Vercel
278
+ flight build --target vercel
279
+
280
+ # Netlify
281
+ flight build --target netlify
282
+
283
+ # Static site
284
+ flight build --target static
285
+
286
+ # Docker
287
+ flight build --target docker
288
+ ```
289
+
290
+ ### Build Output
291
+
292
+ ```
293
+ dist/
294
+ client/ # Browser bundles
295
+ assets/
296
+ index.html
297
+ server/ # Server code
298
+ index.js
299
+ static/ # Pre-rendered pages
300
+ ```
301
+
302
+ ---
303
+
304
+ ## Running in Production
305
+
306
+ Start the production server:
307
+
308
+ ```bash
309
+ flight start
310
+ ```
311
+
312
+ This runs the optimized build with:
313
+ - Compression enabled
314
+ - Static asset caching
315
+ - Production error handling
316
+ - Health check endpoint at `/_health`
317
+
318
+ ### Start Options
319
+
320
+ | Option | Default | Description |
321
+ |--------|---------|-------------|
322
+ | `-p, --port <number>` | `3000` | Port number |
323
+ | `-h, --host <host>` | `0.0.0.0` | Host to bind |
324
+ | `--cluster` | `false` | Enable cluster mode |
325
+ | `--workers <number>` | CPU cores | Number of workers |
326
+
327
+ ### Examples
328
+
329
+ ```bash
330
+ # Start on port 8080
331
+ flight start -p 8080
332
+
333
+ # Enable cluster mode for multi-core
334
+ flight start --cluster --workers 4
335
+ ```
336
+
337
+ ---
338
+
339
+ ## Generate Commands
340
+
341
+ Scaffold new files with correct structure:
342
+
343
+ ```bash
344
+ flight generate <type> <name>
345
+ # or shorthand
346
+ flight g <type> <name>
347
+ ```
348
+
349
+ ### Available Generators
350
+
351
+ | Type | Alias | Description |
352
+ |------|-------|-------------|
353
+ | `page` | `p` | New page component |
354
+ | `api` | `a` | API route handler |
355
+ | `component` | `c` | UI component |
356
+ | `action` | `act` | Server action |
357
+ | `middleware` | `mw` | Middleware function |
358
+ | `layout` | `l` | Layout component |
359
+
360
+ ### Examples
361
+
362
+ ```bash
363
+ # Generate a page at /dashboard
364
+ flight g page dashboard
365
+
366
+ # Generate an API route at /api/users
367
+ flight g api users
368
+
369
+ # Generate a reusable component
370
+ flight g component Button
371
+
372
+ # Generate a server action
373
+ flight g action submitForm
374
+
375
+ # Generate middleware
376
+ flight g middleware auth
377
+ ```
378
+
379
+ ### Generated Files
380
+
381
+ ```bash
382
+ flight g page dashboard
383
+ # Creates: src/routes/dashboard.page.tsx
384
+
385
+ flight g api users
386
+ # Creates: src/routes/api/users.get.ts
387
+ # src/routes/api/users.post.ts
388
+
389
+ flight g component Button
390
+ # Creates: src/components/Button.tsx
391
+ # src/components/Button.css
392
+ ```
393
+
394
+ ---
395
+
396
+ ## Configuration
397
+
398
+ Flight uses `flight.config.ts` (or `.js`) in the project root:
399
+
400
+ ```typescript
401
+ // flight.config.ts
402
+ import { defineConfig } from '@flight-framework/core';
403
+
404
+ export default defineConfig({
405
+ // Server configuration
406
+ server: {
407
+ port: 3000,
408
+ host: 'localhost',
409
+ },
410
+
411
+ // Rendering options
412
+ render: {
413
+ defaultMode: 'ssr', // 'ssr' | 'ssg' | 'spa'
414
+ streaming: true,
415
+ },
416
+
417
+ // Build options
418
+ build: {
419
+ outDir: 'dist',
420
+ target: 'node', // Deployment target
421
+ minify: true,
422
+ sourcemap: false,
423
+ },
424
+
425
+ // Routes configuration
426
+ routes: {
427
+ directory: 'src/routes',
428
+ },
429
+ });
430
+ ```
431
+
432
+ ---
433
+
434
+ ## Environment Variables
435
+
436
+ Flight automatically loads environment variables:
437
+
438
+ | File | Environment | Priority |
439
+ |------|-------------|---------|
440
+ | `.env` | All | 1 (lowest) |
441
+ | `.env.local` | All | 2 |
442
+ | `.env.development` | Development | 3 |
443
+ | `.env.production` | Production | 3 |
444
+ | `.env.development.local` | Development | 4 (highest) |
445
+ | `.env.production.local` | Production | 4 (highest) |
446
+
447
+ ### Accessing Variables
448
+
449
+ ```typescript
450
+ // Server-side (full access)
451
+ const apiKey = process.env.API_KEY;
452
+
453
+ // Client-side (only PUBLIC_ prefix)
454
+ const publicUrl = process.env.PUBLIC_API_URL;
455
+ ```
456
+
457
+ Only variables prefixed with `PUBLIC_` are exposed to the browser.
458
+
459
+ ---
460
+
461
+ ## All Commands Reference
462
+
463
+ | Command | Description |
464
+ |---------|-------------|
465
+ | `flight create [name]` | Create new project |
466
+ | `flight dev` | Start development server |
467
+ | `flight build` | Build for production |
468
+ | `flight start` | Start production server |
469
+ | `flight generate <type> <name>` | Generate files |
470
+ | `flight typecheck` | Run TypeScript type checking |
471
+ | `flight lint` | Run ESLint |
472
+ | `flight test` | Run tests |
473
+ | `flight preview` | Preview production build locally |
474
+ | `flight upgrade` | Upgrade Flight packages |
475
+ | `flight info` | Display project information |
476
+
477
+ ### Global Options
478
+
479
+ Available on all commands:
480
+
481
+ | Option | Description |
482
+ |--------|-------------|
483
+ | `--help` | Show help |
484
+ | `--version` | Show version |
485
+ | `--config <path>` | Path to config file |
486
+ | `--cwd <path>` | Working directory |
487
+ | `--verbose` | Verbose output |
488
+ | `--quiet` | Minimal output |
489
+
490
+ ---
491
+
492
+ ## Troubleshooting
493
+
494
+ ### Port Already in Use
495
+
496
+ ```bash
497
+ # Use a different port
498
+ flight dev -p 3001
499
+
500
+ # Or kill the process using the port
501
+ npx kill-port 5173
502
+ ```
503
+
504
+ ### TypeScript Errors on Start
505
+
506
+ ```bash
507
+ # Force rebuild of type cache
508
+ flight dev --force
509
+ ```
510
+
511
+ ### Permission Denied (Global Install)
512
+
513
+ ```bash
514
+ # Fix npm permissions
515
+ npm config set prefix ~/.npm-global
516
+ export PATH=~/.npm-global/bin:$PATH
517
+
518
+ # Or use npx instead
519
+ npx @flight-framework/cli dev
520
+ ```
521
+
522
+ ### Slow Dev Server
523
+
524
+ Check for large `node_modules` in the routes directory, or try:
525
+
526
+ ```bash
527
+ # Clear Vite cache
528
+ rm -rf node_modules/.vite
529
+ flight dev
530
+ ```
531
+
532
+ ### Build Fails with Memory Error
533
+
534
+ Increase Node.js memory limit:
535
+
536
+ ```bash
537
+ NODE_OPTIONS="--max-old-space-size=8192" flight build
538
+ ```
539
+
540
+ ---
541
+
542
+ ## License
543
+
544
+ MIT