create-fluxstack 1.8.1 → 1.8.3

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 (132) hide show
  1. package/.env.example +19 -0
  2. package/README.md +6 -3
  3. package/app/client/SIMPLIFICATION.md +140 -0
  4. package/app/client/frontend-only.ts +1 -1
  5. package/app/client/src/App.tsx +148 -283
  6. package/app/client/src/index.css +5 -20
  7. package/app/client/src/lib/eden-api.ts +53 -220
  8. package/app/client/src/main.tsx +2 -3
  9. package/app/server/controllers/users.controller.ts +57 -31
  10. package/app/server/index.ts +5 -2
  11. package/app/server/live/register-components.ts +18 -7
  12. package/app/server/routes/env-test.ts +53 -2
  13. package/app/server/routes/index.ts +1 -8
  14. package/app/server/routes/users.routes.ts +192 -91
  15. package/config/fluxstack.config.ts +2 -2
  16. package/config/plugins.config.ts +22 -1
  17. package/core/build/flux-plugins-generator.ts +5 -5
  18. package/core/build/live-components-generator.ts +15 -12
  19. package/core/cli/command-registry.ts +4 -14
  20. package/core/cli/commands/plugin-deps.ts +8 -8
  21. package/core/cli/generators/component.ts +3 -3
  22. package/core/cli/generators/controller.ts +4 -4
  23. package/core/cli/generators/index.ts +8 -8
  24. package/core/cli/generators/interactive.ts +4 -4
  25. package/core/cli/generators/plugin.ts +3 -3
  26. package/core/cli/generators/prompts.ts +1 -1
  27. package/core/cli/generators/route.ts +27 -11
  28. package/core/cli/generators/service.ts +5 -5
  29. package/core/cli/generators/template-engine.ts +1 -1
  30. package/core/cli/generators/types.ts +1 -1
  31. package/core/cli/index.ts +158 -193
  32. package/core/cli/plugin-discovery.ts +3 -3
  33. package/core/client/hooks/index.ts +2 -2
  34. package/core/client/hooks/state-validator.ts +1 -1
  35. package/core/client/hooks/useAuth.ts +1 -1
  36. package/core/client/hooks/useChunkedUpload.ts +1 -1
  37. package/core/client/hooks/useHybridLiveComponent.ts +1 -1
  38. package/core/client/hooks/useWebSocket.ts +1 -1
  39. package/core/config/env.ts +1 -1
  40. package/core/config/runtime-config.ts +5 -5
  41. package/core/config/schema.ts +9 -0
  42. package/core/framework/server.ts +30 -15
  43. package/core/framework/types.ts +2 -2
  44. package/core/live/ComponentRegistry.ts +1 -1
  45. package/core/plugins/built-in/live-components/commands/create-live-component.ts +1 -1
  46. package/core/plugins/built-in/live-components/index.ts +1 -1
  47. package/core/plugins/built-in/monitoring/index.ts +65 -161
  48. package/core/plugins/built-in/static/index.ts +18 -47
  49. package/core/plugins/built-in/swagger/index.ts +301 -231
  50. package/core/plugins/built-in/vite/index.ts +74 -109
  51. package/core/plugins/config.ts +2 -2
  52. package/core/plugins/dependency-manager.ts +2 -2
  53. package/core/plugins/discovery.ts +1 -1
  54. package/core/plugins/executor.ts +2 -2
  55. package/core/plugins/manager.ts +19 -4
  56. package/core/plugins/module-resolver.ts +1 -1
  57. package/core/plugins/registry.ts +3 -3
  58. package/core/plugins/types.ts +147 -5
  59. package/core/server/framework.ts +2 -2
  60. package/core/server/live/ComponentRegistry.ts +9 -26
  61. package/core/server/live/FileUploadManager.ts +1 -1
  62. package/core/server/live/auto-generated-components.ts +26 -0
  63. package/core/server/live/websocket-plugin.ts +211 -19
  64. package/core/server/middleware/errorHandling.ts +1 -1
  65. package/core/server/middleware/index.ts +4 -4
  66. package/core/server/plugins/database.ts +1 -2
  67. package/core/server/plugins/static-files-plugin.ts +259 -231
  68. package/core/server/plugins/swagger.ts +1 -1
  69. package/core/server/services/BaseService.ts +1 -1
  70. package/core/server/services/ServiceContainer.ts +1 -1
  71. package/core/server/services/index.ts +4 -4
  72. package/core/server/standalone.ts +16 -1
  73. package/core/testing/index.ts +1 -1
  74. package/core/testing/setup.ts +1 -1
  75. package/core/utils/logger/startup-banner.ts +7 -33
  76. package/core/utils/version.ts +6 -6
  77. package/create-fluxstack.ts +68 -25
  78. package/package.json +2 -2
  79. package/plugins/crypto-auth/index.ts +52 -47
  80. package/plugins/crypto-auth/server/AuthMiddleware.ts +1 -1
  81. package/plugins/crypto-auth/server/middlewares/helpers.ts +16 -1
  82. package/vitest.config.ts +11 -2
  83. package/app/client/src/App.css +0 -883
  84. package/app/client/src/components/ErrorBoundary.tsx +0 -107
  85. package/app/client/src/components/ErrorDisplay.css +0 -365
  86. package/app/client/src/components/ErrorDisplay.tsx +0 -258
  87. package/app/client/src/components/FluxStackConfig.tsx +0 -1321
  88. package/app/client/src/components/HybridLiveCounter.tsx +0 -140
  89. package/app/client/src/components/LiveClock.tsx +0 -286
  90. package/app/client/src/components/MainLayout.tsx +0 -388
  91. package/app/client/src/components/SidebarNavigation.tsx +0 -391
  92. package/app/client/src/components/StateDemo.tsx +0 -178
  93. package/app/client/src/components/SystemMonitor.tsx +0 -1044
  94. package/app/client/src/components/UserProfile.tsx +0 -809
  95. package/app/client/src/hooks/useAuth.ts +0 -39
  96. package/app/client/src/hooks/useNotifications.ts +0 -56
  97. package/app/client/src/lib/errors.ts +0 -340
  98. package/app/client/src/lib/hooks/useErrorHandler.ts +0 -258
  99. package/app/client/src/lib/index.ts +0 -45
  100. package/app/client/src/pages/ApiDocs.tsx +0 -182
  101. package/app/client/src/pages/CryptoAuthPage.tsx +0 -394
  102. package/app/client/src/pages/Demo.tsx +0 -174
  103. package/app/client/src/pages/HybridLive.tsx +0 -263
  104. package/app/client/src/pages/Overview.tsx +0 -155
  105. package/app/client/src/store/README.md +0 -43
  106. package/app/client/src/store/index.ts +0 -16
  107. package/app/client/src/store/slices/uiSlice.ts +0 -151
  108. package/app/client/src/store/slices/userSlice.ts +0 -161
  109. package/app/client/src/test/README.md +0 -257
  110. package/app/client/src/test/setup.ts +0 -70
  111. package/app/client/src/test/types.ts +0 -12
  112. package/app/server/live/CounterComponent.ts +0 -191
  113. package/app/server/live/FluxStackConfig.ts +0 -534
  114. package/app/server/live/SidebarNavigation.ts +0 -157
  115. package/app/server/live/SystemMonitor.ts +0 -595
  116. package/app/server/live/SystemMonitorIntegration.ts +0 -151
  117. package/app/server/live/UserProfileComponent.ts +0 -141
  118. package/app/server/middleware/auth.ts +0 -136
  119. package/app/server/middleware/errorHandling.ts +0 -252
  120. package/app/server/middleware/index.ts +0 -10
  121. package/app/server/middleware/rateLimit.ts +0 -193
  122. package/app/server/middleware/requestLogging.ts +0 -215
  123. package/app/server/middleware/validation.ts +0 -270
  124. package/app/server/routes/config.ts +0 -145
  125. package/app/server/routes/crypto-auth-demo.routes.ts +0 -167
  126. package/app/server/routes/example-with-crypto-auth.routes.ts +0 -235
  127. package/app/server/routes/exemplo-posts.routes.ts +0 -161
  128. package/app/server/routes/upload.ts +0 -92
  129. package/app/server/services/NotificationService.ts +0 -302
  130. package/app/server/services/UserService.ts +0 -222
  131. package/app/server/services/index.ts +0 -46
  132. package/app/server/types/index.ts +0 -1
@@ -1,6 +1,6 @@
1
- import type { Generator } from "./index.js"
2
- import type { GeneratorContext, GeneratorOptions, Template } from "./types.js"
3
- import { templateEngine } from "./template-engine.js"
1
+ import type { Generator } from "./index"
2
+ import type { GeneratorContext, GeneratorOptions, Template } from "./types"
3
+ import { templateEngine } from "./template-engine"
4
4
 
5
5
  export class RouteGenerator implements Generator {
6
6
  name = 'route'
@@ -54,15 +54,23 @@ export class RouteGenerator implements Generator {
54
54
  path: 'app/server/routes/{{kebabName}}.routes.ts',
55
55
  content: `import { Elysia, t } from 'elysia'
56
56
  import { {{pascalName}}Controller } from '../controllers/{{kebabName}}.controller'
57
- import { errorHandler } from '../../../core/utils/errors/middleware'
58
- import { logger } from '../../../core/utils/logger'
57
+ import { errorHandler } from '@/core/utils/errors/middleware'
58
+ import { logger } from '@/core/utils/logger'
59
59
 
60
60
  const controller = new {{pascalName}}Controller()
61
61
 
62
62
  export const {{camelName}}Routes = new Elysia({ prefix: '/api/{{kebabName}}s' })
63
63
  .use(errorHandler)
64
64
  .onBeforeHandle(({ request }) => {
65
- logger.request(request.method, new URL(request.url).pathname)
65
+ const url = (() => {
66
+ try {
67
+ return new URL(request.url)
68
+ } catch {
69
+ const host = request.headers.get('host') || 'localhost'
70
+ return new URL(request.url, \`http://\${host}\`)
71
+ }
72
+ })()
73
+ logger.request(request.method, url.pathname)
66
74
  })
67
75
  .get('/', async () => {
68
76
  return await controller.getAll()
@@ -300,16 +308,24 @@ export const {{camelName}}Routes = new Elysia({ prefix: '/api/{{kebabName}}s' })
300
308
  path: 'app/server/routes/auth.routes.ts',
301
309
  content: `import { Elysia, t } from 'elysia'
302
310
  import { AuthController } from '../controllers/auth.controller'
303
- import { errorHandler } from '../../../core/utils/errors/middleware'
311
+ import { errorHandler } from '@/core/utils/errors/middleware'
304
312
  import { authMiddleware } from '../middleware/auth.middleware'
305
- import { logger } from '../../../core/utils/logger'
313
+ import { logger } from '@/core/utils/logger'
306
314
 
307
315
  const controller = new AuthController()
308
316
 
309
317
  export const authRoutes = new Elysia({ prefix: '/api/auth' })
310
318
  .use(errorHandler)
311
319
  .onBeforeHandle(({ request }) => {
312
- logger.request(request.method, new URL(request.url).pathname)
320
+ const url = (() => {
321
+ try {
322
+ return new URL(request.url)
323
+ } catch {
324
+ const host = request.headers.get('host') || 'localhost'
325
+ return new URL(request.url, \`http://\${host}\`)
326
+ }
327
+ })()
328
+ logger.request(request.method, url.pathname)
313
329
  })
314
330
  .post('/register', async ({ body }) => {
315
331
  return await controller.register({ body })
@@ -456,8 +472,8 @@ export const authRoutes = new Elysia({ prefix: '/api/auth' })
456
472
  {
457
473
  path: 'app/server/middleware/auth.middleware.ts',
458
474
  content: `import { Context } from 'elysia'
459
- import { UnauthorizedError } from '../../../core/utils/errors'
460
- import { logger } from '../../../core/utils/logger'
475
+ import { UnauthorizedError } from '@/core/utils/errors'
476
+ import { logger } from '@/core/utils/logger'
461
477
 
462
478
  // JWT verification function (implement based on your JWT library)
463
479
  async function verifyJWT(token: string): Promise<any> {
@@ -1,6 +1,6 @@
1
- import type { Generator } from "./index.js"
2
- import type { GeneratorContext, GeneratorOptions, Template } from "./types.js"
3
- import { templateEngine } from "./template-engine.js"
1
+ import type { Generator } from "./index"
2
+ import type { GeneratorContext, GeneratorOptions, Template } from "./types"
3
+ import { templateEngine } from "./template-engine"
4
4
 
5
5
  export class ServiceGenerator implements Generator {
6
6
  name = 'service'
@@ -54,8 +54,8 @@ export class ServiceGenerator implements Generator {
54
54
  path: 'app/server/services/{{kebabName}}.service.ts',
55
55
  content: `import { {{pascalName}}, Create{{pascalName}}, Update{{pascalName}} } from '../schemas/{{kebabName}}.schema'
56
56
  import { {{pascalName}}Repository } from '../repositories/{{kebabName}}.repository'
57
- import { ValidationError, NotFoundError } from '../../../core/utils/errors'
58
- import { logger } from '../../../core/utils/logger'
57
+ import { ValidationError, NotFoundError } from '@/core/utils/errors'
58
+ import { logger } from '@/core/utils/logger'
59
59
 
60
60
  export class {{pascalName}}Service {
61
61
  private repository: {{pascalName}}Repository
@@ -1,4 +1,4 @@
1
- import type { GeneratorContext, GeneratorOptions, Template, TemplateFile, GeneratedFile, TemplateProcessor } from "./types.js"
1
+ import type { GeneratorContext, GeneratorOptions, Template, TemplateFile, GeneratedFile, TemplateProcessor } from "./types"
2
2
  import { join, dirname } from "path"
3
3
  import { mkdir, writeFile, readFile, stat } from "fs/promises"
4
4
  import { existsSync } from "fs"
@@ -1,5 +1,5 @@
1
1
  import type { FluxStackConfig } from "../../config/schema"
2
- import type { Logger } from "../../utils/logger/index"
2
+ import type { Logger } from "@/core/utils/logger/index"
3
3
  import type { PluginUtils } from "../../plugins/types"
4
4
 
5
5
  export interface GeneratorContext {
package/core/cli/index.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
- import { FluxStackBuilder } from "../build"
4
- import { ProjectCreator } from "../templates/create-project"
5
- import { getConfigSync } from "../config"
3
+ import { FluxStackBuilder } from "@/core/build"
4
+ import { ProjectCreator } from "@/core/templates/create-project"
5
+ import { getConfigSync } from "@/core/config"
6
6
  import { cliRegistry } from "./command-registry"
7
7
  import { pluginDiscovery } from "./plugin-discovery"
8
- import { generateCommand, interactiveGenerateCommand } from "./generators/index.js"
9
- import { startGroup, endGroup, logBox, logInGroup } from "../utils/logger/group-logger"
8
+ import { generateCommand, interactiveGenerateCommand } from "./generators/index"
9
+ import { startGroup, endGroup, logBox, logInGroup } from "@/core/utils/logger/group-logger"
10
10
 
11
11
  const command = process.argv[2]
12
12
  const args = process.argv.slice(3)
@@ -138,14 +138,14 @@ Examples:
138
138
  // Grouped startup messages
139
139
  startGroup({
140
140
  title: 'FluxStack Development Server',
141
- icon: '',
141
+ icon: '',
142
142
  color: 'cyan'
143
143
  })
144
144
 
145
- logInGroup(`Frontend: http://localhost:${options['frontend-port']}`, '🌐')
146
- logInGroup(`Backend: http://localhost:${options.port}`, '🚀')
147
- logInGroup('Backend inicia Vite programaticamente', '🔄')
148
- logInGroup('Starting backend server...', '📦')
145
+ logInGroup(`Server: http://localhost:${options.port}`, '')
146
+ logInGroup(`API: http://localhost:${options.port}/api`, '')
147
+ logInGroup(`Swagger: http://localhost:${options.port}/swagger`, '')
148
+ logInGroup('Starting with hot reload...', '')
149
149
 
150
150
  endGroup()
151
151
  console.log('') // Separator line
@@ -325,7 +325,7 @@ Examples:
325
325
  }
326
326
 
327
327
  // Use the plugin generator
328
- const { generatorRegistry } = await import('./generators/index.js')
328
+ const { generatorRegistry } = await import('./generators/index')
329
329
  const pluginGenerator = generatorRegistry.get('plugin')
330
330
 
331
331
  if (!pluginGenerator) {
@@ -356,6 +356,148 @@ Examples:
356
356
  }
357
357
  }
358
358
  })
359
+
360
+ // Frontend command (frontend-only development)
361
+ cliRegistry.register({
362
+ name: 'frontend',
363
+ description: 'Start frontend development server only',
364
+ category: 'Development',
365
+ usage: 'flux frontend [options]',
366
+ examples: [
367
+ 'flux frontend # Start Vite dev server on port 5173',
368
+ 'flux frontend --port 3000 # Start on custom port'
369
+ ],
370
+ options: [
371
+ {
372
+ name: 'port',
373
+ short: 'p',
374
+ description: 'Port for frontend server',
375
+ type: 'number',
376
+ default: 5173
377
+ }
378
+ ],
379
+ handler: async (args, options, context) => {
380
+ console.log("🎨 FluxStack Frontend Development")
381
+ console.log(`🌐 Frontend: http://localhost:${options.port}`)
382
+ console.log("📦 Starting Vite dev server...")
383
+ console.log()
384
+
385
+ const { spawn } = await import("child_process")
386
+ const frontendProcess = spawn("vite", ["--config", "vite.config.ts", "--port", options.port.toString()], {
387
+ stdio: "inherit",
388
+ cwd: process.cwd()
389
+ })
390
+
391
+ process.on('SIGINT', () => {
392
+ frontendProcess.kill('SIGINT')
393
+ process.exit(0)
394
+ })
395
+
396
+ return new Promise((resolve) => {
397
+ frontendProcess.on('exit', resolve)
398
+ })
399
+ }
400
+ })
401
+
402
+ // Backend command (backend-only development)
403
+ cliRegistry.register({
404
+ name: 'backend',
405
+ description: 'Start backend development server only',
406
+ category: 'Development',
407
+ usage: 'flux backend [options]',
408
+ examples: [
409
+ 'flux backend # Start backend on port 3001',
410
+ 'flux backend --port 4000 # Start on custom port'
411
+ ],
412
+ options: [
413
+ {
414
+ name: 'port',
415
+ short: 'p',
416
+ description: 'Port for backend server',
417
+ type: 'number',
418
+ default: 3001
419
+ }
420
+ ],
421
+ handler: async (args, options, context) => {
422
+ console.log("⚡ FluxStack Backend Development")
423
+ console.log(`🚀 API Server: http://localhost:${options.port}`)
424
+ console.log("📦 Starting backend with hot reload...")
425
+ console.log()
426
+
427
+ // Ensure backend-only.ts exists
428
+ const { ensureBackendEntry } = await import("../utils/regenerate-files")
429
+ await ensureBackendEntry()
430
+
431
+ // Start backend with Bun watch for hot reload
432
+ const { spawn } = await import("child_process")
433
+ const backendProcess = spawn("bun", ["--watch", "app/server/backend-only.ts"], {
434
+ stdio: "inherit",
435
+ cwd: process.cwd(),
436
+ env: {
437
+ ...process.env,
438
+ BACKEND_PORT: options.port.toString()
439
+ }
440
+ })
441
+
442
+ // Handle process cleanup
443
+ process.on('SIGINT', () => {
444
+ backendProcess.kill('SIGINT')
445
+ process.exit(0)
446
+ })
447
+
448
+ return new Promise((resolve) => {
449
+ backendProcess.on('exit', resolve)
450
+ })
451
+ }
452
+ })
453
+
454
+ // Start command (production server)
455
+ cliRegistry.register({
456
+ name: 'start',
457
+ description: 'Start production server',
458
+ category: 'Production',
459
+ usage: 'flux start',
460
+ examples: [
461
+ 'flux start # Start production server from dist/'
462
+ ],
463
+ handler: async (args, options, context) => {
464
+ console.log("🚀 Starting FluxStack production server...")
465
+ const { join } = await import("path")
466
+ await import(join(process.cwd(), "dist", "index.js"))
467
+ }
468
+ })
469
+
470
+ // Build:frontend command (shortcut)
471
+ cliRegistry.register({
472
+ name: 'build:frontend',
473
+ description: 'Build frontend only (shortcut for build --frontend-only)',
474
+ category: 'Build',
475
+ usage: 'flux build:frontend',
476
+ examples: [
477
+ 'flux build:frontend # Build only frontend'
478
+ ],
479
+ handler: async (args, options, context) => {
480
+ const config = getConfigSync()
481
+ const builder = new FluxStackBuilder(config)
482
+ await builder.buildClient()
483
+ }
484
+ })
485
+
486
+ // Build:backend command (shortcut)
487
+ cliRegistry.register({
488
+ name: 'build:backend',
489
+ description: 'Build backend only (shortcut for build --backend-only)',
490
+ category: 'Build',
491
+ usage: 'flux build:backend',
492
+ examples: [
493
+ 'flux build:backend # Build only backend'
494
+ ],
495
+ handler: async (args, options, context) => {
496
+ const config = getConfigSync()
497
+ const builder = new FluxStackBuilder(config)
498
+ await builder.buildServer()
499
+ }
500
+ })
359
501
  }
360
502
 
361
503
  // Main CLI logic
@@ -378,189 +520,12 @@ async function main() {
378
520
  process.exit(exitCode)
379
521
  return
380
522
  }
381
-
382
- // Fallback to legacy command handling for backward compatibility
383
- await handleLegacyCommands()
384
- }
385
-
386
- // Legacy command handling for backward compatibility
387
- async function handleLegacyCommands() {
388
- switch (command) {
389
- case "dev":
390
- // Grouped startup messages
391
- startGroup({
392
- title: 'FluxStack Development Server',
393
- icon: '⚡',
394
- color: 'cyan'
395
- })
396
-
397
- logInGroup('Frontend: http://localhost:5173', '🌐')
398
- logInGroup('Backend: http://localhost:3000', '🚀')
399
- logInGroup('Backend inicia Vite programaticamente', '🔄')
400
- logInGroup('Starting backend server...', '📦')
401
-
402
- endGroup()
403
- console.log('') // Separator line
404
-
405
- // Start only backend - it will start Vite programmatically
406
- const { spawn } = await import("child_process")
407
- const devProcess = spawn("bun", ["--watch", "app/server/index.ts"], {
408
- stdio: "inherit",
409
- cwd: process.cwd()
410
- })
411
-
412
- // Handle process cleanup
413
- process.on('SIGINT', () => {
414
- console.log('\n🛑 Shutting down gracefully...')
415
- devProcess.kill('SIGTERM')
416
- setTimeout(() => {
417
- devProcess.kill('SIGKILL')
418
- process.exit(0)
419
- }, 5000)
420
- })
421
-
422
- devProcess.on('close', (code) => {
423
- process.exit(code || 0)
424
- })
425
-
426
- // Keep the CLI running until the child process exits
427
- await new Promise((resolve) => {
428
- devProcess.on('exit', resolve)
429
- })
430
- break
431
-
432
- case "frontend":
433
- console.log("🎨 FluxStack Frontend Development")
434
- console.log("🌐 Frontend: http://localhost:5173")
435
- console.log("📦 Starting Vite dev server...")
436
- console.log()
437
-
438
- const { spawn: spawnFrontend } = await import("child_process")
439
- const frontendProcess = spawnFrontend("vite", ["--config", "vite.config.ts"], {
440
- stdio: "inherit",
441
- cwd: process.cwd()
442
- })
443
-
444
- process.on('SIGINT', () => {
445
- frontendProcess.kill('SIGINT')
446
- process.exit(0)
447
- })
448
- break
449
-
450
- case "backend":
451
- console.log("⚡ FluxStack Backend Development")
452
- console.log("🚀 API Server: http://localhost:3001")
453
- console.log("📦 Starting backend with hot reload...")
454
- console.log()
455
-
456
- // Ensure backend-only.ts exists
457
- const { ensureBackendEntry } = await import("../utils/regenerate-files")
458
- await ensureBackendEntry()
459
-
460
- // Start backend with Bun watch for hot reload
461
- const { spawn: spawnBackend } = await import("child_process")
462
- const backendProcess = spawnBackend("bun", ["--watch", "app/server/backend-only.ts"], {
463
- stdio: "inherit",
464
- cwd: process.cwd()
465
- })
466
-
467
- // Handle process cleanup
468
- process.on('SIGINT', () => {
469
- backendProcess.kill('SIGINT')
470
- process.exit(0)
471
- })
472
- break
473
-
474
- case "build":
475
- const config = getConfigSync()
476
- const builder = new FluxStackBuilder(config)
477
- await builder.build()
478
- break
479
-
480
- case "build:frontend":
481
- const frontendConfig = getConfigSync()
482
- const frontendBuilder = new FluxStackBuilder(frontendConfig)
483
- await frontendBuilder.buildClient()
484
- break
485
-
486
- case "build:backend":
487
- const backendConfig = getConfigSync()
488
- const backendBuilder = new FluxStackBuilder(backendConfig)
489
- await backendBuilder.buildServer()
490
- break
491
-
492
- case "start":
493
- console.log("🚀 Starting FluxStack production server...")
494
- const { join } = await import("path")
495
- await import(join(process.cwd(), "dist", "index.js"))
496
- break
497
-
498
- case "create":
499
- const projectName = process.argv[3]
500
- const template = process.argv[4]
501
-
502
- if (!projectName) {
503
- console.error("❌ Please provide a project name: flux create my-app")
504
- console.error()
505
- console.error("Usage:")
506
- console.error(" flux create <project-name> [template]")
507
- console.error()
508
- console.error("Templates:")
509
- console.error(" basic Basic FluxStack project (default)")
510
- console.error(" full Full-featured project with examples")
511
- process.exit(1)
512
- }
513
-
514
- // Validate project name
515
- if (!/^[a-zA-Z0-9-_]+$/.test(projectName)) {
516
- console.error("❌ Project name can only contain letters, numbers, hyphens, and underscores")
517
- process.exit(1)
518
- }
519
-
520
- try {
521
- const creator = new ProjectCreator({
522
- name: projectName,
523
- template: template as 'basic' | 'full' || 'basic'
524
- })
525
-
526
- await creator.create()
527
- } catch (error) {
528
- console.error("❌ Failed to create project:", error instanceof Error ? error.message : String(error))
529
- process.exit(1)
530
- }
531
- break
532
523
 
533
- default:
534
- console.log(`
535
- ⚡ FluxStack Framework CLI
536
-
537
- Usage:
538
- flux dev Start full-stack development server
539
- flux frontend Start frontend only (Vite dev server)
540
- flux backend Start backend only (API server)
541
- flux build Build both frontend and backend
542
- flux build:frontend Build frontend only
543
- flux build:backend Build backend only
544
- flux start Start production server
545
- flux create Create new project
546
-
547
- Examples:
548
- flux dev # Full-stack development
549
- flux frontend # Frontend only (port 5173)
550
- flux backend # Backend only (port 3001)
551
- flux create my-app # Create new project
552
-
553
- Alternative commands:
554
- fluxstack dev # Same as flux dev
555
- bun run dev:frontend # Direct frontend start
556
- bun run dev:backend # Direct backend start
557
-
558
- Environment Variables:
559
- FRONTEND_PORT=5173 # Frontend port
560
- BACKEND_PORT=3001 # Backend port
561
- API_URL=http://localhost:3001 # API URL for frontend
562
- `)
563
- }
524
+ // Command not found - show error and help
525
+ console.error(`❌ Unknown command: ${command}`)
526
+ console.error()
527
+ await cliRegistry.execute('help', args)
528
+ process.exit(1)
564
529
  }
565
530
 
566
531
  // Run main CLI
@@ -1,8 +1,8 @@
1
1
  import { existsSync } from 'fs'
2
2
  import { join } from 'path'
3
- import type { FluxStack } from '../plugins/types'
3
+ import type { FluxStack } from '@/core/plugins/types'
4
4
  import { cliRegistry } from './command-registry'
5
- import { logger } from '../utils/logger'
5
+ import { logger } from '@/core/utils/logger'
6
6
 
7
7
  export class CliPluginDiscovery {
8
8
  private loadedPlugins = new Set<string>()
@@ -110,7 +110,7 @@ export class CliPluginDiscovery {
110
110
  }
111
111
  }
112
112
 
113
- private registerPluginCommands(plugin: Plugin): void {
113
+ private registerPluginCommands(plugin: FluxStack.Plugin): void {
114
114
  if (!plugin.commands || this.loadedPlugins.has(plugin.name)) {
115
115
  return
116
116
  }
@@ -3,5 +3,5 @@
3
3
  * FluxStack hook utilities exports
4
4
  */
5
5
 
6
- export { createAuthHook } from './useAuth.js'
7
- export type { AuthHook } from './useAuth.js'
6
+ export { createAuthHook } from './useAuth'
7
+ export type { AuthHook } from './useAuth'
@@ -1,6 +1,6 @@
1
1
  // 🔥 State Validation Utilities
2
2
 
3
- import type { StateValidation, StateConflict, HybridState } from '../../types/types'
3
+ import type { StateValidation, StateConflict, HybridState } from '@/core/types/types'
4
4
 
5
5
  export class StateValidator {
6
6
  /**
@@ -3,7 +3,7 @@
3
3
  * Core FluxStack authentication utilities
4
4
  */
5
5
 
6
- import type { BaseUser, BaseUserStore } from '../state/index.js'
6
+ import type { BaseUser, BaseUserStore } from '../state/index'
7
7
 
8
8
  /**
9
9
  * Create authentication hook for a user store
@@ -5,7 +5,7 @@ import type {
5
5
  FileUploadCompleteMessage,
6
6
  FileUploadProgressResponse,
7
7
  FileUploadCompleteResponse
8
- } from '../../types/types'
8
+ } from '@/core/types/types'
9
9
 
10
10
  export interface ChunkedUploadOptions {
11
11
  chunkSize?: number // Default 64KB
@@ -12,7 +12,7 @@ import type {
12
12
  HybridComponentOptions,
13
13
  WebSocketMessage,
14
14
  WebSocketResponse
15
- } from '../../types/types'
15
+ } from '@/core/types/types'
16
16
 
17
17
  // Client-side state persistence for reconnection
18
18
  interface PersistedComponentState {
@@ -1,7 +1,7 @@
1
1
  // 🔥 WebSocket Hook for Live Components
2
2
 
3
3
  import { useState, useEffect, useCallback, useRef } from 'react'
4
- import type { WebSocketMessage, WebSocketResponse } from '../../types/types'
4
+ import type { WebSocketMessage, WebSocketResponse } from '@/core/types/types'
5
5
 
6
6
  // Re-export types for easier importing
7
7
  export type { WebSocketMessage, WebSocketResponse }
@@ -3,7 +3,7 @@
3
3
  * Handles environment variable processing and precedence
4
4
  */
5
5
 
6
- import { env, helpers } from '../utils/env'
6
+ import { env, helpers } from '@/core/utils/env'
7
7
  import type { FluxStackConfig, LogLevel, BuildTarget, LogFormat } from './schema'
8
8
 
9
9
  export interface EnvironmentInfo {
@@ -6,11 +6,11 @@
6
6
  import { env, createNamespace } from '../utils/env'
7
7
  import type { FluxStackConfig } from './schema'
8
8
  import { defaultFluxStackConfig } from './schema'
9
- import { loggerConfig } from '../../config/logger.config'
10
- import { clientConfig } from '../../config/client.config'
11
- import { serverConfig } from '../../config/server.config'
12
- import { monitoringConfig } from '../../config/monitoring.config'
13
- import { appConfig } from '../../config/app.config'
9
+ import { loggerConfig } from '@/config/logger.config'
10
+ import { clientConfig } from '@/config/client.config'
11
+ import { serverConfig } from '@/config/server.config'
12
+ import { monitoringConfig } from '@/config/monitoring.config'
13
+ import { appConfig } from '@/config/app.config'
14
14
 
15
15
  /**
16
16
  * Runtime Configuration Builder
@@ -209,6 +209,15 @@ export interface FluxStackConfig {
209
209
  auth?: AuthConfig
210
210
  email?: EmailConfig
211
211
  storage?: StorageConfig
212
+ staticFiles?: {
213
+ publicDir?: string
214
+ uploadsDir?: string
215
+ cacheMaxAge?: number
216
+ enableUploads?: boolean
217
+ enablePublic?: boolean
218
+ publicRoute?: string
219
+ uploadsRoute?: string
220
+ }
212
221
 
213
222
  // Environment-specific overrides
214
223
  environments?: {