create-fluxstack 1.1.0 → 1.4.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 (62) hide show
  1. package/app/server/backend-only.ts +5 -5
  2. package/app/server/index.ts +63 -54
  3. package/app/server/live/FluxStackConfig.ts +43 -39
  4. package/app/server/live/SystemMonitorIntegration.ts +2 -2
  5. package/app/server/live/register-components.ts +1 -1
  6. package/app/server/middleware/errorHandling.ts +6 -4
  7. package/app/server/routes/config.ts +145 -0
  8. package/app/server/routes/index.ts +5 -3
  9. package/config/app.config.ts +113 -0
  10. package/config/build.config.ts +24 -0
  11. package/config/database.config.ts +99 -0
  12. package/config/index.ts +68 -0
  13. package/config/logger.config.ts +27 -0
  14. package/config/runtime.config.ts +92 -0
  15. package/config/server.config.ts +46 -0
  16. package/config/services.config.ts +130 -0
  17. package/config/system.config.ts +105 -0
  18. package/core/build/index.ts +10 -4
  19. package/core/cli/index.ts +29 -12
  20. package/core/config/env.ts +37 -95
  21. package/core/config/runtime-config.ts +61 -58
  22. package/core/config/schema.ts +4 -0
  23. package/core/framework/server.ts +22 -10
  24. package/core/plugins/built-in/index.ts +7 -17
  25. package/core/plugins/built-in/swagger/index.ts +228 -228
  26. package/core/plugins/built-in/vite/index.ts +374 -358
  27. package/core/plugins/dependency-manager.ts +5 -5
  28. package/core/plugins/manager.ts +12 -12
  29. package/core/plugins/registry.ts +3 -3
  30. package/core/server/index.ts +0 -1
  31. package/core/server/live/ComponentRegistry.ts +34 -8
  32. package/core/server/live/LiveComponentPerformanceMonitor.ts +1 -1
  33. package/core/server/live/websocket-plugin.ts +434 -434
  34. package/core/server/middleware/README.md +488 -0
  35. package/core/server/middleware/elysia-helpers.ts +227 -0
  36. package/core/server/middleware/index.ts +25 -9
  37. package/core/server/plugins/static-files-plugin.ts +231 -231
  38. package/core/utils/config-schema.ts +484 -0
  39. package/core/utils/env.ts +306 -0
  40. package/core/utils/helpers.ts +4 -4
  41. package/core/utils/logger/colors.ts +114 -0
  42. package/core/utils/logger/config.ts +35 -0
  43. package/core/utils/logger/formatter.ts +82 -0
  44. package/core/utils/logger/group-logger.ts +101 -0
  45. package/core/utils/logger/index.ts +199 -250
  46. package/core/utils/logger/stack-trace.ts +92 -0
  47. package/core/utils/logger/startup-banner.ts +92 -0
  48. package/core/utils/logger/winston-logger.ts +152 -0
  49. package/core/utils/version.ts +5 -0
  50. package/create-fluxstack.ts +1 -0
  51. package/fluxstack.config.ts +2 -2
  52. package/package.json +117 -115
  53. package/core/config/env-dynamic.ts +0 -326
  54. package/core/plugins/built-in/logger/index.ts +0 -180
  55. package/core/server/plugins/logger.ts +0 -47
  56. package/core/utils/env-runtime-v2.ts +0 -232
  57. package/core/utils/env-runtime.ts +0 -259
  58. package/core/utils/logger/formatters.ts +0 -222
  59. package/core/utils/logger/middleware.ts +0 -253
  60. package/core/utils/logger/performance.ts +0 -384
  61. package/core/utils/logger/transports.ts +0 -365
  62. package/core/utils/logger.ts +0 -106
@@ -0,0 +1,152 @@
1
+ /**
2
+ * FluxStack Logger - Winston Logger Factory
3
+ * Creates Winston logger instances for each module
4
+ */
5
+
6
+ import winston from 'winston'
7
+ import DailyRotateFile from 'winston-daily-rotate-file'
8
+ import { join, dirname } from 'path'
9
+ import { existsSync, mkdirSync } from 'fs'
10
+ import chalk from 'chalk'
11
+ import { LOGGER_CONFIG } from './config'
12
+ import { LOG_SYMBOLS, LEVEL_COLORS } from './colors'
13
+
14
+ // Cache for module loggers
15
+ const moduleLoggers = new Map<string, winston.Logger>()
16
+
17
+ /**
18
+ * Console format with colors and symbols
19
+ */
20
+ function createConsoleFormat() {
21
+ return winston.format.printf(({ timestamp, level, message }) => {
22
+ const levelSymbol = LOG_SYMBOLS[level as keyof typeof LOG_SYMBOLS] || LOG_SYMBOLS.default
23
+ const levelColor = LEVEL_COLORS[level as keyof typeof LEVEL_COLORS] || LEVEL_COLORS.default
24
+ const timestampFormatted = chalk.gray(`[${timestamp}]`)
25
+
26
+ return `${levelSymbol} ${timestampFormatted} ${levelColor(level.toUpperCase().padEnd(5))} ${message}`
27
+ })
28
+ }
29
+
30
+ /**
31
+ * File format without colors
32
+ */
33
+ function createFileFormat() {
34
+ return winston.format.printf(({ timestamp, level, message }) => {
35
+ // Remove ANSI color codes
36
+ const cleanMessage = message.replace(/\u001b\[.*?m/g, '')
37
+ return `[${timestamp}] [${level.toUpperCase()}]: ${cleanMessage}`
38
+ })
39
+ }
40
+
41
+ /**
42
+ * Create a logger for a specific module
43
+ */
44
+ export function getLoggerForModule(modulePath: string): winston.Logger {
45
+ // Normalize path for cache key
46
+ const normalizedPath = modulePath.replace(/[:/\\]/g, '_').replace(/^_/, '')
47
+
48
+ // Check cache
49
+ if (moduleLoggers.has(normalizedPath)) {
50
+ return moduleLoggers.get(normalizedPath)!
51
+ }
52
+
53
+ // Create logger
54
+ const logger = createLogger(normalizedPath)
55
+ moduleLoggers.set(normalizedPath, logger)
56
+
57
+ return logger
58
+ }
59
+
60
+ /**
61
+ * Create a Winston logger with appropriate transports
62
+ */
63
+ function createLogger(modulePath: string): winston.Logger {
64
+ const transports: winston.transport[] = [
65
+ // Console transport (always enabled)
66
+ new winston.transports.Console({
67
+ format: winston.format.combine(
68
+ winston.format.timestamp({ format: LOGGER_CONFIG.dateFormat }),
69
+ createConsoleFormat()
70
+ )
71
+ })
72
+ ]
73
+
74
+ // Add file transports if enabled
75
+ if (LOGGER_CONFIG.logToFile) {
76
+ const logsDir = join(process.cwd(), 'logs', modulePath)
77
+
78
+ // Ensure logs directory exists
79
+ if (!existsSync(logsDir)) {
80
+ mkdirSync(logsDir, { recursive: true })
81
+ }
82
+
83
+ const commonFileFormat = winston.format.combine(
84
+ winston.format.timestamp({ format: LOGGER_CONFIG.dateFormat }),
85
+ createFileFormat()
86
+ )
87
+
88
+ // All logs
89
+ transports.push(
90
+ new DailyRotateFile({
91
+ filename: join(logsDir, '%DATE%-all.log'),
92
+ datePattern: 'YYYY-MM-DD',
93
+ maxSize: LOGGER_CONFIG.maxSize,
94
+ maxFiles: LOGGER_CONFIG.maxFiles,
95
+ level: LOGGER_CONFIG.level,
96
+ format: commonFileFormat
97
+ })
98
+ )
99
+
100
+ // Error logs
101
+ transports.push(
102
+ new DailyRotateFile({
103
+ filename: join(logsDir, '%DATE%-errors.log'),
104
+ datePattern: 'YYYY-MM-DD',
105
+ maxSize: LOGGER_CONFIG.maxSize,
106
+ maxFiles: LOGGER_CONFIG.maxFiles,
107
+ level: 'error',
108
+ format: commonFileFormat
109
+ })
110
+ )
111
+
112
+ // Warning logs
113
+ transports.push(
114
+ new DailyRotateFile({
115
+ filename: join(logsDir, '%DATE%-warnings.log'),
116
+ datePattern: 'YYYY-MM-DD',
117
+ maxSize: LOGGER_CONFIG.maxSize,
118
+ maxFiles: LOGGER_CONFIG.maxFiles,
119
+ level: 'warn',
120
+ format: commonFileFormat
121
+ })
122
+ )
123
+
124
+ // Info logs
125
+ transports.push(
126
+ new DailyRotateFile({
127
+ filename: join(logsDir, '%DATE%-info.log'),
128
+ datePattern: 'YYYY-MM-DD',
129
+ maxSize: LOGGER_CONFIG.maxSize,
130
+ maxFiles: LOGGER_CONFIG.maxFiles,
131
+ level: 'info',
132
+ format: commonFileFormat
133
+ })
134
+ )
135
+ }
136
+
137
+ return winston.createLogger({
138
+ level: LOGGER_CONFIG.level,
139
+ transports
140
+ })
141
+ }
142
+
143
+ /**
144
+ * Clear logger cache (useful for testing)
145
+ */
146
+ export function clearLoggerCache(): void {
147
+ // Close all loggers before clearing
148
+ for (const logger of moduleLoggers.values()) {
149
+ logger.close()
150
+ }
151
+ moduleLoggers.clear()
152
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * FluxStack Framework Version
3
+ * Single source of truth for version number
4
+ */
5
+ export const FLUXSTACK_VERSION = '1.4.0'
@@ -57,6 +57,7 @@ program
57
57
  const filesToCopy = [
58
58
  'core',
59
59
  'app',
60
+ 'config', // ✅ CRITICAL: Copy config folder with declarative configs
60
61
  'ai-context', // ✅ CRITICAL: Copy AI documentation for users
61
62
  'bun.lock', // ✅ CRITICAL: Copy lockfile to maintain working versions
62
63
  'package.json', // ✅ Copy real package.json from framework
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * FluxStack Configuration
3
3
  * Enhanced configuration with comprehensive settings and environment support
4
- * Updated to use dynamic environment variables
4
+ * Uses unified environment loader
5
5
  */
6
6
 
7
7
  import type { FluxStackConfig } from './core/config/schema'
8
- import { env, helpers } from './core/utils/env-runtime-v2'
8
+ import { env, helpers } from './core/utils/env'
9
9
 
10
10
  console.log(`🔧 Loading FluxStack config for ${env.NODE_ENV} environment`)
11
11
 
package/package.json CHANGED
@@ -1,115 +1,117 @@
1
- {
2
- "name": "create-fluxstack",
3
- "version": "1.1.0",
4
- "description": "⚡ Revolutionary full-stack TypeScript framework with Temporal Bridge Auto-Discovery, Elysia + React + Bun",
5
- "keywords": [
6
- "framework",
7
- "full-stack",
8
- "typescript",
9
- "elysia",
10
- "react",
11
- "bun",
12
- "vite"
13
- ],
14
- "author": "FluxStack Team",
15
- "license": "MIT",
16
- "homepage": "https://github.com/MarcosBrendonDePaula/FluxStack",
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/MarcosBrendonDePaula/FluxStack.git"
20
- },
21
- "module": "app/server/index.ts",
22
- "type": "module",
23
- "bin": {
24
- "create-fluxstack": "create-fluxstack.ts"
25
- },
26
- "scripts": {
27
- "dev": "bun run core/cli/index.ts dev",
28
- "dev:frontend": "bun run core/cli/index.ts frontend",
29
- "dev:backend": "bun run core/cli/index.ts backend",
30
- "dev:coordinated": "concurrently --prefix {name} --names BACKEND,VITE --prefix-colors blue,green --kill-others-on-fail \"bun --watch app/server/index.ts\" \"vite --config vite.config.ts\"",
31
- "dev:clean": "bun run run-clean.ts",
32
- "build": "cross-env NODE_ENV=production bun run core/cli/index.ts build",
33
- "build:frontend": "vite build --config vite.config.ts --emptyOutDir",
34
- "build:backend": "bun run core/cli/index.ts build:backend",
35
- "start": "bun run core/cli/index.ts start",
36
- "start:frontend": "bun run app/client/frontend-only.ts",
37
- "start:backend": "bun run app/server/backend-only.ts",
38
- "docker:build": "cd dist && docker build -t fluxstack-app .",
39
- "docker:run": "cd dist && docker run -p 3000:3000 fluxstack-app",
40
- "docker:compose": "cd dist && docker-compose up -d",
41
- "docker:stop": "cd dist && docker-compose down",
42
- "create": "bun run core/cli/index.ts create",
43
- "cli": "bun run core/cli/index.ts",
44
- "make:component": "bun run core/cli/index.ts make:component",
45
- "make:live": "bun run core/cli/index.ts make:component",
46
- "test": "vitest",
47
- "test:ui": "vitest --ui",
48
- "test:run": "vitest run",
49
- "test:coverage": "vitest run --coverage",
50
- "test:watch": "vitest --watch",
51
- "test:live": "tsx scripts/test-live-components.ts",
52
- "test:live:coverage": "tsx scripts/test-live-components.ts --coverage",
53
- "test:live:watch": "tsx scripts/test-live-components.ts --watch",
54
- "test:live:verbose": "tsx scripts/test-live-components.ts --verbose",
55
- "test:config": "bun run core/config/__tests__/run-tests.ts",
56
- "test:config:coverage": "bun run core/config/__tests__/run-tests.ts coverage",
57
- "test:config:manual": "bun run core/config/__tests__/manual-test.ts",
58
- "legacy:dev": "bun --watch app/server/index.ts"
59
- },
60
- "devDependencies": {
61
- "@eslint/js": "^9.30.1",
62
- "@tailwindcss/vite": "^4.1.13",
63
- "@testing-library/jest-dom": "^6.6.4",
64
- "@testing-library/react": "^16.3.0",
65
- "@testing-library/user-event": "^14.6.1",
66
- "@types/bun": "latest",
67
- "@types/node": "^24.5.2",
68
- "@types/react": "^19.1.8",
69
- "@types/react-dom": "^19.1.6",
70
- "@vitest/coverage-v8": "^3.2.4",
71
- "@vitest/ui": "^3.2.4",
72
- "concurrently": "^9.2.0",
73
- "cross-env": "^10.1.0",
74
- "eslint": "^9.30.1",
75
- "eslint-plugin-react-hooks": "^5.2.0",
76
- "eslint-plugin-react-refresh": "^0.4.20",
77
- "globals": "^16.3.0",
78
- "jsdom": "^26.1.0",
79
- "rollup": "4.20.0",
80
- "tailwindcss": "^4.1.13",
81
- "typescript": "^5.8.3",
82
- "typescript-eslint": "^8.35.1",
83
- "vite-plugin-node-polyfills": "^0.24.0",
84
- "vitest": "^3.2.4"
85
- },
86
- "dependencies": {
87
- "@elysiajs/eden": "^1.3.2",
88
- "@elysiajs/swagger": "^1.3.1",
89
- "@noble/curves": "^1.2.0",
90
- "@noble/hashes": "^1.3.2",
91
- "@types/http-proxy-middleware": "^1.0.0",
92
- "@types/ws": "^8.18.1",
93
- "@vitejs/plugin-react": "^4.6.0",
94
- "chalk": "^5.3.0",
95
- "chokidar": "^4.0.3",
96
- "commander": "^12.1.0",
97
- "elysia": "^1.4.6",
98
- "http-proxy-middleware": "^3.0.5",
99
- "lightningcss": "^1.30.1",
100
- "lucide-react": "^0.544.0",
101
- "ora": "^8.1.0",
102
- "react": "^19.1.0",
103
- "react-dom": "^19.1.0",
104
- "react-icons": "^5.5.0",
105
- "react-router-dom": "^7.9.3",
106
- "uuid": "^13.0.0",
107
- "vite": "^7.1.7",
108
- "ws": "^8.18.3",
109
- "zustand": "^5.0.8"
110
- },
111
- "engines": {
112
- "bun": ">=1.2.0"
113
- },
114
- "preferredPackageManager": "bun"
115
- }
1
+ {
2
+ "name": "create-fluxstack",
3
+ "version": "1.4.0",
4
+ "description": "⚡ Revolutionary full-stack TypeScript framework with Declarative Config System, Elysia + React + Bun",
5
+ "keywords": [
6
+ "framework",
7
+ "full-stack",
8
+ "typescript",
9
+ "elysia",
10
+ "react",
11
+ "bun",
12
+ "vite"
13
+ ],
14
+ "author": "FluxStack Team",
15
+ "license": "MIT",
16
+ "homepage": "https://github.com/MarcosBrendonDePaula/FluxStack",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/MarcosBrendonDePaula/FluxStack.git"
20
+ },
21
+ "module": "app/server/index.ts",
22
+ "type": "module",
23
+ "bin": {
24
+ "create-fluxstack": "create-fluxstack.ts"
25
+ },
26
+ "scripts": {
27
+ "dev": "bun run core/cli/index.ts dev",
28
+ "dev:frontend": "bun run core/cli/index.ts frontend",
29
+ "dev:backend": "bun run core/cli/index.ts backend",
30
+ "dev:coordinated": "concurrently --prefix {name} --names BACKEND,VITE --prefix-colors blue,green --kill-others-on-fail \"bun --watch app/server/index.ts\" \"vite --config vite.config.ts\"",
31
+ "dev:clean": "bun run run-clean.ts",
32
+ "build": "cross-env NODE_ENV=production bun run core/cli/index.ts build",
33
+ "build:frontend": "vite build --config vite.config.ts --emptyOutDir",
34
+ "build:backend": "bun run core/cli/index.ts build:backend",
35
+ "start": "bun run core/cli/index.ts start",
36
+ "start:frontend": "bun run app/client/frontend-only.ts",
37
+ "start:backend": "bun run app/server/backend-only.ts",
38
+ "docker:build": "cd dist && docker build -t fluxstack-app .",
39
+ "docker:run": "cd dist && docker run -p 3000:3000 fluxstack-app",
40
+ "docker:compose": "cd dist && docker-compose up -d",
41
+ "docker:stop": "cd dist && docker-compose down",
42
+ "create": "bun run core/cli/index.ts create",
43
+ "cli": "bun run core/cli/index.ts",
44
+ "make:component": "bun run core/cli/index.ts make:component",
45
+ "make:live": "bun run core/cli/index.ts make:component",
46
+ "test": "vitest",
47
+ "test:ui": "vitest --ui",
48
+ "test:run": "vitest run",
49
+ "test:coverage": "vitest run --coverage",
50
+ "test:watch": "vitest --watch",
51
+ "test:live": "tsx scripts/test-live-components.ts",
52
+ "test:live:coverage": "tsx scripts/test-live-components.ts --coverage",
53
+ "test:live:watch": "tsx scripts/test-live-components.ts --watch",
54
+ "test:live:verbose": "tsx scripts/test-live-components.ts --verbose",
55
+ "test:config": "bun run core/config/__tests__/run-tests.ts",
56
+ "test:config:coverage": "bun run core/config/__tests__/run-tests.ts coverage",
57
+ "test:config:manual": "bun run core/config/__tests__/manual-test.ts",
58
+ "legacy:dev": "bun --watch app/server/index.ts"
59
+ },
60
+ "devDependencies": {
61
+ "@eslint/js": "^9.30.1",
62
+ "@tailwindcss/vite": "^4.1.13",
63
+ "@testing-library/jest-dom": "^6.6.4",
64
+ "@testing-library/react": "^16.3.0",
65
+ "@testing-library/user-event": "^14.6.1",
66
+ "@types/bun": "latest",
67
+ "@types/node": "^24.5.2",
68
+ "@types/react": "^19.1.8",
69
+ "@types/react-dom": "^19.1.6",
70
+ "@vitest/coverage-v8": "^3.2.4",
71
+ "@vitest/ui": "^3.2.4",
72
+ "concurrently": "^9.2.0",
73
+ "cross-env": "^10.1.0",
74
+ "eslint": "^9.30.1",
75
+ "eslint-plugin-react-hooks": "^5.2.0",
76
+ "eslint-plugin-react-refresh": "^0.4.20",
77
+ "globals": "^16.3.0",
78
+ "jsdom": "^26.1.0",
79
+ "rollup": "4.20.0",
80
+ "tailwindcss": "^4.1.13",
81
+ "typescript": "^5.8.3",
82
+ "typescript-eslint": "^8.35.1",
83
+ "vite-plugin-node-polyfills": "^0.24.0",
84
+ "vitest": "^3.2.4"
85
+ },
86
+ "dependencies": {
87
+ "@elysiajs/eden": "^1.3.2",
88
+ "@elysiajs/swagger": "^1.3.1",
89
+ "@noble/curves": "^1.2.0",
90
+ "@noble/hashes": "^1.3.2",
91
+ "@types/http-proxy-middleware": "^1.0.0",
92
+ "@types/ws": "^8.18.1",
93
+ "@vitejs/plugin-react": "^4.6.0",
94
+ "chalk": "^5.3.0",
95
+ "chokidar": "^4.0.3",
96
+ "commander": "^12.1.0",
97
+ "elysia": "^1.4.6",
98
+ "http-proxy-middleware": "^3.0.5",
99
+ "lightningcss": "^1.30.1",
100
+ "lucide-react": "^0.544.0",
101
+ "ora": "^8.1.0",
102
+ "react": "^19.1.0",
103
+ "react-dom": "^19.1.0",
104
+ "react-icons": "^5.5.0",
105
+ "react-router-dom": "^7.9.3",
106
+ "uuid": "^13.0.0",
107
+ "vite": "^7.1.7",
108
+ "winston": "^3.18.3",
109
+ "winston-daily-rotate-file": "^5.0.0",
110
+ "ws": "^8.18.3",
111
+ "zustand": "^5.0.8"
112
+ },
113
+ "engines": {
114
+ "bun": ">=1.2.0"
115
+ },
116
+ "preferredPackageManager": "bun"
117
+ }