create-fluxstack 1.10.1 → 1.12.0

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 (257) hide show
  1. package/.dockerignore +1 -2
  2. package/Dockerfile +8 -8
  3. package/LLMD/INDEX.md +64 -0
  4. package/LLMD/MAINTENANCE.md +197 -0
  5. package/LLMD/MIGRATION.md +156 -0
  6. package/LLMD/config/.gitkeep +1 -0
  7. package/LLMD/config/declarative-system.md +268 -0
  8. package/LLMD/config/environment-vars.md +327 -0
  9. package/LLMD/config/runtime-reload.md +401 -0
  10. package/LLMD/core/.gitkeep +1 -0
  11. package/LLMD/core/build-system.md +599 -0
  12. package/LLMD/core/framework-lifecycle.md +229 -0
  13. package/LLMD/core/plugin-system.md +451 -0
  14. package/LLMD/patterns/.gitkeep +1 -0
  15. package/LLMD/patterns/anti-patterns.md +297 -0
  16. package/LLMD/patterns/project-structure.md +264 -0
  17. package/LLMD/patterns/type-safety.md +440 -0
  18. package/LLMD/reference/.gitkeep +1 -0
  19. package/LLMD/reference/cli-commands.md +250 -0
  20. package/LLMD/reference/plugin-hooks.md +357 -0
  21. package/LLMD/reference/routing.md +39 -0
  22. package/LLMD/reference/troubleshooting.md +364 -0
  23. package/LLMD/resources/.gitkeep +1 -0
  24. package/LLMD/resources/controllers.md +465 -0
  25. package/LLMD/resources/live-components.md +703 -0
  26. package/LLMD/resources/live-rooms.md +482 -0
  27. package/LLMD/resources/live-upload.md +130 -0
  28. package/LLMD/resources/plugins-external.md +617 -0
  29. package/LLMD/resources/routes-eden.md +254 -0
  30. package/README.md +37 -17
  31. package/app/client/index.html +0 -1
  32. package/app/client/src/App.tsx +107 -150
  33. package/app/client/src/components/AppLayout.tsx +68 -0
  34. package/app/client/src/components/BackButton.tsx +13 -0
  35. package/app/client/src/components/DemoPage.tsx +20 -0
  36. package/app/client/src/components/LiveUploadWidget.tsx +204 -0
  37. package/app/client/src/lib/eden-api.ts +85 -60
  38. package/app/client/src/live/ChatDemo.tsx +107 -0
  39. package/app/client/src/live/CounterDemo.tsx +206 -0
  40. package/app/client/src/live/FormDemo.tsx +119 -0
  41. package/app/client/src/live/RoomChatDemo.tsx +242 -0
  42. package/app/client/src/live/UploadDemo.tsx +21 -0
  43. package/app/client/src/main.tsx +4 -1
  44. package/app/client/src/pages/ApiTestPage.tsx +108 -0
  45. package/app/client/src/pages/HomePage.tsx +76 -0
  46. package/app/server/app.ts +1 -4
  47. package/app/server/controllers/users.controller.ts +36 -44
  48. package/app/server/index.ts +25 -35
  49. package/app/server/live/LiveChat.ts +77 -0
  50. package/app/server/live/LiveCounter.ts +67 -0
  51. package/app/server/live/LiveForm.ts +63 -0
  52. package/app/server/live/LiveLocalCounter.ts +32 -0
  53. package/app/server/live/LiveRoomChat.ts +285 -0
  54. package/app/server/live/LiveUpload.ts +81 -0
  55. package/app/server/routes/index.ts +3 -1
  56. package/app/server/routes/room.routes.ts +117 -0
  57. package/app/server/routes/users.routes.ts +35 -27
  58. package/app/shared/types/index.ts +14 -2
  59. package/config/app.config.ts +2 -62
  60. package/config/client.config.ts +2 -95
  61. package/config/database.config.ts +2 -99
  62. package/config/fluxstack.config.ts +25 -45
  63. package/config/index.ts +57 -38
  64. package/config/monitoring.config.ts +2 -114
  65. package/config/plugins.config.ts +2 -80
  66. package/config/server.config.ts +2 -68
  67. package/config/services.config.ts +2 -130
  68. package/config/system/app.config.ts +29 -0
  69. package/config/system/build.config.ts +49 -0
  70. package/config/system/client.config.ts +68 -0
  71. package/config/system/database.config.ts +17 -0
  72. package/config/system/fluxstack.config.ts +114 -0
  73. package/config/{logger.config.ts → system/logger.config.ts} +3 -1
  74. package/config/system/monitoring.config.ts +114 -0
  75. package/config/system/plugins.config.ts +84 -0
  76. package/config/{runtime.config.ts → system/runtime.config.ts} +1 -1
  77. package/config/system/server.config.ts +68 -0
  78. package/config/system/services.config.ts +46 -0
  79. package/config/{system.config.ts → system/system.config.ts} +1 -1
  80. package/core/build/flux-plugins-generator.ts +325 -325
  81. package/core/build/index.ts +39 -27
  82. package/core/build/live-components-generator.ts +3 -3
  83. package/core/build/optimizer.ts +235 -235
  84. package/core/cli/command-registry.ts +6 -4
  85. package/core/cli/commands/build.ts +79 -0
  86. package/core/cli/commands/create.ts +54 -0
  87. package/core/cli/commands/dev.ts +101 -0
  88. package/core/cli/commands/help.ts +34 -0
  89. package/core/cli/commands/index.ts +34 -0
  90. package/core/cli/commands/make-plugin.ts +90 -0
  91. package/core/cli/commands/plugin-add.ts +197 -0
  92. package/core/cli/commands/plugin-deps.ts +2 -2
  93. package/core/cli/commands/plugin-list.ts +208 -0
  94. package/core/cli/commands/plugin-remove.ts +170 -0
  95. package/core/cli/generators/component.ts +769 -769
  96. package/core/cli/generators/controller.ts +1 -1
  97. package/core/cli/generators/index.ts +146 -146
  98. package/core/cli/generators/interactive.ts +227 -227
  99. package/core/cli/generators/plugin.ts +2 -2
  100. package/core/cli/generators/prompts.ts +82 -82
  101. package/core/cli/generators/route.ts +6 -6
  102. package/core/cli/generators/service.ts +2 -2
  103. package/core/cli/generators/template-engine.ts +4 -3
  104. package/core/cli/generators/types.ts +2 -2
  105. package/core/cli/generators/utils.ts +191 -191
  106. package/core/cli/index.ts +115 -686
  107. package/core/cli/plugin-discovery.ts +2 -2
  108. package/core/client/LiveComponentsProvider.tsx +60 -8
  109. package/core/client/api/eden.ts +183 -0
  110. package/core/client/api/index.ts +11 -0
  111. package/core/client/components/Live.tsx +104 -0
  112. package/core/client/fluxstack.ts +1 -9
  113. package/core/client/hooks/AdaptiveChunkSizer.ts +215 -215
  114. package/core/client/hooks/state-validator.ts +1 -1
  115. package/core/client/hooks/useAuth.ts +48 -48
  116. package/core/client/hooks/useChunkedUpload.ts +85 -35
  117. package/core/client/hooks/useLiveChunkedUpload.ts +87 -0
  118. package/core/client/hooks/useLiveComponent.ts +800 -0
  119. package/core/client/hooks/useLiveUpload.ts +71 -0
  120. package/core/client/hooks/useRoom.ts +409 -0
  121. package/core/client/hooks/useRoomProxy.ts +382 -0
  122. package/core/client/index.ts +17 -68
  123. package/core/client/standalone-entry.ts +8 -0
  124. package/core/client/standalone.ts +74 -53
  125. package/core/client/state/createStore.ts +192 -192
  126. package/core/client/state/index.ts +14 -14
  127. package/core/config/index.ts +70 -291
  128. package/core/config/schema.ts +42 -723
  129. package/core/framework/client.ts +131 -131
  130. package/core/framework/index.ts +7 -7
  131. package/core/framework/server.ts +47 -40
  132. package/core/framework/types.ts +2 -2
  133. package/core/index.ts +23 -4
  134. package/core/live/ComponentRegistry.ts +3 -3
  135. package/core/live/types.ts +77 -0
  136. package/core/plugins/built-in/index.ts +134 -134
  137. package/core/plugins/built-in/live-components/commands/create-live-component.ts +242 -1066
  138. package/core/plugins/built-in/live-components/index.ts +1 -1
  139. package/core/plugins/built-in/monitoring/index.ts +111 -47
  140. package/core/plugins/built-in/static/index.ts +1 -1
  141. package/core/plugins/built-in/swagger/index.ts +68 -265
  142. package/core/plugins/built-in/vite/index.ts +85 -185
  143. package/core/plugins/built-in/vite/vite-dev.ts +10 -16
  144. package/core/plugins/config.ts +9 -7
  145. package/core/plugins/dependency-manager.ts +31 -1
  146. package/core/plugins/discovery.ts +19 -7
  147. package/core/plugins/executor.ts +2 -2
  148. package/core/plugins/index.ts +203 -203
  149. package/core/plugins/manager.ts +27 -39
  150. package/core/plugins/module-resolver.ts +19 -8
  151. package/core/plugins/registry.ts +255 -19
  152. package/core/plugins/types.ts +20 -53
  153. package/core/server/framework.ts +66 -43
  154. package/core/server/index.ts +15 -15
  155. package/core/server/live/ComponentRegistry.ts +78 -71
  156. package/core/server/live/FileUploadManager.ts +23 -10
  157. package/core/server/live/LiveComponentPerformanceMonitor.ts +1 -1
  158. package/core/server/live/LiveRoomManager.ts +261 -0
  159. package/core/server/live/RoomEventBus.ts +234 -0
  160. package/core/server/live/RoomStateManager.ts +172 -0
  161. package/core/server/live/StateSignature.ts +643 -643
  162. package/core/server/live/WebSocketConnectionManager.ts +30 -19
  163. package/core/server/live/auto-generated-components.ts +21 -9
  164. package/core/server/live/index.ts +14 -0
  165. package/core/server/live/websocket-plugin.ts +214 -67
  166. package/core/server/middleware/elysia-helpers.ts +7 -2
  167. package/core/server/middleware/errorHandling.ts +1 -1
  168. package/core/server/middleware/index.ts +31 -31
  169. package/core/server/plugins/database.ts +180 -180
  170. package/core/server/plugins/static-files-plugin.ts +69 -69
  171. package/core/server/plugins/swagger.ts +1 -1
  172. package/core/server/rooms/RoomBroadcaster.ts +357 -0
  173. package/core/server/rooms/RoomSystem.ts +463 -0
  174. package/core/server/rooms/index.ts +13 -0
  175. package/core/server/services/BaseService.ts +1 -1
  176. package/core/server/services/ServiceContainer.ts +1 -1
  177. package/core/server/services/index.ts +8 -8
  178. package/core/templates/create-project.ts +12 -12
  179. package/core/testing/index.ts +9 -9
  180. package/core/testing/setup.ts +73 -73
  181. package/core/types/api.ts +168 -168
  182. package/core/types/build.ts +219 -219
  183. package/core/types/config.ts +56 -26
  184. package/core/types/index.ts +4 -4
  185. package/core/types/plugin.ts +107 -107
  186. package/core/types/types.ts +353 -14
  187. package/core/utils/build-logger.ts +324 -324
  188. package/core/utils/config-schema.ts +480 -480
  189. package/core/utils/env.ts +2 -8
  190. package/core/utils/errors/codes.ts +114 -114
  191. package/core/utils/errors/handlers.ts +36 -1
  192. package/core/utils/errors/index.ts +49 -5
  193. package/core/utils/errors/middleware.ts +113 -113
  194. package/core/utils/helpers.ts +6 -16
  195. package/core/utils/index.ts +17 -17
  196. package/core/utils/logger/colors.ts +114 -114
  197. package/core/utils/logger/config.ts +13 -9
  198. package/core/utils/logger/formatter.ts +82 -82
  199. package/core/utils/logger/group-logger.ts +101 -101
  200. package/core/utils/logger/index.ts +6 -1
  201. package/core/utils/logger/stack-trace.ts +3 -1
  202. package/core/utils/logger/startup-banner.ts +82 -82
  203. package/core/utils/logger/winston-logger.ts +152 -152
  204. package/core/utils/monitoring/index.ts +211 -211
  205. package/core/utils/sync-version.ts +66 -66
  206. package/core/utils/version.ts +1 -1
  207. package/create-fluxstack.ts +8 -7
  208. package/package.json +12 -13
  209. package/plugins/crypto-auth/cli/make-protected-route.command.ts +1 -1
  210. package/plugins/crypto-auth/client/CryptoAuthClient.ts +302 -302
  211. package/plugins/crypto-auth/client/components/index.ts +11 -11
  212. package/plugins/crypto-auth/client/index.ts +11 -11
  213. package/plugins/crypto-auth/config/index.ts +1 -1
  214. package/plugins/crypto-auth/index.ts +4 -4
  215. package/plugins/crypto-auth/package.json +65 -65
  216. package/plugins/crypto-auth/server/AuthMiddleware.ts +1 -1
  217. package/plugins/crypto-auth/server/CryptoAuthService.ts +185 -185
  218. package/plugins/crypto-auth/server/index.ts +21 -21
  219. package/plugins/crypto-auth/server/middlewares/cryptoAuthAdmin.ts +3 -3
  220. package/plugins/crypto-auth/server/middlewares/cryptoAuthOptional.ts +1 -1
  221. package/plugins/crypto-auth/server/middlewares/cryptoAuthPermissions.ts +2 -2
  222. package/plugins/crypto-auth/server/middlewares/cryptoAuthRequired.ts +2 -2
  223. package/plugins/crypto-auth/server/middlewares/helpers.ts +1 -1
  224. package/plugins/crypto-auth/server/middlewares/index.ts +22 -22
  225. package/tsconfig.api-strict.json +16 -0
  226. package/tsconfig.json +48 -52
  227. package/{app/client/tsconfig.node.json → tsconfig.node.json} +25 -25
  228. package/types/global.d.ts +29 -29
  229. package/types/vitest.d.ts +8 -8
  230. package/vite.config.ts +38 -62
  231. package/vitest.config.live.ts +10 -9
  232. package/vitest.config.ts +29 -17
  233. package/app/client/README.md +0 -69
  234. package/app/client/SIMPLIFICATION.md +0 -140
  235. package/app/client/frontend-only.ts +0 -12
  236. package/app/client/src/live/FileUploadExample.tsx +0 -359
  237. package/app/client/src/live/MinimalLiveClock.tsx +0 -47
  238. package/app/client/src/live/QuickUploadTest.tsx +0 -193
  239. package/app/client/tsconfig.app.json +0 -45
  240. package/app/client/tsconfig.json +0 -7
  241. package/app/client/zustand-setup.md +0 -65
  242. package/app/server/backend-only.ts +0 -18
  243. package/app/server/live/LiveClockComponent.ts +0 -215
  244. package/app/server/live/LiveFileUploadComponent.ts +0 -77
  245. package/app/server/routes/env-test.ts +0 -110
  246. package/core/client/hooks/index.ts +0 -7
  247. package/core/client/hooks/useHybridLiveComponent.ts +0 -685
  248. package/core/client/hooks/useTypedLiveComponent.ts +0 -133
  249. package/core/client/hooks/useWebSocket.ts +0 -361
  250. package/core/config/env.ts +0 -546
  251. package/core/config/loader.ts +0 -522
  252. package/core/config/runtime-config.ts +0 -327
  253. package/core/config/validator.ts +0 -540
  254. package/core/server/backend-entry.ts +0 -51
  255. package/core/server/standalone.ts +0 -106
  256. package/core/utils/regenerate-files.ts +0 -69
  257. package/fluxstack.config.ts +0 -354
@@ -1,761 +1,80 @@
1
- /**
2
- * ⚠️ DEPRECATED - Enhanced Configuration Schema for FluxStack
3
- *
4
- * This file is DEPRECATED and maintained only for backward compatibility.
5
- * Please use the new modular config system from /config instead:
6
- *
7
- * ✅ NEW WAY:
8
- * ```ts
9
- * import { appConfig, serverConfig, clientConfig } from '@/config'
10
- * ```
11
- *
12
- * ❌ OLD WAY (DEPRECATED):
13
- * ```ts
14
- * import { FluxStackConfig } from '@/core/config/schema'
15
- * ```
16
- *
17
- * The modular system provides:
18
- * - Better organization (separated by domain)
19
- * - Automatic validation
20
- * - Type inference
21
- * - Laravel-style declarative schemas
22
- *
23
- * This file will be removed in a future version.
24
- * @deprecated Use /config modular system instead
25
- */
1
+ import { config as modernFluxStackConfig } from '@config/fluxstack.config'
26
2
 
3
+ export const defaultFluxStackConfig = modernFluxStackConfig
27
4
 
28
- export type LogLevel = 'debug' | 'info' | 'warn' | 'error'
29
- export type BuildTarget = 'bun' | 'node' | 'docker'
30
- export type LogFormat = 'json' | 'pretty'
31
- export type StorageType = 'localStorage' | 'sessionStorage'
32
-
33
- // Core configuration interfaces
34
- export interface AppConfig {
35
- name: string
36
- version: string
37
- description?: string
38
- }
39
-
40
- export interface CorsConfig {
41
- origins: string[]
42
- methods: string[]
43
- headers: string[]
44
- credentials?: boolean
45
- maxAge?: number
46
- }
47
-
48
- export interface MiddlewareConfig {
49
- name: string
50
- enabled: boolean
51
- config?: Record<string, any>
52
- }
53
-
54
- export interface ServerConfig {
55
- port: number
56
- host: string
57
- apiPrefix: string
58
- cors: CorsConfig
59
- middleware: MiddlewareConfig[]
60
- showBanner?: boolean // Show startup banner (default: true)
61
- }
62
-
63
- export interface ProxyConfig {
64
- target: string
65
- changeOrigin?: boolean
66
- pathRewrite?: Record<string, string>
67
- }
68
-
69
- export interface ClientBuildConfig {
70
- sourceMaps: boolean
71
- minify: boolean
72
- target: string
73
- outDir: string
74
- }
75
-
76
- export interface ClientConfig {
77
- port: number
78
- proxy: ProxyConfig
79
- build: ClientBuildConfig
80
- }
81
-
82
- export interface OptimizationConfig {
83
- minify: boolean
84
- treeshake: boolean
85
- compress: boolean
86
- splitChunks: boolean
87
- bundleAnalyzer: boolean
88
- }
89
-
90
- export interface BuildConfig {
91
- target: BuildTarget
92
- mode?: 'development' | 'production' | 'test'
93
- outDir: string
94
- optimization: OptimizationConfig
95
- sourceMaps: boolean
96
- minify: boolean
97
- treeshake: boolean
98
- compress?: boolean
99
- removeUnusedCSS?: boolean
100
- optimizeImages?: boolean
101
- bundleAnalysis?: boolean
102
- clean: boolean
103
- optimize?: boolean
104
- external?: string[]
105
- }
106
-
107
- export interface LogTransportConfig {
108
- type: 'console' | 'file' | 'http'
109
- level: LogLevel
110
- format: LogFormat
111
- options?: Record<string, any>
112
- }
113
-
114
- export interface LoggingConfig {
115
- level: LogLevel
116
- format: LogFormat
117
- transports: LogTransportConfig[]
118
- context?: Record<string, any>
119
- }
120
-
121
- export interface MetricsConfig {
122
- enabled: boolean
123
- collectInterval: number
124
- httpMetrics: boolean
125
- systemMetrics: boolean
126
- customMetrics: boolean
127
- }
128
-
129
- export interface ProfilingConfig {
130
- enabled: boolean
131
- sampleRate: number
132
- memoryProfiling: boolean
133
- cpuProfiling: boolean
134
- }
135
-
136
- export interface MonitoringConfig {
137
- enabled: boolean
138
- metrics: MetricsConfig
139
- profiling: ProfilingConfig
140
- exporters: string[]
141
- }
142
-
143
- export interface PluginConfig {
144
- enabled: string[]
145
- disabled: string[]
146
- config: Record<string, any>
147
- }
148
-
149
- export interface DatabaseConfig {
150
- url?: string
151
- host?: string
152
- port?: number
153
- database?: string
154
- user?: string
155
- password?: string
156
- ssl?: boolean
157
- poolSize?: number
158
- }
159
-
160
- export interface AuthConfig {
161
- secret?: string
162
- expiresIn?: string
163
- algorithm?: string
164
- issuer?: string
5
+ export const environmentDefaults = modernFluxStackConfig.environments ?? {
6
+ development: {},
7
+ production: {},
8
+ test: {}
165
9
  }
166
10
 
167
- export interface EmailConfig {
168
- host?: string
169
- port?: number
170
- user?: string
171
- password?: string
172
- secure?: boolean
173
- from?: string
174
- }
175
-
176
- export interface StorageConfig {
177
- uploadPath?: string
178
- maxFileSize?: number
179
- allowedTypes?: string[]
180
- provider?: 'local' | 's3' | 'gcs'
181
- config?: Record<string, any>
182
- }
183
-
184
- // Main configuration interface
185
- export interface FluxStackConfig {
186
- // Core settings
187
- app: AppConfig
188
-
189
- // Server configuration
190
- server: ServerConfig
191
-
192
- // Client configuration
193
- client: ClientConfig
194
-
195
- // Build configuration
196
- build: BuildConfig
197
-
198
- // Plugin configuration
199
- plugins: PluginConfig
200
-
201
- // Logging configuration
202
- logging: LoggingConfig
203
-
204
- // Monitoring configuration
205
- monitoring: MonitoringConfig
206
-
207
- // Optional service configurations
208
- database?: DatabaseConfig
209
- auth?: AuthConfig
210
- email?: EmailConfig
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
- }
221
-
222
- // Environment-specific overrides
223
- environments?: {
224
- development?: Partial<FluxStackConfig>
225
- production?: Partial<FluxStackConfig>
226
- test?: Partial<FluxStackConfig>
227
- [key: string]: Partial<FluxStackConfig> | undefined
228
- }
229
-
230
- // Custom configuration
231
- custom?: Record<string, any>
232
- }
233
-
234
- // JSON Schema for validation
235
11
  export const fluxStackConfigSchema = {
236
12
  type: 'object',
13
+ required: ['app', 'server', 'client', 'build', 'plugins', 'logging', 'monitoring'],
237
14
  properties: {
238
15
  app: {
239
16
  type: 'object',
240
- properties: {
241
- name: {
242
- type: 'string',
243
- minLength: 1,
244
- description: 'Application name'
245
- },
246
- version: {
247
- type: 'string',
248
- pattern: '^\\d+\\.\\d+\\.\\d+',
249
- description: 'Application version (semver format)'
250
- },
251
- description: {
252
- type: 'string',
253
- description: 'Application description'
254
- }
255
- },
256
17
  required: ['name', 'version'],
257
- additionalProperties: false
18
+ properties: {
19
+ name: { type: 'string' },
20
+ version: { type: 'string', pattern: '^\\d+\\.\\d+\\.\\d+' },
21
+ description: { type: 'string' }
22
+ }
258
23
  },
259
-
260
24
  server: {
261
25
  type: 'object',
26
+ required: ['port', 'host', 'apiPrefix', 'cors'],
262
27
  properties: {
263
- port: {
264
- type: 'number',
265
- minimum: 1,
266
- maximum: 65535,
267
- description: 'Server port number'
268
- },
269
- host: {
270
- type: 'string',
271
- description: 'Server host address'
272
- },
273
- apiPrefix: {
274
- type: 'string',
275
- pattern: '^/',
276
- description: 'API route prefix'
277
- },
28
+ port: { type: 'number', minimum: 1, maximum: 65535 },
29
+ host: { type: 'string' },
30
+ apiPrefix: { type: 'string' },
278
31
  cors: {
279
32
  type: 'object',
280
33
  properties: {
281
- origins: {
282
- type: 'array',
283
- items: { type: 'string' },
284
- minItems: 1,
285
- description: 'Allowed CORS origins'
286
- },
287
- methods: {
288
- type: 'array',
289
- items: {
290
- type: 'string',
291
- enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD']
292
- },
293
- description: 'Allowed HTTP methods'
294
- },
295
- headers: {
296
- type: 'array',
297
- items: { type: 'string' },
298
- description: 'Allowed headers'
299
- },
300
- credentials: {
301
- type: 'boolean',
302
- description: 'Allow credentials in CORS requests'
303
- },
304
- maxAge: {
305
- type: 'number',
306
- minimum: 0,
307
- description: 'CORS preflight cache duration'
308
- }
309
- },
310
- required: ['origins', 'methods', 'headers'],
311
- additionalProperties: false
312
- },
313
- middleware: {
314
- type: 'array',
315
- items: {
316
- type: 'object',
317
- properties: {
318
- name: { type: 'string' },
319
- enabled: { type: 'boolean' },
320
- config: { type: 'object' }
321
- },
322
- required: ['name', 'enabled'],
323
- additionalProperties: false
34
+ origins: { type: 'array', items: { type: 'string' } },
35
+ methods: { type: 'array', items: { type: 'string' } },
36
+ headers: { type: 'array', items: { type: 'string' } },
37
+ credentials: { type: 'boolean' },
38
+ maxAge: { type: 'number' }
324
39
  }
325
40
  }
326
- },
327
- required: ['port', 'host', 'apiPrefix', 'cors', 'middleware'],
328
- additionalProperties: false
41
+ }
329
42
  },
330
-
331
43
  client: {
332
44
  type: 'object',
45
+ required: ['port', 'proxy', 'build'],
333
46
  properties: {
334
- port: {
335
- type: 'number',
336
- minimum: 1,
337
- maximum: 65535,
338
- description: 'Client development server port'
339
- },
47
+ port: { type: 'number' },
340
48
  proxy: {
341
49
  type: 'object',
342
50
  properties: {
343
51
  target: { type: 'string' },
344
- changeOrigin: { type: 'boolean' },
345
- pathRewrite: {
346
- type: 'object',
347
- additionalProperties: { type: 'string' }
348
- }
349
- },
350
- required: ['target'],
351
- additionalProperties: false
352
- },
353
- build: {
354
- type: 'object',
355
- properties: {
356
- sourceMaps: { type: 'boolean' },
357
- minify: { type: 'boolean' },
358
- target: { type: 'string' },
359
- outDir: { type: 'string' }
360
- },
361
- required: ['sourceMaps', 'minify', 'target', 'outDir'],
362
- additionalProperties: false
363
- }
364
- },
365
- required: ['port', 'proxy', 'build'],
366
- additionalProperties: false
367
- },
368
-
369
- build: {
370
- type: 'object',
371
- properties: {
372
- target: {
373
- type: 'string',
374
- enum: ['bun', 'node', 'docker'],
375
- description: 'Build target runtime'
376
- },
377
- outDir: {
378
- type: 'string',
379
- description: 'Build output directory'
380
- },
381
- mode: {
382
- type: 'string',
383
- enum: ['development', 'production', 'test'],
384
- description: 'Build mode'
385
- },
386
- optimization: {
387
- type: 'object',
388
- properties: {
389
- minify: { type: 'boolean' },
390
- treeshake: { type: 'boolean' },
391
- compress: { type: 'boolean' },
392
- splitChunks: { type: 'boolean' },
393
- bundleAnalyzer: { type: 'boolean' }
394
- },
395
- required: ['minify', 'treeshake', 'compress', 'splitChunks', 'bundleAnalyzer'],
396
- additionalProperties: false
397
- },
398
- sourceMaps: { type: 'boolean' },
399
- minify: { type: 'boolean' },
400
- treeshake: { type: 'boolean' },
401
- compress: { type: 'boolean' },
402
- removeUnusedCSS: { type: 'boolean' },
403
- optimizeImages: { type: 'boolean' },
404
- bundleAnalysis: { type: 'boolean' },
405
- clean: { type: 'boolean' },
406
- optimize: { type: 'boolean' },
407
- external: {
408
- type: 'array',
409
- items: { type: 'string' },
410
- description: 'External dependencies to exclude from bundle'
411
- }
412
- },
413
- required: ['target', 'outDir', 'optimization', 'sourceMaps', 'minify', 'treeshake', 'clean'],
414
- additionalProperties: false
415
- },
416
-
417
- plugins: {
418
- type: 'object',
419
- properties: {
420
- enabled: {
421
- type: 'array',
422
- items: { type: 'string' },
423
- description: 'List of enabled plugins'
424
- },
425
- disabled: {
426
- type: 'array',
427
- items: { type: 'string' },
428
- description: 'List of disabled plugins'
429
- },
430
- config: {
431
- type: 'object',
432
- description: 'Plugin-specific configuration'
433
- }
434
- },
435
- required: ['enabled', 'disabled', 'config'],
436
- additionalProperties: false
437
- },
438
-
439
- logging: {
440
- type: 'object',
441
- properties: {
442
- level: {
443
- type: 'string',
444
- enum: ['debug', 'info', 'warn', 'error'],
445
- description: 'Minimum log level'
446
- },
447
- format: {
448
- type: 'string',
449
- enum: ['json', 'pretty'],
450
- description: 'Log output format'
451
- },
452
- transports: {
453
- type: 'array',
454
- items: {
455
- type: 'object',
456
- properties: {
457
- type: {
458
- type: 'string',
459
- enum: ['console', 'file', 'http']
460
- },
461
- level: {
462
- type: 'string',
463
- enum: ['debug', 'info', 'warn', 'error']
464
- },
465
- format: {
466
- type: 'string',
467
- enum: ['json', 'pretty']
468
- },
469
- options: { type: 'object' }
470
- },
471
- required: ['type', 'level', 'format'],
472
- additionalProperties: false
52
+ secure: { type: 'boolean' },
53
+ changeOrigin: { type: 'boolean' }
473
54
  }
474
55
  },
475
- context: { type: 'object' }
476
- },
477
- required: ['level', 'format', 'transports'],
478
- additionalProperties: false
479
- },
480
-
481
- monitoring: {
482
- type: 'object',
483
- properties: {
484
- enabled: { type: 'boolean' },
485
- metrics: {
486
- type: 'object',
487
- properties: {
488
- enabled: { type: 'boolean' },
489
- collectInterval: { type: 'number', minimum: 1000 },
490
- httpMetrics: { type: 'boolean' },
491
- systemMetrics: { type: 'boolean' },
492
- customMetrics: { type: 'boolean' }
493
- },
494
- required: ['enabled', 'collectInterval', 'httpMetrics', 'systemMetrics', 'customMetrics'],
495
- additionalProperties: false
496
- },
497
- profiling: {
498
- type: 'object',
499
- properties: {
500
- enabled: { type: 'boolean' },
501
- sampleRate: { type: 'number', minimum: 0, maximum: 1 },
502
- memoryProfiling: { type: 'boolean' },
503
- cpuProfiling: { type: 'boolean' }
504
- },
505
- required: ['enabled', 'sampleRate', 'memoryProfiling', 'cpuProfiling'],
506
- additionalProperties: false
507
- },
508
- exporters: {
509
- type: 'array',
510
- items: { type: 'string' }
511
- }
512
- },
513
- required: ['enabled', 'metrics', 'profiling', 'exporters'],
514
- additionalProperties: false
515
- },
516
-
517
- // Optional configurations
518
- database: {
519
- type: 'object',
520
- properties: {
521
- url: { type: 'string' },
522
- host: { type: 'string' },
523
- port: { type: 'number', minimum: 1, maximum: 65535 },
524
- database: { type: 'string' },
525
- user: { type: 'string' },
526
- password: { type: 'string' },
527
- ssl: { type: 'boolean' },
528
- poolSize: { type: 'number', minimum: 1 }
529
- },
530
- additionalProperties: false
531
- },
532
-
533
- auth: {
534
- type: 'object',
535
- properties: {
536
- secret: { type: 'string', minLength: 32 },
537
- expiresIn: { type: 'string' },
538
- algorithm: { type: 'string' },
539
- issuer: { type: 'string' }
540
- },
541
- additionalProperties: false
542
- },
543
-
544
- email: {
545
- type: 'object',
546
- properties: {
547
- host: { type: 'string' },
548
- port: { type: 'number', minimum: 1, maximum: 65535 },
549
- user: { type: 'string' },
550
- password: { type: 'string' },
551
- secure: { type: 'boolean' },
552
- from: { type: 'string' }
553
- },
554
- additionalProperties: false
555
- },
556
-
557
- storage: {
558
- type: 'object',
559
- properties: {
560
- uploadPath: { type: 'string' },
561
- maxFileSize: { type: 'number', minimum: 1 },
562
- allowedTypes: {
563
- type: 'array',
564
- items: { type: 'string' }
565
- },
566
- provider: {
567
- type: 'string',
568
- enum: ['local', 's3', 'gcs']
569
- },
570
- config: { type: 'object' }
571
- },
572
- additionalProperties: false
573
- },
574
-
575
- environments: {
576
- type: 'object',
577
- additionalProperties: {
578
- // Recursive reference to partial config
579
- type: 'object'
56
+ build: { type: 'object' }
580
57
  }
581
58
  },
582
-
583
- custom: {
584
- type: 'object',
585
- description: 'Custom application-specific configuration'
586
- }
587
- },
588
- required: ['app', 'server', 'client', 'build', 'plugins', 'logging', 'monitoring'],
589
- additionalProperties: false
590
- }
591
-
592
- // Default configuration values
593
- export const defaultFluxStackConfig: FluxStackConfig = {
594
- app: {
595
- name: 'fluxstack-app',
596
- version: '1.0.0',
597
- description: 'A FluxStack application'
598
- },
599
-
600
- server: {
601
- port: 3000,
602
- host: 'localhost',
603
- apiPrefix: '/api',
604
- cors: {
605
- origins: ['http://localhost:3000', 'http://localhost:5173'],
606
- methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
607
- headers: ['Content-Type', 'Authorization'],
608
- credentials: true,
609
- maxAge: 86400
610
- },
611
- middleware: []
612
- },
613
-
614
- client: {
615
- port: 5173,
616
- proxy: {
617
- target: 'http://localhost:3000',
618
- changeOrigin: true
619
- },
620
59
  build: {
621
- sourceMaps: true,
622
- minify: false,
623
- target: 'esnext',
624
- outDir: 'dist/client'
625
- }
626
- },
627
-
628
- build: {
629
- target: 'bun',
630
- mode: 'production',
631
- outDir: 'dist',
632
- optimization: {
633
- minify: true,
634
- treeshake: true,
635
- compress: true,
636
- splitChunks: true,
637
- bundleAnalyzer: false
638
- },
639
- sourceMaps: true,
640
- minify: true,
641
- treeshake: true,
642
- compress: true,
643
- removeUnusedCSS: false,
644
- optimizeImages: false,
645
- bundleAnalysis: false,
646
- clean: true,
647
- optimize: true,
648
- external: []
649
- },
650
-
651
- plugins: {
652
- enabled: ['logger', 'swagger', 'vite', 'cors'],
653
- disabled: [],
654
- config: {}
655
- },
656
-
657
- logging: {
658
- level: 'info',
659
- format: 'pretty',
660
- transports: [
661
- {
662
- type: 'console',
663
- level: 'info',
664
- format: 'pretty'
60
+ type: 'object',
61
+ required: ['target', 'outDir', 'optimization'],
62
+ properties: {
63
+ target: { type: 'string' },
64
+ outDir: { type: 'string' },
65
+ optimization: { type: 'object' }
665
66
  }
666
- ]
667
- },
668
-
669
- monitoring: {
670
- enabled: false,
671
- metrics: {
672
- enabled: false,
673
- collectInterval: 5000,
674
- httpMetrics: true,
675
- systemMetrics: true,
676
- customMetrics: false
677
- },
678
- profiling: {
679
- enabled: false,
680
- sampleRate: 0.1,
681
- memoryProfiling: false,
682
- cpuProfiling: false
683
67
  },
684
- exporters: []
68
+ plugins: { type: 'object' },
69
+ logging: { type: 'object' },
70
+ monitoring: { type: 'object' }
685
71
  }
686
72
  }
687
73
 
688
- // Environment-specific default overrides
689
- export const environmentDefaults = {
690
- development: {
691
- logging: {
692
- level: 'debug' as LogLevel,
693
- format: 'pretty' as LogFormat
694
- },
695
- client: {
696
- build: {
697
- minify: false,
698
- sourceMaps: true
699
- }
700
- },
701
- build: {
702
- optimization: {
703
- minify: false,
704
- compress: false
705
- }
706
- }
707
- },
74
+ export type FluxStackConfig = typeof modernFluxStackConfig
708
75
 
709
- production: {
710
- logging: {
711
- level: 'warn' as LogLevel,
712
- format: 'json' as LogFormat,
713
- transports: [
714
- {
715
- type: 'console' as const,
716
- level: 'warn' as LogLevel,
717
- format: 'json' as LogFormat
718
- },
719
- {
720
- type: 'file' as const,
721
- level: 'error' as LogLevel,
722
- format: 'json' as LogFormat,
723
- options: {
724
- filename: 'logs/error.log',
725
- maxSize: '10m',
726
- maxFiles: 5
727
- }
728
- }
729
- ]
730
- },
731
- monitoring: {
732
- enabled: true,
733
- metrics: {
734
- enabled: true,
735
- httpMetrics: true,
736
- systemMetrics: true
737
- }
738
- },
739
- build: {
740
- optimization: {
741
- minify: true,
742
- treeshake: true,
743
- compress: true,
744
- splitChunks: true
745
- }
746
- }
747
- },
748
-
749
- test: {
750
- logging: {
751
- level: 'error' as LogLevel,
752
- format: 'json' as LogFormat
753
- },
754
- server: {
755
- port: 0 // Use random available port
756
- },
757
- client: {
758
- port: 0 // Use random available port
759
- }
760
- }
761
- } as const
76
+ export default {
77
+ defaultFluxStackConfig,
78
+ environmentDefaults,
79
+ fluxStackConfigSchema
80
+ }