create-fluxstack 1.0.0 → 1.0.2

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 (101) hide show
  1. package/create-fluxstack.ts +32 -17
  2. package/package-template.json +51 -0
  3. package/package.json +2 -1
  4. package/.env +0 -30
  5. package/LICENSE +0 -21
  6. package/app/client/README.md +0 -69
  7. package/app/client/frontend-only.ts +0 -12
  8. package/app/client/index.html +0 -13
  9. package/app/client/public/vite.svg +0 -1
  10. package/app/client/src/App.css +0 -883
  11. package/app/client/src/App.tsx +0 -669
  12. package/app/client/src/assets/react.svg +0 -1
  13. package/app/client/src/components/TestPage.tsx +0 -453
  14. package/app/client/src/index.css +0 -51
  15. package/app/client/src/lib/eden-api.ts +0 -110
  16. package/app/client/src/main.tsx +0 -10
  17. package/app/client/src/vite-env.d.ts +0 -1
  18. package/app/client/tsconfig.app.json +0 -43
  19. package/app/client/tsconfig.json +0 -7
  20. package/app/client/tsconfig.node.json +0 -25
  21. package/app/server/app.ts +0 -10
  22. package/app/server/backend-only.ts +0 -15
  23. package/app/server/controllers/users.controller.ts +0 -69
  24. package/app/server/index.ts +0 -104
  25. package/app/server/routes/index.ts +0 -25
  26. package/app/server/routes/users.routes.ts +0 -121
  27. package/app/server/types/index.ts +0 -1
  28. package/app/shared/types/index.ts +0 -18
  29. package/bun.lock +0 -1053
  30. package/core/__tests__/integration.test.ts +0 -227
  31. package/core/build/index.ts +0 -186
  32. package/core/cli/command-registry.ts +0 -334
  33. package/core/cli/index.ts +0 -394
  34. package/core/cli/plugin-discovery.ts +0 -200
  35. package/core/client/standalone.ts +0 -57
  36. package/core/config/__tests__/config-loader.test.ts +0 -591
  37. package/core/config/__tests__/config-merger.test.ts +0 -657
  38. package/core/config/__tests__/env-converter.test.ts +0 -372
  39. package/core/config/__tests__/env-processor.test.ts +0 -431
  40. package/core/config/__tests__/env.test.ts +0 -452
  41. package/core/config/__tests__/integration.test.ts +0 -418
  42. package/core/config/__tests__/loader.test.ts +0 -331
  43. package/core/config/__tests__/schema.test.ts +0 -129
  44. package/core/config/__tests__/validator.test.ts +0 -318
  45. package/core/config/env-dynamic.ts +0 -326
  46. package/core/config/env.ts +0 -597
  47. package/core/config/index.ts +0 -317
  48. package/core/config/loader.ts +0 -546
  49. package/core/config/runtime-config.ts +0 -322
  50. package/core/config/schema.ts +0 -694
  51. package/core/config/validator.ts +0 -540
  52. package/core/framework/__tests__/server.test.ts +0 -233
  53. package/core/framework/client.ts +0 -132
  54. package/core/framework/index.ts +0 -8
  55. package/core/framework/server.ts +0 -501
  56. package/core/framework/types.ts +0 -63
  57. package/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  58. package/core/plugins/__tests__/manager.test.ts +0 -398
  59. package/core/plugins/__tests__/monitoring.test.ts +0 -401
  60. package/core/plugins/__tests__/registry.test.ts +0 -335
  61. package/core/plugins/built-in/index.ts +0 -142
  62. package/core/plugins/built-in/logger/index.ts +0 -180
  63. package/core/plugins/built-in/monitoring/README.md +0 -193
  64. package/core/plugins/built-in/monitoring/index.ts +0 -912
  65. package/core/plugins/built-in/static/index.ts +0 -289
  66. package/core/plugins/built-in/swagger/index.ts +0 -229
  67. package/core/plugins/built-in/vite/index.ts +0 -316
  68. package/core/plugins/config.ts +0 -348
  69. package/core/plugins/discovery.ts +0 -350
  70. package/core/plugins/executor.ts +0 -351
  71. package/core/plugins/index.ts +0 -195
  72. package/core/plugins/manager.ts +0 -583
  73. package/core/plugins/registry.ts +0 -424
  74. package/core/plugins/types.ts +0 -254
  75. package/core/server/framework.ts +0 -123
  76. package/core/server/index.ts +0 -8
  77. package/core/server/plugins/database.ts +0 -182
  78. package/core/server/plugins/logger.ts +0 -47
  79. package/core/server/plugins/swagger.ts +0 -34
  80. package/core/server/standalone.ts +0 -91
  81. package/core/templates/create-project.ts +0 -455
  82. package/core/types/api.ts +0 -169
  83. package/core/types/build.ts +0 -174
  84. package/core/types/config.ts +0 -68
  85. package/core/types/index.ts +0 -127
  86. package/core/types/plugin.ts +0 -94
  87. package/core/utils/__tests__/errors.test.ts +0 -139
  88. package/core/utils/__tests__/helpers.test.ts +0 -297
  89. package/core/utils/__tests__/logger.test.ts +0 -141
  90. package/core/utils/env-runtime-v2.ts +0 -232
  91. package/core/utils/env-runtime.ts +0 -252
  92. package/core/utils/errors/codes.ts +0 -115
  93. package/core/utils/errors/handlers.ts +0 -63
  94. package/core/utils/errors/index.ts +0 -81
  95. package/core/utils/helpers.ts +0 -180
  96. package/core/utils/index.ts +0 -18
  97. package/core/utils/logger/index.ts +0 -161
  98. package/core/utils/logger.ts +0 -106
  99. package/core/utils/monitoring/index.ts +0 -212
  100. package/tsconfig.json +0 -51
  101. package/vite.config.ts +0 -42
@@ -1,322 +0,0 @@
1
- /**
2
- * Runtime Configuration System for FluxStack
3
- * Uses dynamic environment loading to solve Bun build issues
4
- * Drop-in replacement for process.env based configuration
5
- */
6
-
7
- import { env, createEnvNamespace, envValidation } from '../utils/env-runtime'
8
- import {
9
- dynamicEnvironmentProcessor,
10
- createDynamicConfig,
11
- validateProductionEnv,
12
- getDynamicEnvironmentInfo
13
- } from './env-dynamic'
14
- import type { FluxStackConfig } from './schema'
15
- import { defaultFluxStackConfig } from './schema'
16
-
17
- /**
18
- * Runtime Configuration Builder
19
- * Creates configuration that works with dynamic env loading
20
- */
21
- export class RuntimeConfigBuilder {
22
- private config: Partial<FluxStackConfig> = {}
23
-
24
- constructor() {
25
- this.loadFromDefaults()
26
- this.loadFromDynamicEnv()
27
- }
28
-
29
- /**
30
- * Load default configuration
31
- */
32
- private loadFromDefaults(): this {
33
- this.config = { ...defaultFluxStackConfig }
34
- return this
35
- }
36
-
37
- /**
38
- * Load from dynamic environment variables
39
- */
40
- private loadFromDynamicEnv(): this {
41
- const envConfig = createDynamicConfig()
42
- this.config = this.deepMerge(this.config, envConfig)
43
- return this
44
- }
45
-
46
- /**
47
- * Override specific configuration section
48
- */
49
- override(section: string, values: any): this {
50
- this.setNestedProperty(this.config, section, values)
51
- return this
52
- }
53
-
54
- /**
55
- * Set individual configuration value
56
- */
57
- set(path: string, value: any): this {
58
- this.setNestedProperty(this.config, path, value)
59
- return this
60
- }
61
-
62
- /**
63
- * Build final configuration
64
- */
65
- build(): FluxStackConfig {
66
- // Validate production environment if needed
67
- if (env.get('NODE_ENV') === 'production') {
68
- validateProductionEnv()
69
- }
70
-
71
- return this.config as FluxStackConfig
72
- }
73
-
74
- /**
75
- * Get current configuration state
76
- */
77
- current(): Partial<FluxStackConfig> {
78
- return { ...this.config }
79
- }
80
-
81
- private deepMerge(target: any, source: any): any {
82
- if (!source || typeof source !== 'object') return target
83
- if (!target || typeof target !== 'object') return source
84
-
85
- const result = { ...target }
86
-
87
- for (const key in source) {
88
- if (source.hasOwnProperty(key)) {
89
- if (Array.isArray(source[key])) {
90
- result[key] = [...source[key]]
91
- } else if (typeof source[key] === 'object' && source[key] !== null) {
92
- result[key] = this.deepMerge(target[key], source[key])
93
- } else {
94
- result[key] = source[key]
95
- }
96
- }
97
- }
98
-
99
- return result
100
- }
101
-
102
- private setNestedProperty(obj: any, path: string, value: any): void {
103
- const keys = path.split('.')
104
- let current = obj
105
-
106
- for (let i = 0; i < keys.length - 1; i++) {
107
- const key = keys[i]
108
- if (!(key in current) || typeof current[key] !== 'object') {
109
- current[key] = {}
110
- }
111
- current = current[key]
112
- }
113
-
114
- current[keys[keys.length - 1]] = value
115
- }
116
- }
117
-
118
- /**
119
- * Create runtime configuration that works with Bun build
120
- */
121
- export function createRuntimeConfig(overrides?: Partial<FluxStackConfig>): FluxStackConfig {
122
- const builder = new RuntimeConfigBuilder()
123
-
124
- if (overrides) {
125
- // Apply overrides
126
- for (const [key, value] of Object.entries(overrides)) {
127
- builder.override(key, value)
128
- }
129
- }
130
-
131
- return builder.build()
132
- }
133
-
134
- /**
135
- * Environment-specific configuration factory
136
- */
137
- export const runtimeConfig = {
138
- /**
139
- * Create development configuration
140
- */
141
- development(): FluxStackConfig {
142
- return new RuntimeConfigBuilder()
143
- .override('logging.level', env.get('LOG_LEVEL', 'debug'))
144
- .override('logging.format', env.get('LOG_FORMAT', 'pretty'))
145
- .override('build.optimization.minify', false)
146
- .override('build.sourceMaps', true)
147
- .override('monitoring.enabled', false)
148
- .build()
149
- },
150
-
151
- /**
152
- * Create production configuration
153
- */
154
- production(): FluxStackConfig {
155
- return new RuntimeConfigBuilder()
156
- .override('logging.level', env.get('LOG_LEVEL', 'warn'))
157
- .override('logging.format', env.get('LOG_FORMAT', 'json'))
158
- .override('build.optimization.minify', true)
159
- .override('build.sourceMaps', false)
160
- .override('monitoring.enabled', env.bool('MONITORING_ENABLED', true))
161
- .build()
162
- },
163
-
164
- /**
165
- * Create test configuration
166
- */
167
- test(): FluxStackConfig {
168
- return new RuntimeConfigBuilder()
169
- .override('logging.level', env.get('LOG_LEVEL', 'error'))
170
- .override('server.port', 0) // Random port for tests
171
- .override('client.port', 0)
172
- .override('monitoring.enabled', false)
173
- .build()
174
- },
175
-
176
- /**
177
- * Auto-detect environment and create appropriate config
178
- */
179
- auto(overrides?: Partial<FluxStackConfig>): FluxStackConfig {
180
- const environment = env.get('NODE_ENV', 'development')
181
-
182
- let config: FluxStackConfig
183
-
184
- switch (environment) {
185
- case 'production':
186
- config = this.production()
187
- break
188
- case 'test':
189
- config = this.test()
190
- break
191
- default:
192
- config = this.development()
193
- }
194
-
195
- if (overrides) {
196
- const builder = new RuntimeConfigBuilder()
197
- ;(builder as any).config = config
198
-
199
- for (const [key, value] of Object.entries(overrides)) {
200
- builder.override(key, value)
201
- }
202
-
203
- config = builder.build()
204
- }
205
-
206
- return config
207
- }
208
- }
209
-
210
- /**
211
- * Specialized environment loaders for different domains
212
- */
213
- export const envLoaders = {
214
- /**
215
- * Database environment loader
216
- */
217
- database: createEnvNamespace('DATABASE_'),
218
-
219
- /**
220
- * JWT environment loader
221
- */
222
- jwt: createEnvNamespace('JWT_'),
223
-
224
- /**
225
- * SMTP environment loader
226
- */
227
- smtp: createEnvNamespace('SMTP_'),
228
-
229
- /**
230
- * CORS environment loader
231
- */
232
- cors: createEnvNamespace('CORS_'),
233
-
234
- /**
235
- * FluxStack specific environment loader
236
- */
237
- fluxstack: createEnvNamespace('FLUXSTACK_')
238
- }
239
-
240
- /**
241
- * Configuration helpers that use dynamic env
242
- */
243
- export const configHelpers = {
244
- /**
245
- * Get database URL with validation
246
- */
247
- getDatabaseUrl(): string | null {
248
- const url = env.get('DATABASE_URL')
249
-
250
- if (url) {
251
- envValidation.validate('DATABASE_URL',
252
- (value) => value.includes('://'),
253
- 'Must be a valid URL'
254
- )
255
- }
256
-
257
- return url || null
258
- },
259
-
260
- /**
261
- * Get CORS origins with proper defaults
262
- */
263
- getCorsOrigins(): string[] {
264
- const origins = env.array('CORS_ORIGINS')
265
-
266
- if (origins.length === 0) {
267
- const environment = env.get('NODE_ENV', 'development')
268
-
269
- if (environment === 'development') {
270
- return ['http://localhost:3000', 'http://localhost:5173']
271
- } else if (environment === 'production') {
272
- return [] // Must be explicitly configured in production
273
- }
274
- }
275
-
276
- return origins
277
- },
278
-
279
- /**
280
- * Get server configuration with runtime env
281
- */
282
- getServerConfig() {
283
- return {
284
- port: env.num('PORT', 3000),
285
- host: env.get('HOST', 'localhost'),
286
- apiPrefix: env.get('API_PREFIX', '/api'),
287
- cors: {
288
- origins: this.getCorsOrigins(),
289
- methods: env.array('CORS_METHODS', ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']),
290
- headers: env.array('CORS_HEADERS', ['Content-Type', 'Authorization']),
291
- credentials: env.bool('CORS_CREDENTIALS', false),
292
- maxAge: env.num('CORS_MAX_AGE', 86400)
293
- }
294
- }
295
- },
296
-
297
- /**
298
- * Get client configuration with runtime env
299
- */
300
- getClientConfig() {
301
- return {
302
- port: env.num('VITE_PORT', 5173),
303
- proxy: {
304
- target: env.get('API_URL', 'http://localhost:3000'),
305
- changeOrigin: env.bool('PROXY_CHANGE_ORIGIN', true)
306
- },
307
- build: {
308
- outDir: env.get('CLIENT_BUILD_DIR', 'dist/client'),
309
- sourceMaps: env.bool('CLIENT_SOURCEMAPS', env.get('NODE_ENV') === 'development'),
310
- minify: env.bool('CLIENT_MINIFY', env.get('NODE_ENV') === 'production'),
311
- target: env.get('CLIENT_TARGET', 'es2020')
312
- }
313
- }
314
- }
315
- }
316
-
317
- /**
318
- * Export main configuration function
319
- */
320
- export default function getRuntimeConfig(overrides?: Partial<FluxStackConfig>): FluxStackConfig {
321
- return runtimeConfig.auto(overrides)
322
- }