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,388 +0,0 @@
1
- // 🔥 Main Layout with Sidebar Navigation
2
-
3
- import React, { useState } from 'react'
4
- import { SidebarNavigation } from './SidebarNavigation'
5
- import { UserProfile } from './UserProfile'
6
- import { SystemMonitor } from './SystemMonitor'
7
- import { FluxStackConfig } from './FluxStackConfig'
8
- import { FaHome, FaCog, FaFolder, FaChartBar, FaRocket, FaServer } from 'react-icons/fa'
9
-
10
- // Temporary placeholder components for other pages
11
- function Dashboard() {
12
- return (
13
- <div style={{
14
- padding: '2rem',
15
- maxWidth: '1200px',
16
- margin: '0 auto'
17
- }}>
18
- <div style={{
19
- background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
20
- borderRadius: '20px',
21
- padding: '3rem',
22
- color: 'white',
23
- textAlign: 'center',
24
- marginBottom: '2rem'
25
- }}>
26
- <FaRocket size={48} style={{ marginBottom: '1rem' }} />
27
- <h1 style={{ fontSize: '2.5rem', marginBottom: '1rem' }}>
28
- 🔥 FluxStack Dashboard
29
- </h1>
30
- <p style={{ fontSize: '1.2rem', opacity: 0.9 }}>
31
- Bem-vindo ao seu painel de controle interativo!
32
- </p>
33
- </div>
34
-
35
- <div style={{
36
- display: 'grid',
37
- gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
38
- gap: '2rem',
39
- marginTop: '2rem'
40
- }}>
41
- {/* Stats Cards */}
42
- {[
43
- { title: 'Live Components', value: '5', icon: FaRocket, color: '#3b82f6' },
44
- { title: 'WebSocket Conexões', value: '12', icon: FaHome, color: '#10b981' },
45
- { title: 'Uploads Ativos', value: '3', icon: FaFolder, color: '#f59e0b' },
46
- { title: 'Usuários Online', value: '8', icon: FaChartBar, color: '#ef4444' }
47
- ].map((stat, index) => {
48
- const Icon = stat.icon
49
- return (
50
- <div key={index} style={{
51
- backgroundColor: 'white',
52
- padding: '2rem',
53
- borderRadius: '16px',
54
- boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',
55
- border: '1px solid #e5e7eb'
56
- }}>
57
- <div style={{
58
- display: 'flex',
59
- alignItems: 'center',
60
- gap: '1rem',
61
- marginBottom: '1rem'
62
- }}>
63
- <div style={{
64
- backgroundColor: stat.color,
65
- padding: '0.75rem',
66
- borderRadius: '12px',
67
- color: 'white'
68
- }}>
69
- <Icon size={24} />
70
- </div>
71
- <div>
72
- <h3 style={{
73
- margin: 0,
74
- fontSize: '1.1rem',
75
- color: '#374151'
76
- }}>
77
- {stat.title}
78
- </h3>
79
- <p style={{
80
- margin: 0,
81
- fontSize: '2rem',
82
- fontWeight: 'bold',
83
- color: stat.color
84
- }}>
85
- {stat.value}
86
- </p>
87
- </div>
88
- </div>
89
- </div>
90
- )
91
- })}
92
- </div>
93
-
94
- <div style={{
95
- backgroundColor: 'white',
96
- padding: '2rem',
97
- borderRadius: '16px',
98
- marginTop: '2rem',
99
- boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)'
100
- }}>
101
- <h2 style={{ color: '#374151', marginBottom: '1rem' }}>
102
- 📊 Sistema de Live Components
103
- </h2>
104
- <p style={{ color: '#6b7280', lineHeight: 1.6 }}>
105
- Este dashboard demonstra o poder dos Live Components do FluxStack.
106
- Navegue pelo menu lateral para explorar diferentes seções como
107
- Perfil de Usuário, Configurações, Gerenciamento de Arquivos e Analytics.
108
- Tudo funcionando com WebSockets em tempo real e estado persistido!
109
- </p>
110
-
111
- <div style={{
112
- marginTop: '1.5rem',
113
- padding: '1rem',
114
- backgroundColor: '#f0f9ff',
115
- borderRadius: '8px',
116
- border: '1px solid #0ea5e9'
117
- }}>
118
- <h4 style={{ color: '#0369a1', margin: '0 0 0.5rem 0' }}>
119
- 🎯 Funcionalidades Ativas:
120
- </h4>
121
- <ul style={{ color: '#0369a1', margin: 0, paddingLeft: '1.5rem' }}>
122
- <li>✅ Reconexão automática com re-hydration</li>
123
- <li>✅ Estado criptograficamente assinado</li>
124
- <li>✅ Interface sem piscadas (optimized loading)</li>
125
- <li>✅ Navegação via Live Components</li>
126
- <li>✅ Upload de arquivos por chunks via WebSocket</li>
127
- </ul>
128
- </div>
129
- </div>
130
- </div>
131
- )
132
- }
133
-
134
- function Settings() {
135
- return (
136
- <div style={{
137
- padding: '2rem',
138
- maxWidth: '800px',
139
- margin: '0 auto'
140
- }}>
141
- <div style={{
142
- backgroundColor: 'white',
143
- padding: '2rem',
144
- borderRadius: '16px',
145
- boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)'
146
- }}>
147
- <div style={{
148
- display: 'flex',
149
- alignItems: 'center',
150
- gap: '1rem',
151
- marginBottom: '2rem'
152
- }}>
153
- <FaCog size={32} style={{ color: '#6b7280' }} />
154
- <h1 style={{ color: '#374151', margin: 0 }}>Configurações</h1>
155
- </div>
156
-
157
- <p style={{ color: '#6b7280', marginBottom: '2rem' }}>
158
- Painel de configurações do FluxStack. Aqui você pode ajustar
159
- preferências do sistema, configurar integrações e gerenciar
160
- suas configurações de usuário.
161
- </p>
162
-
163
- <div style={{
164
- padding: '1.5rem',
165
- backgroundColor: '#fef3c7',
166
- borderRadius: '8px',
167
- border: '1px solid #f59e0b'
168
- }}>
169
- <h3 style={{ color: '#92400e', margin: '0 0 1rem 0' }}>
170
- 🚧 Em Desenvolvimento
171
- </h3>
172
- <p style={{ color: '#92400e', margin: 0 }}>
173
- Esta seção será expandida com configurações avançadas,
174
- integrações de API, configurações de tema personalizadas
175
- e muito mais!
176
- </p>
177
- </div>
178
- </div>
179
- </div>
180
- )
181
- }
182
-
183
- function Files() {
184
- return (
185
- <div style={{
186
- padding: '2rem',
187
- maxWidth: '1000px',
188
- margin: '0 auto'
189
- }}>
190
- <div style={{
191
- backgroundColor: 'white',
192
- padding: '2rem',
193
- borderRadius: '16px',
194
- boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)'
195
- }}>
196
- <div style={{
197
- display: 'flex',
198
- alignItems: 'center',
199
- gap: '1rem',
200
- marginBottom: '2rem'
201
- }}>
202
- <FaFolder size={32} style={{ color: '#6b7280' }} />
203
- <h1 style={{ color: '#374151', margin: 0 }}>Gerenciamento de Arquivos</h1>
204
- </div>
205
-
206
- <p style={{ color: '#6b7280', marginBottom: '2rem' }}>
207
- Sistema avançado de upload e gerenciamento de arquivos via WebSocket.
208
- Suporte a upload por chunks, progress em tempo real e armazenamento seguro.
209
- </p>
210
-
211
- <div style={{
212
- padding: '1.5rem',
213
- backgroundColor: '#f0fdf4',
214
- borderRadius: '8px',
215
- border: '1px solid #10b981',
216
- marginBottom: '2rem'
217
- }}>
218
- <h3 style={{ color: '#047857', margin: '0 0 1rem 0' }}>
219
- ✅ Funcionalidades Implementadas
220
- </h3>
221
- <ul style={{ color: '#047857', margin: 0, paddingLeft: '1.5rem' }}>
222
- <li>Upload via WebSocket com chunks</li>
223
- <li>Progress tracking em tempo real</li>
224
- <li>Validação de tipos de arquivo</li>
225
- <li>Armazenamento organizado por categorias</li>
226
- <li>Preview de imagens integrado</li>
227
- </ul>
228
- </div>
229
-
230
- <div style={{
231
- padding: '1.5rem',
232
- backgroundColor: '#fef3c7',
233
- borderRadius: '8px',
234
- border: '1px solid #f59e0b'
235
- }}>
236
- <h3 style={{ color: '#92400e', margin: '0 0 1rem 0' }}>
237
- 🔄 Próximas Features
238
- </h3>
239
- <ul style={{ color: '#92400e', margin: 0, paddingLeft: '1.5rem' }}>
240
- <li>Galeria de arquivos com busca</li>
241
- <li>Compartilhamento de arquivos</li>
242
- <li>Versionamento de documentos</li>
243
- <li>Integração com storage cloud</li>
244
- </ul>
245
- </div>
246
- </div>
247
- </div>
248
- )
249
- }
250
-
251
- function Analytics() {
252
- return (
253
- <div style={{
254
- padding: '2rem',
255
- maxWidth: '1200px',
256
- margin: '0 auto'
257
- }}>
258
- <div style={{
259
- backgroundColor: 'white',
260
- padding: '2rem',
261
- borderRadius: '16px',
262
- boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)'
263
- }}>
264
- <div style={{
265
- display: 'flex',
266
- alignItems: 'center',
267
- gap: '1rem',
268
- marginBottom: '2rem'
269
- }}>
270
- <FaServer size={32} style={{ color: '#6b7280' }} />
271
- <h1 style={{ color: '#374151', margin: 0 }}>Sistema de Monitoramento</h1>
272
- </div>
273
-
274
- <p style={{ color: '#6b7280', marginBottom: '2rem' }}>
275
- Dashboard completo de monitoramento dos Live Components em tempo real.
276
- Métricas de performance, conexões WebSocket, uso de recursos e atividade do sistema.
277
- </p>
278
-
279
- <div style={{
280
- display: 'grid',
281
- gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))',
282
- gap: '1.5rem',
283
- marginBottom: '2rem'
284
- }}>
285
- {[
286
- { title: 'WebSocket Connections', value: '127', trend: '+12%' },
287
- { title: 'Live Components', value: '34', trend: '+8%' },
288
- { title: 'Messages/sec', value: '2.3k', trend: '+15%' },
289
- { title: 'Uptime', value: '99.8%', trend: '+0.1%' }
290
- ].map((metric, index) => (
291
- <div key={index} style={{
292
- padding: '1.5rem',
293
- backgroundColor: '#f8fafc',
294
- borderRadius: '12px',
295
- border: '1px solid #e2e8f0'
296
- }}>
297
- <h3 style={{
298
- color: '#475569',
299
- fontSize: '0.9rem',
300
- margin: '0 0 0.5rem 0',
301
- textTransform: 'uppercase',
302
- letterSpacing: '0.05em'
303
- }}>
304
- {metric.title}
305
- </h3>
306
- <div style={{ display: 'flex', alignItems: 'center', gap: '1rem' }}>
307
- <span style={{
308
- fontSize: '2rem',
309
- fontWeight: 'bold',
310
- color: '#1e293b'
311
- }}>
312
- {metric.value}
313
- </span>
314
- <span style={{
315
- fontSize: '0.9rem',
316
- color: '#10b981',
317
- backgroundColor: '#f0fdf4',
318
- padding: '0.25rem 0.5rem',
319
- borderRadius: '4px'
320
- }}>
321
- {metric.trend}
322
- </span>
323
- </div>
324
- </div>
325
- ))}
326
- </div>
327
-
328
- <div style={{
329
- padding: '1.5rem',
330
- backgroundColor: '#eff6ff',
331
- borderRadius: '8px',
332
- border: '1px solid #3b82f6'
333
- }}>
334
- <h3 style={{ color: '#1d4ed8', margin: '0 0 1rem 0' }}>
335
- 📈 Métricas em Tempo Real
336
- </h3>
337
- <p style={{ color: '#1d4ed8', margin: 0 }}>
338
- Todas as métricas são coletadas e atualizadas via Live Components,
339
- proporcionando visibilidade instantânea do sistema em produção.
340
- </p>
341
- </div>
342
- </div>
343
- </div>
344
- )
345
- }
346
-
347
- export function MainLayout() {
348
- const [currentPage, setCurrentPage] = useState('dashboard')
349
-
350
- const renderContent = () => {
351
- switch (currentPage) {
352
- case 'dashboard':
353
- return <Dashboard />
354
- case 'profile':
355
- return <UserProfile />
356
- case 'settings':
357
- return <Settings />
358
- case 'files':
359
- return <Files />
360
- case 'analytics':
361
- return <SystemMonitor />
362
- case 'config':
363
- return <FluxStackConfig />
364
- default:
365
- return <Dashboard />
366
- }
367
- }
368
-
369
- return (
370
- <div style={{
371
- display: 'flex',
372
- height: '100vh',
373
- backgroundColor: '#f8fafc'
374
- }}>
375
- {/* Sidebar */}
376
- <SidebarNavigation onPageChange={setCurrentPage} />
377
-
378
- {/* Main Content */}
379
- <main style={{
380
- flex: 1,
381
- overflow: 'auto',
382
- height: '100vh'
383
- }}>
384
- {renderContent()}
385
- </main>
386
- </div>
387
- )
388
- }