create-fluxstack 1.0.13 → 1.0.14
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.
- package/.env.example +29 -29
- package/app/client/README.md +69 -69
- package/app/client/index.html +14 -13
- package/app/client/src/App.tsx +157 -524
- package/app/client/src/components/ErrorBoundary.tsx +107 -0
- package/app/client/src/components/ErrorDisplay.css +365 -0
- package/app/client/src/components/ErrorDisplay.tsx +258 -0
- package/app/client/src/components/FluxStackConfig.tsx +1321 -0
- package/app/client/src/components/HybridLiveCounter.tsx +140 -0
- package/app/client/src/components/LiveClock.tsx +286 -0
- package/app/client/src/components/MainLayout.tsx +390 -0
- package/app/client/src/components/SidebarNavigation.tsx +391 -0
- package/app/client/src/components/StateDemo.tsx +178 -0
- package/app/client/src/components/SystemMonitor.tsx +1038 -0
- package/app/client/src/components/Teste.tsx +104 -0
- package/app/client/src/components/UserProfile.tsx +809 -0
- package/app/client/src/hooks/useAuth.ts +39 -0
- package/app/client/src/hooks/useNotifications.ts +56 -0
- package/app/client/src/lib/eden-api.ts +189 -53
- package/app/client/src/lib/errors.ts +340 -0
- package/app/client/src/lib/hooks/useErrorHandler.ts +258 -0
- package/app/client/src/lib/index.ts +45 -0
- package/app/client/src/main.tsx +3 -2
- package/app/client/src/pages/ApiDocs.tsx +182 -0
- package/app/client/src/pages/Demo.tsx +174 -0
- package/app/client/src/pages/HybridLive.tsx +263 -0
- package/app/client/src/pages/Overview.tsx +155 -0
- package/app/client/src/store/README.md +43 -0
- package/app/client/src/store/index.ts +16 -0
- package/app/client/src/store/slices/uiSlice.ts +151 -0
- package/app/client/src/store/slices/userSlice.ts +161 -0
- package/app/client/src/test/README.md +257 -0
- package/app/client/src/test/setup.ts +70 -0
- package/app/client/src/test/types.ts +12 -0
- package/app/client/src/vite-env.d.ts +1 -1
- package/app/client/tsconfig.app.json +44 -43
- package/app/client/tsconfig.json +7 -7
- package/app/client/tsconfig.node.json +25 -25
- package/app/client/zustand-setup.md +65 -0
- package/app/server/controllers/users.controller.ts +68 -68
- package/app/server/index.ts +9 -1
- package/app/server/live/CounterComponent.ts +191 -0
- package/app/server/live/FluxStackConfig.ts +529 -0
- package/app/server/live/LiveClockComponent.ts +214 -0
- package/app/server/live/SidebarNavigation.ts +156 -0
- package/app/server/live/SystemMonitor.ts +594 -0
- package/app/server/live/SystemMonitorIntegration.ts +151 -0
- package/app/server/live/TesteComponent.ts +87 -0
- package/app/server/live/UserProfileComponent.ts +135 -0
- package/app/server/live/register-components.ts +28 -0
- package/app/server/middleware/auth.ts +136 -0
- package/app/server/middleware/errorHandling.ts +250 -0
- package/app/server/middleware/index.ts +10 -0
- package/app/server/middleware/rateLimit.ts +193 -0
- package/app/server/middleware/requestLogging.ts +215 -0
- package/app/server/middleware/validation.ts +270 -0
- package/app/server/routes/index.ts +14 -2
- package/app/server/routes/upload.ts +92 -0
- package/app/server/routes/users.routes.ts +2 -9
- package/app/server/services/NotificationService.ts +302 -0
- package/app/server/services/UserService.ts +222 -0
- package/app/server/services/index.ts +46 -0
- package/core/cli/commands/plugin-deps.ts +263 -0
- package/core/cli/generators/README.md +339 -0
- package/core/cli/generators/component.ts +770 -0
- package/core/cli/generators/controller.ts +299 -0
- package/core/cli/generators/index.ts +144 -0
- package/core/cli/generators/interactive.ts +228 -0
- package/core/cli/generators/prompts.ts +83 -0
- package/core/cli/generators/route.ts +513 -0
- package/core/cli/generators/service.ts +465 -0
- package/core/cli/generators/template-engine.ts +154 -0
- package/core/cli/generators/types.ts +71 -0
- package/core/cli/generators/utils.ts +192 -0
- package/core/cli/index.ts +69 -0
- package/core/cli/plugin-discovery.ts +16 -85
- package/core/client/fluxstack.ts +17 -0
- package/core/client/hooks/index.ts +7 -0
- package/core/client/hooks/state-validator.ts +130 -0
- package/core/client/hooks/useAuth.ts +49 -0
- package/core/client/hooks/useChunkedUpload.ts +258 -0
- package/core/client/hooks/useHybridLiveComponent.ts +967 -0
- package/core/client/hooks/useWebSocket.ts +373 -0
- package/core/client/index.ts +47 -0
- package/core/client/state/createStore.ts +193 -0
- package/core/client/state/index.ts +15 -0
- package/core/config/env-dynamic.ts +1 -1
- package/core/config/env.ts +2 -1
- package/core/config/runtime-config.ts +3 -3
- package/core/config/schema.ts +84 -49
- package/core/framework/server.ts +30 -0
- package/core/index.ts +25 -0
- package/core/live/ComponentRegistry.ts +399 -0
- package/core/live/types.ts +164 -0
- package/core/plugins/built-in/live-components/commands/create-live-component.ts +1201 -0
- package/core/plugins/built-in/live-components/index.ts +27 -0
- package/core/plugins/built-in/logger/index.ts +1 -1
- package/core/plugins/built-in/monitoring/index.ts +1 -1
- package/core/plugins/built-in/static/index.ts +1 -1
- package/core/plugins/built-in/swagger/index.ts +1 -1
- package/core/plugins/built-in/vite/index.ts +1 -1
- package/core/plugins/dependency-manager.ts +384 -0
- package/core/plugins/index.ts +5 -1
- package/core/plugins/manager.ts +7 -3
- package/core/plugins/registry.ts +88 -10
- package/core/plugins/types.ts +11 -11
- package/core/server/framework.ts +43 -0
- package/core/server/index.ts +11 -1
- package/core/server/live/ComponentRegistry.ts +1017 -0
- package/core/server/live/FileUploadManager.ts +272 -0
- package/core/server/live/LiveComponentPerformanceMonitor.ts +930 -0
- package/core/server/live/SingleConnectionManager.ts +0 -0
- package/core/server/live/StateSignature.ts +644 -0
- package/core/server/live/WebSocketConnectionManager.ts +688 -0
- package/core/server/live/websocket-plugin.ts +435 -0
- package/core/server/middleware/errorHandling.ts +141 -0
- package/core/server/middleware/index.ts +16 -0
- package/core/server/plugins/static-files-plugin.ts +232 -0
- package/core/server/services/BaseService.ts +95 -0
- package/core/server/services/ServiceContainer.ts +144 -0
- package/core/server/services/index.ts +9 -0
- package/core/templates/create-project.ts +46 -2
- package/core/testing/index.ts +10 -0
- package/core/testing/setup.ts +74 -0
- package/core/types/build.ts +38 -14
- package/core/types/types.ts +319 -0
- package/core/utils/env-runtime.ts +7 -0
- package/core/utils/errors/handlers.ts +264 -39
- package/core/utils/errors/index.ts +528 -18
- package/core/utils/errors/middleware.ts +114 -0
- package/core/utils/logger/formatters.ts +222 -0
- package/core/utils/logger/index.ts +167 -48
- package/core/utils/logger/middleware.ts +253 -0
- package/core/utils/logger/performance.ts +384 -0
- package/core/utils/logger/transports.ts +365 -0
- package/create-fluxstack.ts +296 -296
- package/fluxstack.config.ts +17 -1
- package/package-template.json +66 -66
- package/package.json +31 -6
- package/public/README.md +16 -0
- package/vite.config.ts +29 -14
- package/.claude/settings.local.json +0 -74
- package/.github/workflows/ci-build-tests.yml +0 -480
- package/.github/workflows/dependency-management.yml +0 -324
- package/.github/workflows/release-validation.yml +0 -355
- package/.kiro/specs/fluxstack-architecture-optimization/design.md +0 -700
- package/.kiro/specs/fluxstack-architecture-optimization/requirements.md +0 -127
- package/.kiro/specs/fluxstack-architecture-optimization/tasks.md +0 -330
- package/CLAUDE.md +0 -200
- package/Dockerfile +0 -58
- package/Dockerfile.backend +0 -52
- package/Dockerfile.frontend +0 -54
- package/README-Docker.md +0 -85
- package/ai-context/00-QUICK-START.md +0 -86
- package/ai-context/README.md +0 -88
- package/ai-context/development/eden-treaty-guide.md +0 -362
- package/ai-context/development/patterns.md +0 -382
- package/ai-context/development/plugins-guide.md +0 -572
- package/ai-context/examples/crud-complete.md +0 -626
- package/ai-context/project/architecture.md +0 -399
- package/ai-context/project/overview.md +0 -213
- package/ai-context/recent-changes/eden-treaty-refactor.md +0 -281
- package/ai-context/recent-changes/type-inference-fix.md +0 -223
- package/ai-context/reference/environment-vars.md +0 -384
- package/ai-context/reference/troubleshooting.md +0 -407
- package/app/client/src/components/TestPage.tsx +0 -453
- package/bun.lock +0 -1063
- package/bunfig.toml +0 -16
- package/core/__tests__/integration.test.ts +0 -227
- package/core/build/index.ts +0 -186
- package/core/config/__tests__/config-loader.test.ts +0 -554
- package/core/config/__tests__/config-merger.test.ts +0 -657
- package/core/config/__tests__/env-converter.test.ts +0 -372
- package/core/config/__tests__/env-processor.test.ts +0 -431
- package/core/config/__tests__/env.test.ts +0 -452
- package/core/config/__tests__/integration.test.ts +0 -418
- package/core/config/__tests__/loader.test.ts +0 -331
- package/core/config/__tests__/schema.test.ts +0 -129
- package/core/config/__tests__/validator.test.ts +0 -318
- package/core/framework/__tests__/server.test.ts +0 -233
- package/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
- package/core/plugins/__tests__/manager.test.ts +0 -398
- package/core/plugins/__tests__/monitoring.test.ts +0 -401
- package/core/plugins/__tests__/registry.test.ts +0 -335
- package/core/utils/__tests__/errors.test.ts +0 -139
- package/core/utils/__tests__/helpers.test.ts +0 -297
- package/core/utils/__tests__/logger.test.ts +0 -141
- package/create-test-app.ts +0 -156
- package/docker-compose.microservices.yml +0 -75
- package/docker-compose.simple.yml +0 -57
- package/docker-compose.yml +0 -71
- package/eslint.config.js +0 -23
- package/flux-cli.ts +0 -214
- package/nginx-lb.conf +0 -37
- package/publish.sh +0 -63
- package/run-clean.ts +0 -26
- package/run-env-tests.ts +0 -313
- package/tailwind.config.js +0 -34
- package/tests/__mocks__/api.ts +0 -56
- package/tests/fixtures/users.ts +0 -69
- package/tests/integration/api/users.routes.test.ts +0 -221
- package/tests/setup.ts +0 -29
- package/tests/unit/app/client/App-simple.test.tsx +0 -56
- package/tests/unit/app/client/App.test.tsx.skip +0 -237
- package/tests/unit/app/client/eden-api.test.ts +0 -186
- package/tests/unit/app/client/simple.test.tsx +0 -23
- package/tests/unit/app/controllers/users.controller.test.ts +0 -150
- package/tests/unit/core/create-project.test.ts.skip +0 -95
- package/tests/unit/core/framework.test.ts +0 -144
- package/tests/unit/core/plugins/logger.test.ts.skip +0 -268
- package/tests/unit/core/plugins/vite.test.ts.disabled +0 -188
- package/tests/utils/test-helpers.ts +0 -61
- package/vitest.config.ts +0 -50
- package/workspace.json +0 -6
package/core/config/schema.ts
CHANGED
|
@@ -66,10 +66,19 @@ export interface OptimizationConfig {
|
|
|
66
66
|
|
|
67
67
|
export interface BuildConfig {
|
|
68
68
|
target: BuildTarget
|
|
69
|
+
mode?: 'development' | 'production' | 'test'
|
|
69
70
|
outDir: string
|
|
70
71
|
optimization: OptimizationConfig
|
|
71
72
|
sourceMaps: boolean
|
|
73
|
+
minify: boolean
|
|
74
|
+
treeshake: boolean
|
|
75
|
+
compress?: boolean
|
|
76
|
+
removeUnusedCSS?: boolean
|
|
77
|
+
optimizeImages?: boolean
|
|
78
|
+
bundleAnalysis?: boolean
|
|
72
79
|
clean: boolean
|
|
80
|
+
optimize?: boolean
|
|
81
|
+
external?: string[]
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
export interface LogTransportConfig {
|
|
@@ -153,31 +162,31 @@ export interface StorageConfig {
|
|
|
153
162
|
export interface FluxStackConfig {
|
|
154
163
|
// Core settings
|
|
155
164
|
app: AppConfig
|
|
156
|
-
|
|
165
|
+
|
|
157
166
|
// Server configuration
|
|
158
167
|
server: ServerConfig
|
|
159
|
-
|
|
168
|
+
|
|
160
169
|
// Client configuration
|
|
161
170
|
client: ClientConfig
|
|
162
|
-
|
|
171
|
+
|
|
163
172
|
// Build configuration
|
|
164
173
|
build: BuildConfig
|
|
165
|
-
|
|
174
|
+
|
|
166
175
|
// Plugin configuration
|
|
167
176
|
plugins: PluginConfig
|
|
168
|
-
|
|
177
|
+
|
|
169
178
|
// Logging configuration
|
|
170
179
|
logging: LoggingConfig
|
|
171
|
-
|
|
180
|
+
|
|
172
181
|
// Monitoring configuration
|
|
173
182
|
monitoring: MonitoringConfig
|
|
174
|
-
|
|
183
|
+
|
|
175
184
|
// Optional service configurations
|
|
176
185
|
database?: DatabaseConfig
|
|
177
186
|
auth?: AuthConfig
|
|
178
187
|
email?: EmailConfig
|
|
179
188
|
storage?: StorageConfig
|
|
180
|
-
|
|
189
|
+
|
|
181
190
|
// Environment-specific overrides
|
|
182
191
|
environments?: {
|
|
183
192
|
development?: Partial<FluxStackConfig>
|
|
@@ -185,7 +194,7 @@ export interface FluxStackConfig {
|
|
|
185
194
|
test?: Partial<FluxStackConfig>
|
|
186
195
|
[key: string]: Partial<FluxStackConfig> | undefined
|
|
187
196
|
}
|
|
188
|
-
|
|
197
|
+
|
|
189
198
|
// Custom configuration
|
|
190
199
|
custom?: Record<string, any>
|
|
191
200
|
}
|
|
@@ -197,17 +206,17 @@ export const fluxStackConfigSchema = {
|
|
|
197
206
|
app: {
|
|
198
207
|
type: 'object',
|
|
199
208
|
properties: {
|
|
200
|
-
name: {
|
|
201
|
-
type: 'string',
|
|
209
|
+
name: {
|
|
210
|
+
type: 'string',
|
|
202
211
|
minLength: 1,
|
|
203
212
|
description: 'Application name'
|
|
204
213
|
},
|
|
205
|
-
version: {
|
|
206
|
-
type: 'string',
|
|
214
|
+
version: {
|
|
215
|
+
type: 'string',
|
|
207
216
|
pattern: '^\\d+\\.\\d+\\.\\d+',
|
|
208
217
|
description: 'Application version (semver format)'
|
|
209
218
|
},
|
|
210
|
-
description: {
|
|
219
|
+
description: {
|
|
211
220
|
type: 'string',
|
|
212
221
|
description: 'Application description'
|
|
213
222
|
}
|
|
@@ -215,22 +224,22 @@ export const fluxStackConfigSchema = {
|
|
|
215
224
|
required: ['name', 'version'],
|
|
216
225
|
additionalProperties: false
|
|
217
226
|
},
|
|
218
|
-
|
|
227
|
+
|
|
219
228
|
server: {
|
|
220
229
|
type: 'object',
|
|
221
230
|
properties: {
|
|
222
|
-
port: {
|
|
223
|
-
type: 'number',
|
|
224
|
-
minimum: 1,
|
|
231
|
+
port: {
|
|
232
|
+
type: 'number',
|
|
233
|
+
minimum: 1,
|
|
225
234
|
maximum: 65535,
|
|
226
235
|
description: 'Server port number'
|
|
227
236
|
},
|
|
228
|
-
host: {
|
|
237
|
+
host: {
|
|
229
238
|
type: 'string',
|
|
230
239
|
description: 'Server host address'
|
|
231
240
|
},
|
|
232
|
-
apiPrefix: {
|
|
233
|
-
type: 'string',
|
|
241
|
+
apiPrefix: {
|
|
242
|
+
type: 'string',
|
|
234
243
|
pattern: '^/',
|
|
235
244
|
description: 'API route prefix'
|
|
236
245
|
},
|
|
@@ -245,7 +254,7 @@ export const fluxStackConfigSchema = {
|
|
|
245
254
|
},
|
|
246
255
|
methods: {
|
|
247
256
|
type: 'array',
|
|
248
|
-
items: {
|
|
257
|
+
items: {
|
|
249
258
|
type: 'string',
|
|
250
259
|
enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD']
|
|
251
260
|
},
|
|
@@ -286,13 +295,13 @@ export const fluxStackConfigSchema = {
|
|
|
286
295
|
required: ['port', 'host', 'apiPrefix', 'cors', 'middleware'],
|
|
287
296
|
additionalProperties: false
|
|
288
297
|
},
|
|
289
|
-
|
|
298
|
+
|
|
290
299
|
client: {
|
|
291
300
|
type: 'object',
|
|
292
301
|
properties: {
|
|
293
|
-
port: {
|
|
294
|
-
type: 'number',
|
|
295
|
-
minimum: 1,
|
|
302
|
+
port: {
|
|
303
|
+
type: 'number',
|
|
304
|
+
minimum: 1,
|
|
296
305
|
maximum: 65535,
|
|
297
306
|
description: 'Client development server port'
|
|
298
307
|
},
|
|
@@ -301,7 +310,7 @@ export const fluxStackConfigSchema = {
|
|
|
301
310
|
properties: {
|
|
302
311
|
target: { type: 'string' },
|
|
303
312
|
changeOrigin: { type: 'boolean' },
|
|
304
|
-
pathRewrite: {
|
|
313
|
+
pathRewrite: {
|
|
305
314
|
type: 'object',
|
|
306
315
|
additionalProperties: { type: 'string' }
|
|
307
316
|
}
|
|
@@ -324,7 +333,7 @@ export const fluxStackConfigSchema = {
|
|
|
324
333
|
required: ['port', 'proxy', 'build'],
|
|
325
334
|
additionalProperties: false
|
|
326
335
|
},
|
|
327
|
-
|
|
336
|
+
|
|
328
337
|
build: {
|
|
329
338
|
type: 'object',
|
|
330
339
|
properties: {
|
|
@@ -333,10 +342,15 @@ export const fluxStackConfigSchema = {
|
|
|
333
342
|
enum: ['bun', 'node', 'docker'],
|
|
334
343
|
description: 'Build target runtime'
|
|
335
344
|
},
|
|
336
|
-
outDir: {
|
|
345
|
+
outDir: {
|
|
337
346
|
type: 'string',
|
|
338
347
|
description: 'Build output directory'
|
|
339
348
|
},
|
|
349
|
+
mode: {
|
|
350
|
+
type: 'string',
|
|
351
|
+
enum: ['development', 'production', 'test'],
|
|
352
|
+
description: 'Build mode'
|
|
353
|
+
},
|
|
340
354
|
optimization: {
|
|
341
355
|
type: 'object',
|
|
342
356
|
properties: {
|
|
@@ -350,12 +364,24 @@ export const fluxStackConfigSchema = {
|
|
|
350
364
|
additionalProperties: false
|
|
351
365
|
},
|
|
352
366
|
sourceMaps: { type: 'boolean' },
|
|
353
|
-
|
|
367
|
+
minify: { type: 'boolean' },
|
|
368
|
+
treeshake: { type: 'boolean' },
|
|
369
|
+
compress: { type: 'boolean' },
|
|
370
|
+
removeUnusedCSS: { type: 'boolean' },
|
|
371
|
+
optimizeImages: { type: 'boolean' },
|
|
372
|
+
bundleAnalysis: { type: 'boolean' },
|
|
373
|
+
clean: { type: 'boolean' },
|
|
374
|
+
optimize: { type: 'boolean' },
|
|
375
|
+
external: {
|
|
376
|
+
type: 'array',
|
|
377
|
+
items: { type: 'string' },
|
|
378
|
+
description: 'External dependencies to exclude from bundle'
|
|
379
|
+
}
|
|
354
380
|
},
|
|
355
|
-
required: ['target', 'outDir', 'optimization', 'sourceMaps', 'clean'],
|
|
381
|
+
required: ['target', 'outDir', 'optimization', 'sourceMaps', 'minify', 'treeshake', 'clean'],
|
|
356
382
|
additionalProperties: false
|
|
357
383
|
},
|
|
358
|
-
|
|
384
|
+
|
|
359
385
|
plugins: {
|
|
360
386
|
type: 'object',
|
|
361
387
|
properties: {
|
|
@@ -377,7 +403,7 @@ export const fluxStackConfigSchema = {
|
|
|
377
403
|
required: ['enabled', 'disabled', 'config'],
|
|
378
404
|
additionalProperties: false
|
|
379
405
|
},
|
|
380
|
-
|
|
406
|
+
|
|
381
407
|
logging: {
|
|
382
408
|
type: 'object',
|
|
383
409
|
properties: {
|
|
@@ -419,7 +445,7 @@ export const fluxStackConfigSchema = {
|
|
|
419
445
|
required: ['level', 'format', 'transports'],
|
|
420
446
|
additionalProperties: false
|
|
421
447
|
},
|
|
422
|
-
|
|
448
|
+
|
|
423
449
|
monitoring: {
|
|
424
450
|
type: 'object',
|
|
425
451
|
properties: {
|
|
@@ -455,7 +481,7 @@ export const fluxStackConfigSchema = {
|
|
|
455
481
|
required: ['enabled', 'metrics', 'profiling', 'exporters'],
|
|
456
482
|
additionalProperties: false
|
|
457
483
|
},
|
|
458
|
-
|
|
484
|
+
|
|
459
485
|
// Optional configurations
|
|
460
486
|
database: {
|
|
461
487
|
type: 'object',
|
|
@@ -471,7 +497,7 @@ export const fluxStackConfigSchema = {
|
|
|
471
497
|
},
|
|
472
498
|
additionalProperties: false
|
|
473
499
|
},
|
|
474
|
-
|
|
500
|
+
|
|
475
501
|
auth: {
|
|
476
502
|
type: 'object',
|
|
477
503
|
properties: {
|
|
@@ -482,7 +508,7 @@ export const fluxStackConfigSchema = {
|
|
|
482
508
|
},
|
|
483
509
|
additionalProperties: false
|
|
484
510
|
},
|
|
485
|
-
|
|
511
|
+
|
|
486
512
|
email: {
|
|
487
513
|
type: 'object',
|
|
488
514
|
properties: {
|
|
@@ -495,7 +521,7 @@ export const fluxStackConfigSchema = {
|
|
|
495
521
|
},
|
|
496
522
|
additionalProperties: false
|
|
497
523
|
},
|
|
498
|
-
|
|
524
|
+
|
|
499
525
|
storage: {
|
|
500
526
|
type: 'object',
|
|
501
527
|
properties: {
|
|
@@ -513,7 +539,7 @@ export const fluxStackConfigSchema = {
|
|
|
513
539
|
},
|
|
514
540
|
additionalProperties: false
|
|
515
541
|
},
|
|
516
|
-
|
|
542
|
+
|
|
517
543
|
environments: {
|
|
518
544
|
type: 'object',
|
|
519
545
|
additionalProperties: {
|
|
@@ -521,7 +547,7 @@ export const fluxStackConfigSchema = {
|
|
|
521
547
|
type: 'object'
|
|
522
548
|
}
|
|
523
549
|
},
|
|
524
|
-
|
|
550
|
+
|
|
525
551
|
custom: {
|
|
526
552
|
type: 'object',
|
|
527
553
|
description: 'Custom application-specific configuration'
|
|
@@ -538,7 +564,7 @@ export const defaultFluxStackConfig: FluxStackConfig = {
|
|
|
538
564
|
version: '1.0.0',
|
|
539
565
|
description: 'A FluxStack application'
|
|
540
566
|
},
|
|
541
|
-
|
|
567
|
+
|
|
542
568
|
server: {
|
|
543
569
|
port: 3000,
|
|
544
570
|
host: 'localhost',
|
|
@@ -552,7 +578,7 @@ export const defaultFluxStackConfig: FluxStackConfig = {
|
|
|
552
578
|
},
|
|
553
579
|
middleware: []
|
|
554
580
|
},
|
|
555
|
-
|
|
581
|
+
|
|
556
582
|
client: {
|
|
557
583
|
port: 5173,
|
|
558
584
|
proxy: {
|
|
@@ -566,9 +592,10 @@ export const defaultFluxStackConfig: FluxStackConfig = {
|
|
|
566
592
|
outDir: 'dist/client'
|
|
567
593
|
}
|
|
568
594
|
},
|
|
569
|
-
|
|
595
|
+
|
|
570
596
|
build: {
|
|
571
597
|
target: 'bun',
|
|
598
|
+
mode: 'production',
|
|
572
599
|
outDir: 'dist',
|
|
573
600
|
optimization: {
|
|
574
601
|
minify: true,
|
|
@@ -578,15 +605,23 @@ export const defaultFluxStackConfig: FluxStackConfig = {
|
|
|
578
605
|
bundleAnalyzer: false
|
|
579
606
|
},
|
|
580
607
|
sourceMaps: true,
|
|
581
|
-
|
|
608
|
+
minify: true,
|
|
609
|
+
treeshake: true,
|
|
610
|
+
compress: true,
|
|
611
|
+
removeUnusedCSS: false,
|
|
612
|
+
optimizeImages: false,
|
|
613
|
+
bundleAnalysis: false,
|
|
614
|
+
clean: true,
|
|
615
|
+
optimize: true,
|
|
616
|
+
external: []
|
|
582
617
|
},
|
|
583
|
-
|
|
618
|
+
|
|
584
619
|
plugins: {
|
|
585
620
|
enabled: ['logger', 'swagger', 'vite', 'cors'],
|
|
586
621
|
disabled: [],
|
|
587
622
|
config: {}
|
|
588
623
|
},
|
|
589
|
-
|
|
624
|
+
|
|
590
625
|
logging: {
|
|
591
626
|
level: 'info',
|
|
592
627
|
format: 'pretty',
|
|
@@ -598,7 +633,7 @@ export const defaultFluxStackConfig: FluxStackConfig = {
|
|
|
598
633
|
}
|
|
599
634
|
]
|
|
600
635
|
},
|
|
601
|
-
|
|
636
|
+
|
|
602
637
|
monitoring: {
|
|
603
638
|
enabled: false,
|
|
604
639
|
metrics: {
|
|
@@ -638,7 +673,7 @@ export const environmentDefaults = {
|
|
|
638
673
|
}
|
|
639
674
|
}
|
|
640
675
|
},
|
|
641
|
-
|
|
676
|
+
|
|
642
677
|
production: {
|
|
643
678
|
logging: {
|
|
644
679
|
level: 'warn' as LogLevel,
|
|
@@ -678,7 +713,7 @@ export const environmentDefaults = {
|
|
|
678
713
|
}
|
|
679
714
|
}
|
|
680
715
|
},
|
|
681
|
-
|
|
716
|
+
|
|
682
717
|
test: {
|
|
683
718
|
logging: {
|
|
684
719
|
level: 'error' as LogLevel,
|
package/core/framework/server.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Elysia } from "elysia"
|
|
|
2
2
|
import type { FluxStackConfig, FluxStackContext } from "../types"
|
|
3
3
|
import type { Plugin, PluginContext, PluginUtils } from "../plugins/types"
|
|
4
4
|
import { PluginRegistry } from "../plugins/registry"
|
|
5
|
+
import { PluginManager } from "../plugins/manager"
|
|
5
6
|
import { getConfigSync, getEnvironmentInfo } from "../config"
|
|
6
7
|
import { logger } from "../utils/logger"
|
|
7
8
|
import { createErrorHandler } from "../utils/errors/handlers"
|
|
@@ -11,6 +12,7 @@ export class FluxStackFramework {
|
|
|
11
12
|
private app: Elysia
|
|
12
13
|
private context: FluxStackContext
|
|
13
14
|
private pluginRegistry: PluginRegistry
|
|
15
|
+
private pluginManager: PluginManager
|
|
14
16
|
private pluginContext: PluginContext
|
|
15
17
|
private isStarted: boolean = false
|
|
16
18
|
|
|
@@ -29,6 +31,8 @@ export class FluxStackFramework {
|
|
|
29
31
|
|
|
30
32
|
this.app = new Elysia()
|
|
31
33
|
this.pluginRegistry = new PluginRegistry()
|
|
34
|
+
|
|
35
|
+
|
|
32
36
|
|
|
33
37
|
// Create plugin utilities
|
|
34
38
|
const pluginUtils: PluginUtils = {
|
|
@@ -83,6 +87,13 @@ export class FluxStackFramework {
|
|
|
83
87
|
utils: pluginUtils
|
|
84
88
|
}
|
|
85
89
|
|
|
90
|
+
// Initialize plugin manager
|
|
91
|
+
this.pluginManager = new PluginManager({
|
|
92
|
+
config: fullConfig,
|
|
93
|
+
logger: pluginLogger as any,
|
|
94
|
+
app: this.app
|
|
95
|
+
})
|
|
96
|
+
|
|
86
97
|
this.setupCors()
|
|
87
98
|
this.setupHooks()
|
|
88
99
|
this.setupErrorHandling()
|
|
@@ -91,6 +102,25 @@ export class FluxStackFramework {
|
|
|
91
102
|
environment: envInfo.name,
|
|
92
103
|
port: fullConfig.server.port
|
|
93
104
|
})
|
|
105
|
+
|
|
106
|
+
// Initialize automatic plugin discovery in background
|
|
107
|
+
this.initializeAutomaticPlugins().catch(error => {
|
|
108
|
+
logger.error('Failed to initialize automatic plugins', { error })
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private async initializeAutomaticPlugins() {
|
|
113
|
+
try {
|
|
114
|
+
await this.pluginManager.initialize()
|
|
115
|
+
const stats = this.pluginManager.getRegistry().getStats()
|
|
116
|
+
logger.framework('Automatic plugins loaded successfully', {
|
|
117
|
+
pluginCount: stats.totalPlugins,
|
|
118
|
+
enabledPlugins: stats.enabledPlugins,
|
|
119
|
+
disabledPlugins: stats.disabledPlugins
|
|
120
|
+
})
|
|
121
|
+
} catch (error) {
|
|
122
|
+
logger.error('Failed to initialize automatic plugins', { error })
|
|
123
|
+
}
|
|
94
124
|
}
|
|
95
125
|
|
|
96
126
|
private setupCors() {
|
package/core/index.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FluxStack Core
|
|
3
|
+
* Main exports for the FluxStack framework
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Server exports
|
|
7
|
+
export * from './server/services/index.js'
|
|
8
|
+
export * from './server/middleware/index.js'
|
|
9
|
+
|
|
10
|
+
// Client exports
|
|
11
|
+
export * from './client/state/index.js'
|
|
12
|
+
export * from './client/hooks/index.js'
|
|
13
|
+
|
|
14
|
+
// Testing exports
|
|
15
|
+
export * from './testing/index.js'
|
|
16
|
+
|
|
17
|
+
// Existing exports
|
|
18
|
+
export * from './build/index.js'
|
|
19
|
+
export * from './cli/generators/index.js'
|
|
20
|
+
export * from './config/index.js'
|
|
21
|
+
export * from './framework/server.js'
|
|
22
|
+
export * from './framework/client.js'
|
|
23
|
+
export * from './plugins/index.js'
|
|
24
|
+
export * from './utils/logger/index.js'
|
|
25
|
+
export * from './utils/errors/index.js'
|