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
@@ -0,0 +1,26 @@
1
+ // 🔥 Auto-generated Live Components Registration
2
+ // This file is automatically generated during build time - DO NOT EDIT MANUALLY
3
+ // Generated at: 2025-11-12T22:57:08.521Z
4
+
5
+ import { LiveClockComponent } from "@/app/server/live/LiveClockComponent"
6
+ import { componentRegistry } from "@/core/server/live/ComponentRegistry"
7
+
8
+ // Register all components statically for production bundle
9
+ function registerAllComponents() {
10
+ try {
11
+ // Auto-generated component registrations
12
+ componentRegistry.registerComponentClass('LiveClock', LiveClockComponent)
13
+
14
+ console.log('📝 Live components registered successfully! (1 components)')
15
+ } catch (error) {
16
+ console.warn('⚠️ Error registering components:', error)
17
+ }
18
+ }
19
+
20
+ // Auto-register components
21
+ registerAllComponents()
22
+
23
+ // Export all components to ensure they're included in the bundle
24
+ export {
25
+ LiveClockComponent
26
+ }
@@ -4,11 +4,114 @@ import { componentRegistry } from './ComponentRegistry'
4
4
  import { fileUploadManager } from './FileUploadManager'
5
5
  import { connectionManager } from './WebSocketConnectionManager'
6
6
  import { performanceMonitor } from './LiveComponentPerformanceMonitor'
7
- import type { LiveMessage, FileUploadStartMessage, FileUploadChunkMessage, FileUploadCompleteMessage } from '../../types/types'
7
+ import type { LiveMessage, FileUploadStartMessage, FileUploadChunkMessage, FileUploadCompleteMessage } from '@/core/plugins/types'
8
8
  import type { Plugin, PluginContext } from '@/core/index'
9
- import { t } from 'elysia'
9
+ import { t, Elysia } from 'elysia'
10
10
  import path from 'path'
11
11
 
12
+ // ===== Response Schemas for Live Components Routes =====
13
+
14
+ const LiveWebSocketInfoSchema = t.Object({
15
+ success: t.Boolean(),
16
+ message: t.String(),
17
+ endpoint: t.String(),
18
+ status: t.String(),
19
+ connectionManager: t.Any()
20
+ }, {
21
+ description: 'WebSocket connection information and system statistics'
22
+ })
23
+
24
+ const LiveStatsSchema = t.Object({
25
+ success: t.Boolean(),
26
+ stats: t.Any(),
27
+ timestamp: t.String()
28
+ }, {
29
+ description: 'Live Components statistics including registered components and instances'
30
+ })
31
+
32
+ const LiveHealthSchema = t.Object({
33
+ success: t.Boolean(),
34
+ service: t.String(),
35
+ status: t.String(),
36
+ components: t.Number(),
37
+ connections: t.Any(),
38
+ uptime: t.Number(),
39
+ timestamp: t.String()
40
+ }, {
41
+ description: 'Health status of Live Components service'
42
+ })
43
+
44
+ const LiveConnectionsSchema = t.Object({
45
+ success: t.Boolean(),
46
+ connections: t.Array(t.Any()),
47
+ systemStats: t.Any(),
48
+ timestamp: t.String()
49
+ }, {
50
+ description: 'List of all active WebSocket connections with metrics'
51
+ })
52
+
53
+ const LiveConnectionDetailsSchema = t.Union([
54
+ t.Object({
55
+ success: t.Literal(true),
56
+ connection: t.Any(),
57
+ timestamp: t.String()
58
+ }),
59
+ t.Object({
60
+ success: t.Literal(false),
61
+ error: t.String()
62
+ })
63
+ ], {
64
+ description: 'Detailed metrics for a specific connection'
65
+ })
66
+
67
+ const LivePoolStatsSchema = t.Union([
68
+ t.Object({
69
+ success: t.Literal(true),
70
+ pool: t.String(),
71
+ stats: t.Any(),
72
+ timestamp: t.String()
73
+ }),
74
+ t.Object({
75
+ success: t.Literal(false),
76
+ error: t.String()
77
+ })
78
+ ], {
79
+ description: 'Statistics for a specific connection pool'
80
+ })
81
+
82
+ const LivePerformanceDashboardSchema = t.Object({
83
+ success: t.Boolean(),
84
+ dashboard: t.Any(),
85
+ timestamp: t.String()
86
+ }, {
87
+ description: 'Performance monitoring dashboard data'
88
+ })
89
+
90
+ const LiveComponentMetricsSchema = t.Union([
91
+ t.Object({
92
+ success: t.Literal(true),
93
+ component: t.String(),
94
+ metrics: t.Any(),
95
+ alerts: t.Array(t.Any()),
96
+ suggestions: t.Array(t.Any()),
97
+ timestamp: t.String()
98
+ }),
99
+ t.Object({
100
+ success: t.Literal(false),
101
+ error: t.String()
102
+ })
103
+ ], {
104
+ description: 'Performance metrics, alerts and suggestions for a specific component'
105
+ })
106
+
107
+ const LiveAlertResolveSchema = t.Object({
108
+ success: t.Boolean(),
109
+ message: t.String(),
110
+ timestamp: t.String()
111
+ }, {
112
+ description: 'Result of alert resolution operation'
113
+ })
114
+
12
115
  export const liveComponentsPlugin: Plugin = {
13
116
  name: 'live-components',
14
117
  version: '1.0.0',
@@ -26,9 +129,10 @@ export const liveComponentsPlugin: Plugin = {
26
129
  await componentRegistry.autoDiscoverComponents(componentsPath)
27
130
  context.logger.debug('🔍 Component auto-discovery completed')
28
131
 
29
- // Add WebSocket route for Live Components
30
- context.app
31
- .ws('/api/live/ws', {
132
+ // Create grouped routes for Live Components with documentation
133
+ const liveRoutes = new Elysia({ prefix: '/api/live', tags: ['Live Components'] })
134
+ // WebSocket route
135
+ .ws('/ws', {
32
136
  body: t.Object({
33
137
  type: t.String(),
34
138
  componentId: t.String(),
@@ -120,7 +224,7 @@ export const liveComponentsPlugin: Plugin = {
120
224
  await handleFileUploadChunk(ws, message as FileUploadChunkMessage)
121
225
  break
122
226
  case 'FILE_UPLOAD_COMPLETE':
123
- await handleFileUploadComplete(ws, message as FileUploadCompleteMessage)
227
+ await handleFileUploadComplete(ws, message as unknown as FileUploadCompleteMessage)
124
228
  break
125
229
  default:
126
230
  console.warn(`❌ Unknown message type: ${message.type}`)
@@ -153,9 +257,9 @@ export const liveComponentsPlugin: Plugin = {
153
257
  componentRegistry.cleanupConnection(ws)
154
258
  }
155
259
  })
156
-
157
- // Add Live Components info routes
158
- .get('/api/live/websocket-info', () => {
260
+
261
+ // ===== Live Components Information Routes =====
262
+ .get('/websocket-info', () => {
159
263
  return {
160
264
  success: true,
161
265
  message: 'Live Components WebSocket available via Elysia',
@@ -163,16 +267,32 @@ export const liveComponentsPlugin: Plugin = {
163
267
  status: 'running',
164
268
  connectionManager: connectionManager.getSystemStats()
165
269
  }
270
+ }, {
271
+ detail: {
272
+ summary: 'Get WebSocket Information',
273
+ description: 'Returns WebSocket endpoint information and connection manager statistics',
274
+ tags: ['Live Components', 'WebSocket']
275
+ },
276
+ response: LiveWebSocketInfoSchema
166
277
  })
167
- .get('/api/live/stats', () => {
278
+
279
+ .get('/stats', () => {
168
280
  const stats = componentRegistry.getStats()
169
281
  return {
170
282
  success: true,
171
283
  stats,
172
284
  timestamp: new Date().toISOString()
173
285
  }
286
+ }, {
287
+ detail: {
288
+ summary: 'Get Live Components Statistics',
289
+ description: 'Returns statistics about registered components and active instances',
290
+ tags: ['Live Components', 'Monitoring']
291
+ },
292
+ response: LiveStatsSchema
174
293
  })
175
- .get('/api/live/health', () => {
294
+
295
+ .get('/health', () => {
176
296
  return {
177
297
  success: true,
178
298
  service: 'FluxStack Live Components',
@@ -182,16 +302,33 @@ export const liveComponentsPlugin: Plugin = {
182
302
  uptime: process.uptime(),
183
303
  timestamp: new Date().toISOString()
184
304
  }
305
+ }, {
306
+ detail: {
307
+ summary: 'Health Check',
308
+ description: 'Returns the health status of the Live Components service',
309
+ tags: ['Live Components', 'Health']
310
+ },
311
+ response: LiveHealthSchema
185
312
  })
186
- .get('/api/live/connections', () => {
313
+
314
+ // ===== Connection Management Routes =====
315
+ .get('/connections', () => {
187
316
  return {
188
317
  success: true,
189
318
  connections: connectionManager.getAllConnectionMetrics(),
190
319
  systemStats: connectionManager.getSystemStats(),
191
320
  timestamp: new Date().toISOString()
192
321
  }
322
+ }, {
323
+ detail: {
324
+ summary: 'List All Connections',
325
+ description: 'Returns all active WebSocket connections with their metrics',
326
+ tags: ['Live Components', 'Connections']
327
+ },
328
+ response: LiveConnectionsSchema
193
329
  })
194
- .get('/api/live/connections/:connectionId', ({ params }) => {
330
+
331
+ .get('/connections/:connectionId', ({ params }) => {
195
332
  const metrics = connectionManager.getConnectionMetrics(params.connectionId)
196
333
  if (!metrics) {
197
334
  return {
@@ -204,8 +341,19 @@ export const liveComponentsPlugin: Plugin = {
204
341
  connection: metrics,
205
342
  timestamp: new Date().toISOString()
206
343
  }
344
+ }, {
345
+ detail: {
346
+ summary: 'Get Connection Details',
347
+ description: 'Returns detailed metrics for a specific WebSocket connection',
348
+ tags: ['Live Components', 'Connections']
349
+ },
350
+ params: t.Object({
351
+ connectionId: t.String({ description: 'The unique connection identifier' })
352
+ }),
353
+ response: LiveConnectionDetailsSchema
207
354
  })
208
- .get('/api/live/pools/:poolId/stats', ({ params }) => {
355
+
356
+ .get('/pools/:poolId/stats', ({ params }) => {
209
357
  const stats = connectionManager.getPoolStats(params.poolId)
210
358
  if (!stats) {
211
359
  return {
@@ -219,15 +367,35 @@ export const liveComponentsPlugin: Plugin = {
219
367
  stats,
220
368
  timestamp: new Date().toISOString()
221
369
  }
370
+ }, {
371
+ detail: {
372
+ summary: 'Get Pool Statistics',
373
+ description: 'Returns statistics for a specific connection pool',
374
+ tags: ['Live Components', 'Connections', 'Pools']
375
+ },
376
+ params: t.Object({
377
+ poolId: t.String({ description: 'The unique pool identifier' })
378
+ }),
379
+ response: LivePoolStatsSchema
222
380
  })
223
- .get('/api/live/performance/dashboard', () => {
381
+
382
+ // ===== Performance Monitoring Routes =====
383
+ .get('/performance/dashboard', () => {
224
384
  return {
225
385
  success: true,
226
386
  dashboard: performanceMonitor.generateDashboard(),
227
387
  timestamp: new Date().toISOString()
228
388
  }
389
+ }, {
390
+ detail: {
391
+ summary: 'Performance Dashboard',
392
+ description: 'Returns comprehensive performance monitoring dashboard data',
393
+ tags: ['Live Components', 'Performance']
394
+ },
395
+ response: LivePerformanceDashboardSchema
229
396
  })
230
- .get('/api/live/performance/components/:componentId', ({ params }) => {
397
+
398
+ .get('/performance/components/:componentId', ({ params }) => {
231
399
  const metrics = performanceMonitor.getComponentMetrics(params.componentId)
232
400
  if (!metrics) {
233
401
  return {
@@ -235,10 +403,10 @@ export const liveComponentsPlugin: Plugin = {
235
403
  error: 'Component metrics not found'
236
404
  }
237
405
  }
238
-
406
+
239
407
  const alerts = performanceMonitor.getComponentAlerts(params.componentId)
240
408
  const suggestions = performanceMonitor.getComponentSuggestions(params.componentId)
241
-
409
+
242
410
  return {
243
411
  success: true,
244
412
  component: params.componentId,
@@ -247,15 +415,39 @@ export const liveComponentsPlugin: Plugin = {
247
415
  suggestions,
248
416
  timestamp: new Date().toISOString()
249
417
  }
418
+ }, {
419
+ detail: {
420
+ summary: 'Get Component Performance Metrics',
421
+ description: 'Returns performance metrics, alerts, and optimization suggestions for a specific component',
422
+ tags: ['Live Components', 'Performance']
423
+ },
424
+ params: t.Object({
425
+ componentId: t.String({ description: 'The unique component identifier' })
426
+ }),
427
+ response: LiveComponentMetricsSchema
250
428
  })
251
- .post('/api/live/performance/alerts/:alertId/resolve', ({ params }) => {
429
+
430
+ .post('/performance/alerts/:alertId/resolve', ({ params }) => {
252
431
  const resolved = performanceMonitor.resolveAlert(params.alertId)
253
432
  return {
254
433
  success: resolved,
255
434
  message: resolved ? 'Alert resolved' : 'Alert not found',
256
435
  timestamp: new Date().toISOString()
257
436
  }
437
+ }, {
438
+ detail: {
439
+ summary: 'Resolve Performance Alert',
440
+ description: 'Marks a performance alert as resolved',
441
+ tags: ['Live Components', 'Performance', 'Alerts']
442
+ },
443
+ params: t.Object({
444
+ alertId: t.String({ description: 'The unique alert identifier' })
445
+ }),
446
+ response: LiveAlertResolveSchema
258
447
  })
448
+
449
+ // Register the grouped routes with the main app
450
+ context.app.use(liveRoutes)
259
451
  },
260
452
 
261
453
  onServerStart: async (context: PluginContext) => {
@@ -20,7 +20,7 @@ export interface Response {
20
20
  export interface NextFunction {
21
21
  (error?: any): void
22
22
  }
23
- import type { Logger } from '../../utils/logger/index.js'
23
+ import type { Logger } from '@/core/utils/logger/index'
24
24
 
25
25
  export interface ErrorHandlingOptions {
26
26
  logger?: Logger
@@ -8,12 +8,12 @@ export {
8
8
  notFoundMiddleware,
9
9
  createError,
10
10
  asyncHandler
11
- } from './errorHandling.js'
11
+ } from './errorHandling'
12
12
 
13
13
  export type {
14
14
  ErrorHandlingOptions,
15
15
  FluxStackError
16
- } from './errorHandling.js'
16
+ } from './errorHandling'
17
17
 
18
18
  // Elysia Middleware Helpers
19
19
  export {
@@ -25,8 +25,8 @@ export {
25
25
  isDevelopment,
26
26
  isProduction,
27
27
  isTest
28
- } from './elysia-helpers.js'
28
+ } from './elysia-helpers'
29
29
 
30
30
  export type {
31
31
  MiddlewareOptions
32
- } from './elysia-helpers.js'
32
+ } from './elysia-helpers'
@@ -1,9 +1,8 @@
1
- import type { FluxStack, PluginContext, CliCommand } from "../../plugins/types"
1
+ import type { FluxStack, PluginContext, CliCommand, Plugin } from "../../plugins/types"
2
2
 
3
3
  // Database plugin with CLI commands
4
4
  export const databasePlugin: Plugin = {
5
5
  name: "database",
6
- version: "1.0.0",
7
6
  description: "Database management plugin with CLI commands",
8
7
  author: "FluxStack Team",
9
8
  category: "data",