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.
- package/.dockerignore +1 -2
- package/Dockerfile +8 -8
- package/LLMD/INDEX.md +64 -0
- package/LLMD/MAINTENANCE.md +197 -0
- package/LLMD/MIGRATION.md +156 -0
- package/LLMD/config/.gitkeep +1 -0
- package/LLMD/config/declarative-system.md +268 -0
- package/LLMD/config/environment-vars.md +327 -0
- package/LLMD/config/runtime-reload.md +401 -0
- package/LLMD/core/.gitkeep +1 -0
- package/LLMD/core/build-system.md +599 -0
- package/LLMD/core/framework-lifecycle.md +229 -0
- package/LLMD/core/plugin-system.md +451 -0
- package/LLMD/patterns/.gitkeep +1 -0
- package/LLMD/patterns/anti-patterns.md +297 -0
- package/LLMD/patterns/project-structure.md +264 -0
- package/LLMD/patterns/type-safety.md +440 -0
- package/LLMD/reference/.gitkeep +1 -0
- package/LLMD/reference/cli-commands.md +250 -0
- package/LLMD/reference/plugin-hooks.md +357 -0
- package/LLMD/reference/routing.md +39 -0
- package/LLMD/reference/troubleshooting.md +364 -0
- package/LLMD/resources/.gitkeep +1 -0
- package/LLMD/resources/controllers.md +465 -0
- package/LLMD/resources/live-components.md +703 -0
- package/LLMD/resources/live-rooms.md +482 -0
- package/LLMD/resources/live-upload.md +130 -0
- package/LLMD/resources/plugins-external.md +617 -0
- package/LLMD/resources/routes-eden.md +254 -0
- package/README.md +37 -17
- package/app/client/index.html +0 -1
- package/app/client/src/App.tsx +107 -150
- package/app/client/src/components/AppLayout.tsx +68 -0
- package/app/client/src/components/BackButton.tsx +13 -0
- package/app/client/src/components/DemoPage.tsx +20 -0
- package/app/client/src/components/LiveUploadWidget.tsx +204 -0
- package/app/client/src/lib/eden-api.ts +85 -60
- package/app/client/src/live/ChatDemo.tsx +107 -0
- package/app/client/src/live/CounterDemo.tsx +206 -0
- package/app/client/src/live/FormDemo.tsx +119 -0
- package/app/client/src/live/RoomChatDemo.tsx +242 -0
- package/app/client/src/live/UploadDemo.tsx +21 -0
- package/app/client/src/main.tsx +4 -1
- package/app/client/src/pages/ApiTestPage.tsx +108 -0
- package/app/client/src/pages/HomePage.tsx +76 -0
- package/app/server/app.ts +1 -4
- package/app/server/controllers/users.controller.ts +36 -44
- package/app/server/index.ts +25 -35
- package/app/server/live/LiveChat.ts +77 -0
- package/app/server/live/LiveCounter.ts +67 -0
- package/app/server/live/LiveForm.ts +63 -0
- package/app/server/live/LiveLocalCounter.ts +32 -0
- package/app/server/live/LiveRoomChat.ts +285 -0
- package/app/server/live/LiveUpload.ts +81 -0
- package/app/server/routes/index.ts +3 -1
- package/app/server/routes/room.routes.ts +117 -0
- package/app/server/routes/users.routes.ts +35 -27
- package/app/shared/types/index.ts +14 -2
- package/config/app.config.ts +2 -62
- package/config/client.config.ts +2 -95
- package/config/database.config.ts +2 -99
- package/config/fluxstack.config.ts +25 -45
- package/config/index.ts +57 -38
- package/config/monitoring.config.ts +2 -114
- package/config/plugins.config.ts +2 -80
- package/config/server.config.ts +2 -68
- package/config/services.config.ts +2 -130
- package/config/system/app.config.ts +29 -0
- package/config/system/build.config.ts +49 -0
- package/config/system/client.config.ts +68 -0
- package/config/system/database.config.ts +17 -0
- package/config/system/fluxstack.config.ts +114 -0
- package/config/{logger.config.ts → system/logger.config.ts} +3 -1
- package/config/system/monitoring.config.ts +114 -0
- package/config/system/plugins.config.ts +84 -0
- package/config/{runtime.config.ts → system/runtime.config.ts} +1 -1
- package/config/system/server.config.ts +68 -0
- package/config/system/services.config.ts +46 -0
- package/config/{system.config.ts → system/system.config.ts} +1 -1
- package/core/build/flux-plugins-generator.ts +325 -325
- package/core/build/index.ts +39 -27
- package/core/build/live-components-generator.ts +3 -3
- package/core/build/optimizer.ts +235 -235
- package/core/cli/command-registry.ts +6 -4
- package/core/cli/commands/build.ts +79 -0
- package/core/cli/commands/create.ts +54 -0
- package/core/cli/commands/dev.ts +101 -0
- package/core/cli/commands/help.ts +34 -0
- package/core/cli/commands/index.ts +34 -0
- package/core/cli/commands/make-plugin.ts +90 -0
- package/core/cli/commands/plugin-add.ts +197 -0
- package/core/cli/commands/plugin-deps.ts +2 -2
- package/core/cli/commands/plugin-list.ts +208 -0
- package/core/cli/commands/plugin-remove.ts +170 -0
- package/core/cli/generators/component.ts +769 -769
- package/core/cli/generators/controller.ts +1 -1
- package/core/cli/generators/index.ts +146 -146
- package/core/cli/generators/interactive.ts +227 -227
- package/core/cli/generators/plugin.ts +2 -2
- package/core/cli/generators/prompts.ts +82 -82
- package/core/cli/generators/route.ts +6 -6
- package/core/cli/generators/service.ts +2 -2
- package/core/cli/generators/template-engine.ts +4 -3
- package/core/cli/generators/types.ts +2 -2
- package/core/cli/generators/utils.ts +191 -191
- package/core/cli/index.ts +115 -686
- package/core/cli/plugin-discovery.ts +2 -2
- package/core/client/LiveComponentsProvider.tsx +60 -8
- package/core/client/api/eden.ts +183 -0
- package/core/client/api/index.ts +11 -0
- package/core/client/components/Live.tsx +104 -0
- package/core/client/fluxstack.ts +1 -9
- package/core/client/hooks/AdaptiveChunkSizer.ts +215 -215
- package/core/client/hooks/state-validator.ts +1 -1
- package/core/client/hooks/useAuth.ts +48 -48
- package/core/client/hooks/useChunkedUpload.ts +85 -35
- package/core/client/hooks/useLiveChunkedUpload.ts +87 -0
- package/core/client/hooks/useLiveComponent.ts +800 -0
- package/core/client/hooks/useLiveUpload.ts +71 -0
- package/core/client/hooks/useRoom.ts +409 -0
- package/core/client/hooks/useRoomProxy.ts +382 -0
- package/core/client/index.ts +17 -68
- package/core/client/standalone-entry.ts +8 -0
- package/core/client/standalone.ts +74 -53
- package/core/client/state/createStore.ts +192 -192
- package/core/client/state/index.ts +14 -14
- package/core/config/index.ts +70 -291
- package/core/config/schema.ts +42 -723
- package/core/framework/client.ts +131 -131
- package/core/framework/index.ts +7 -7
- package/core/framework/server.ts +47 -40
- package/core/framework/types.ts +2 -2
- package/core/index.ts +23 -4
- package/core/live/ComponentRegistry.ts +3 -3
- package/core/live/types.ts +77 -0
- package/core/plugins/built-in/index.ts +134 -134
- package/core/plugins/built-in/live-components/commands/create-live-component.ts +242 -1066
- package/core/plugins/built-in/live-components/index.ts +1 -1
- package/core/plugins/built-in/monitoring/index.ts +111 -47
- package/core/plugins/built-in/static/index.ts +1 -1
- package/core/plugins/built-in/swagger/index.ts +68 -265
- package/core/plugins/built-in/vite/index.ts +85 -185
- package/core/plugins/built-in/vite/vite-dev.ts +10 -16
- package/core/plugins/config.ts +9 -7
- package/core/plugins/dependency-manager.ts +31 -1
- package/core/plugins/discovery.ts +19 -7
- package/core/plugins/executor.ts +2 -2
- package/core/plugins/index.ts +203 -203
- package/core/plugins/manager.ts +27 -39
- package/core/plugins/module-resolver.ts +19 -8
- package/core/plugins/registry.ts +255 -19
- package/core/plugins/types.ts +20 -53
- package/core/server/framework.ts +66 -43
- package/core/server/index.ts +15 -15
- package/core/server/live/ComponentRegistry.ts +78 -71
- package/core/server/live/FileUploadManager.ts +23 -10
- package/core/server/live/LiveComponentPerformanceMonitor.ts +1 -1
- package/core/server/live/LiveRoomManager.ts +261 -0
- package/core/server/live/RoomEventBus.ts +234 -0
- package/core/server/live/RoomStateManager.ts +172 -0
- package/core/server/live/StateSignature.ts +643 -643
- package/core/server/live/WebSocketConnectionManager.ts +30 -19
- package/core/server/live/auto-generated-components.ts +21 -9
- package/core/server/live/index.ts +14 -0
- package/core/server/live/websocket-plugin.ts +214 -67
- package/core/server/middleware/elysia-helpers.ts +7 -2
- package/core/server/middleware/errorHandling.ts +1 -1
- package/core/server/middleware/index.ts +31 -31
- package/core/server/plugins/database.ts +180 -180
- package/core/server/plugins/static-files-plugin.ts +69 -69
- package/core/server/plugins/swagger.ts +1 -1
- package/core/server/rooms/RoomBroadcaster.ts +357 -0
- package/core/server/rooms/RoomSystem.ts +463 -0
- package/core/server/rooms/index.ts +13 -0
- package/core/server/services/BaseService.ts +1 -1
- package/core/server/services/ServiceContainer.ts +1 -1
- package/core/server/services/index.ts +8 -8
- package/core/templates/create-project.ts +12 -12
- package/core/testing/index.ts +9 -9
- package/core/testing/setup.ts +73 -73
- package/core/types/api.ts +168 -168
- package/core/types/build.ts +219 -219
- package/core/types/config.ts +56 -26
- package/core/types/index.ts +4 -4
- package/core/types/plugin.ts +107 -107
- package/core/types/types.ts +353 -14
- package/core/utils/build-logger.ts +324 -324
- package/core/utils/config-schema.ts +480 -480
- package/core/utils/env.ts +2 -8
- package/core/utils/errors/codes.ts +114 -114
- package/core/utils/errors/handlers.ts +36 -1
- package/core/utils/errors/index.ts +49 -5
- package/core/utils/errors/middleware.ts +113 -113
- package/core/utils/helpers.ts +6 -16
- package/core/utils/index.ts +17 -17
- package/core/utils/logger/colors.ts +114 -114
- package/core/utils/logger/config.ts +13 -9
- package/core/utils/logger/formatter.ts +82 -82
- package/core/utils/logger/group-logger.ts +101 -101
- package/core/utils/logger/index.ts +6 -1
- package/core/utils/logger/stack-trace.ts +3 -1
- package/core/utils/logger/startup-banner.ts +82 -82
- package/core/utils/logger/winston-logger.ts +152 -152
- package/core/utils/monitoring/index.ts +211 -211
- package/core/utils/sync-version.ts +66 -66
- package/core/utils/version.ts +1 -1
- package/create-fluxstack.ts +8 -7
- package/package.json +12 -13
- package/plugins/crypto-auth/cli/make-protected-route.command.ts +1 -1
- package/plugins/crypto-auth/client/CryptoAuthClient.ts +302 -302
- package/plugins/crypto-auth/client/components/index.ts +11 -11
- package/plugins/crypto-auth/client/index.ts +11 -11
- package/plugins/crypto-auth/config/index.ts +1 -1
- package/plugins/crypto-auth/index.ts +4 -4
- package/plugins/crypto-auth/package.json +65 -65
- package/plugins/crypto-auth/server/AuthMiddleware.ts +1 -1
- package/plugins/crypto-auth/server/CryptoAuthService.ts +185 -185
- package/plugins/crypto-auth/server/index.ts +21 -21
- package/plugins/crypto-auth/server/middlewares/cryptoAuthAdmin.ts +3 -3
- package/plugins/crypto-auth/server/middlewares/cryptoAuthOptional.ts +1 -1
- package/plugins/crypto-auth/server/middlewares/cryptoAuthPermissions.ts +2 -2
- package/plugins/crypto-auth/server/middlewares/cryptoAuthRequired.ts +2 -2
- package/plugins/crypto-auth/server/middlewares/helpers.ts +1 -1
- package/plugins/crypto-auth/server/middlewares/index.ts +22 -22
- package/tsconfig.api-strict.json +16 -0
- package/tsconfig.json +48 -52
- package/{app/client/tsconfig.node.json → tsconfig.node.json} +25 -25
- package/types/global.d.ts +29 -29
- package/types/vitest.d.ts +8 -8
- package/vite.config.ts +38 -62
- package/vitest.config.live.ts +10 -9
- package/vitest.config.ts +29 -17
- package/app/client/README.md +0 -69
- package/app/client/SIMPLIFICATION.md +0 -140
- package/app/client/frontend-only.ts +0 -12
- package/app/client/src/live/FileUploadExample.tsx +0 -359
- package/app/client/src/live/MinimalLiveClock.tsx +0 -47
- package/app/client/src/live/QuickUploadTest.tsx +0 -193
- package/app/client/tsconfig.app.json +0 -45
- package/app/client/tsconfig.json +0 -7
- package/app/client/zustand-setup.md +0 -65
- package/app/server/backend-only.ts +0 -18
- package/app/server/live/LiveClockComponent.ts +0 -215
- package/app/server/live/LiveFileUploadComponent.ts +0 -77
- package/app/server/routes/env-test.ts +0 -110
- package/core/client/hooks/index.ts +0 -7
- package/core/client/hooks/useHybridLiveComponent.ts +0 -685
- package/core/client/hooks/useTypedLiveComponent.ts +0 -133
- package/core/client/hooks/useWebSocket.ts +0 -361
- package/core/config/env.ts +0 -546
- package/core/config/loader.ts +0 -522
- package/core/config/runtime-config.ts +0 -327
- package/core/config/validator.ts +0 -540
- package/core/server/backend-entry.ts +0 -51
- package/core/server/standalone.ts +0 -106
- package/core/utils/regenerate-files.ts +0 -69
- package/fluxstack.config.ts +0 -354
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Declarative Configuration System
|
|
2
|
+
|
|
3
|
+
**Version:** 1.11.0 | **Updated:** 2025-02-08
|
|
4
|
+
|
|
5
|
+
## Quick Facts
|
|
6
|
+
|
|
7
|
+
- Laravel-inspired schema-based configuration with automatic validation
|
|
8
|
+
- Type-safe config with full TypeScript inference
|
|
9
|
+
- Environment variable mapping with type casting
|
|
10
|
+
- Runtime reload support via `ReactiveConfig`
|
|
11
|
+
- Located in `config/system/*.config.ts`
|
|
12
|
+
- Core implementation: `core/utils/config-schema.ts`
|
|
13
|
+
|
|
14
|
+
## defineConfig Function
|
|
15
|
+
|
|
16
|
+
Creates a static configuration object from a schema:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { defineConfig, config } from '@core/utils/config-schema'
|
|
20
|
+
|
|
21
|
+
const appConfig = defineConfig({
|
|
22
|
+
name: config.string('APP_NAME', 'MyApp', true),
|
|
23
|
+
port: config.number('PORT', 3000, true),
|
|
24
|
+
env: config.enum('NODE_ENV', ['development', 'production'] as const, 'development')
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Type-safe access
|
|
28
|
+
appConfig.name // string
|
|
29
|
+
appConfig.port // number
|
|
30
|
+
appConfig.env // "development" | "production"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## ConfigField Types
|
|
34
|
+
|
|
35
|
+
### string
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
{
|
|
39
|
+
type: 'string',
|
|
40
|
+
env: 'VAR_NAME',
|
|
41
|
+
default: 'value',
|
|
42
|
+
required: false
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Shorthand
|
|
46
|
+
config.string('VAR_NAME', 'default', required)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### number
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
{
|
|
53
|
+
type: 'number',
|
|
54
|
+
env: 'PORT',
|
|
55
|
+
default: 3000,
|
|
56
|
+
required: true,
|
|
57
|
+
validate: (value) => value > 0 && value < 65536
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Shorthand
|
|
61
|
+
config.number('PORT', 3000, true)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Casts string env vars to numbers automatically.
|
|
65
|
+
|
|
66
|
+
### boolean
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
{
|
|
70
|
+
type: 'boolean',
|
|
71
|
+
env: 'ENABLE_FEATURE',
|
|
72
|
+
default: false
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Shorthand
|
|
76
|
+
config.boolean('ENABLE_FEATURE', false)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Accepts: `true`, `1`, `yes`, `on` (case-insensitive) as true.
|
|
80
|
+
|
|
81
|
+
### array
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
{
|
|
85
|
+
type: 'array',
|
|
86
|
+
env: 'ALLOWED_HOSTS',
|
|
87
|
+
default: ['localhost']
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Shorthand
|
|
91
|
+
config.array('ALLOWED_HOSTS', ['localhost'])
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Parses comma-separated strings: `"host1,host2,host3"` → `['host1', 'host2', 'host3']`
|
|
95
|
+
|
|
96
|
+
### object
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
{
|
|
100
|
+
type: 'object',
|
|
101
|
+
env: 'METADATA',
|
|
102
|
+
default: {}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Parses JSON strings from env vars.
|
|
107
|
+
|
|
108
|
+
### enum
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
{
|
|
112
|
+
type: 'enum',
|
|
113
|
+
env: 'NODE_ENV',
|
|
114
|
+
values: ['development', 'production', 'test'] as const,
|
|
115
|
+
default: 'development',
|
|
116
|
+
validate: (value) => value !== 'test' || 'Test mode not allowed'
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Shorthand
|
|
120
|
+
config.enum('NODE_ENV', ['development', 'production'] as const, 'development')
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Validates value is in allowed list. TypeScript infers union type.
|
|
124
|
+
|
|
125
|
+
## Validation
|
|
126
|
+
|
|
127
|
+
### Built-in Validation
|
|
128
|
+
|
|
129
|
+
- **Required fields**: Throws error if missing
|
|
130
|
+
- **Type casting**: Automatic conversion from env strings
|
|
131
|
+
- **Enum validation**: Ensures value in allowed list
|
|
132
|
+
|
|
133
|
+
### Custom Validation
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
{
|
|
137
|
+
type: 'number',
|
|
138
|
+
env: 'PORT',
|
|
139
|
+
default: 3000,
|
|
140
|
+
validate: (value: number) => {
|
|
141
|
+
if (value < 1 || value > 65535) {
|
|
142
|
+
return 'Port must be between 1 and 65535'
|
|
143
|
+
}
|
|
144
|
+
return true
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Return `true` for valid, `false` or error string for invalid.
|
|
150
|
+
|
|
151
|
+
### Validation Errors
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
// Throws on startup if validation fails:
|
|
155
|
+
// ❌ Configuration validation failed:
|
|
156
|
+
// - Field 'port' is required but not provided
|
|
157
|
+
// - Field 'env' must be one of: development, production (got: "staging")
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## ReactiveConfig (Runtime Reload)
|
|
161
|
+
|
|
162
|
+
For configs that need runtime updates:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
import { defineReactiveConfig } from '@core/utils/config-schema'
|
|
166
|
+
|
|
167
|
+
const reactiveConfig = defineReactiveConfig({
|
|
168
|
+
feature: config.boolean('FEATURE_FLAG', false)
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
// Access values
|
|
172
|
+
reactiveConfig.values.feature // false
|
|
173
|
+
|
|
174
|
+
// Watch for changes
|
|
175
|
+
const unwatch = reactiveConfig.watch((newConfig) => {
|
|
176
|
+
console.log('Config updated:', newConfig.feature)
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
// Reload from environment
|
|
180
|
+
reactiveConfig.reload()
|
|
181
|
+
|
|
182
|
+
// Stop watching
|
|
183
|
+
unwatch()
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
See [runtime-reload.md](./runtime-reload.md) for detailed usage.
|
|
187
|
+
|
|
188
|
+
## Nested Configuration
|
|
189
|
+
|
|
190
|
+
Group related configs:
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
import { defineNestedConfig } from '@core/utils/config-schema'
|
|
194
|
+
|
|
195
|
+
const serverConfig = defineNestedConfig({
|
|
196
|
+
server: {
|
|
197
|
+
port: config.number('PORT', 3000),
|
|
198
|
+
host: config.string('HOST', 'localhost')
|
|
199
|
+
},
|
|
200
|
+
cors: {
|
|
201
|
+
origins: config.array('CORS_ORIGINS', ['http://localhost:3000']),
|
|
202
|
+
credentials: config.boolean('CORS_CREDENTIALS', false)
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
// Access nested
|
|
207
|
+
serverConfig.server.port // 3000
|
|
208
|
+
serverConfig.cors.origins // ['http://localhost:3000']
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Helper Functions
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
import { config } from '@core/utils/config-schema'
|
|
215
|
+
|
|
216
|
+
// All helpers: (envVar, default, required)
|
|
217
|
+
config.string('VAR', 'default', false)
|
|
218
|
+
config.number('VAR', 42, true)
|
|
219
|
+
config.boolean('VAR', false)
|
|
220
|
+
config.array('VAR', ['item'])
|
|
221
|
+
config.enum('VAR', ['a', 'b'] as const, 'a')
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Custom Transformers
|
|
225
|
+
|
|
226
|
+
Apply custom logic before validation:
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
{
|
|
230
|
+
type: 'string',
|
|
231
|
+
env: 'API_URL',
|
|
232
|
+
default: 'http://localhost:3000',
|
|
233
|
+
transform: (value) => value.endsWith('/') ? value.slice(0, -1) : value
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Configuration Files
|
|
238
|
+
|
|
239
|
+
All system configs in `config/system/`:
|
|
240
|
+
|
|
241
|
+
- `app.config.ts` - Application metadata
|
|
242
|
+
- `server.config.ts` - Server and CORS settings
|
|
243
|
+
- `client.config.ts` - Frontend configuration
|
|
244
|
+
- `build.config.ts` - Build settings
|
|
245
|
+
- `database.config.ts` - Database connection
|
|
246
|
+
- `plugins.config.ts` - Plugin system settings
|
|
247
|
+
- `services.config.ts` - External services
|
|
248
|
+
- `monitoring.config.ts` - Logging and metrics
|
|
249
|
+
|
|
250
|
+
## Type Inference
|
|
251
|
+
|
|
252
|
+
Full TypeScript type safety:
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
const config = defineConfig({
|
|
256
|
+
port: config.number('PORT', 3000),
|
|
257
|
+
env: config.enum('NODE_ENV', ['dev', 'prod'] as const, 'dev')
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
// Inferred types:
|
|
261
|
+
config.port // number
|
|
262
|
+
config.env // "dev" | "prod"
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Related
|
|
266
|
+
|
|
267
|
+
- [Environment Variables](./environment-vars.md) - Complete env var reference
|
|
268
|
+
- [Runtime Reload](./runtime-reload.md) - ReactiveConfig usage patterns
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
# Environment Variables Reference
|
|
2
|
+
|
|
3
|
+
**Version:** 1.11.0 | **Updated:** 2025-02-08
|
|
4
|
+
|
|
5
|
+
## Quick Facts
|
|
6
|
+
|
|
7
|
+
- All env vars are optional (have defaults)
|
|
8
|
+
- Type casting automatic (strings → numbers/booleans)
|
|
9
|
+
- Validation on startup
|
|
10
|
+
- Defined in `config/system/*.config.ts`
|
|
11
|
+
|
|
12
|
+
## Application
|
|
13
|
+
|
|
14
|
+
| Variable | Type | Default | Description | Config File |
|
|
15
|
+
|----------|------|---------|-------------|-------------|
|
|
16
|
+
| `APP_NAME` | string | `'fluxstack-app'` | Application name | app.config.ts |
|
|
17
|
+
| `APP_VERSION` | string | `'1.0.0'` | Application version | app.config.ts |
|
|
18
|
+
| `APP_DESCRIPTION` | string | `'A FluxStack application'` | Application description | app.config.ts |
|
|
19
|
+
| `NODE_ENV` | enum | `'development'` | Environment: `development`, `production`, `test` | app.config.ts |
|
|
20
|
+
| `FLUXSTACK_MODE` | enum | `'full-stack'` | Runtime mode: `full-stack`, `backend-only`, `frontend-only` | app.config.ts |
|
|
21
|
+
| `APP_TRUST_PROXY` | boolean | `false` | Trust proxy headers | app.config.ts |
|
|
22
|
+
| `APP_SESSION_SECRET` | string | `''` | Session secret key | app.config.ts |
|
|
23
|
+
|
|
24
|
+
## Server
|
|
25
|
+
|
|
26
|
+
| Variable | Type | Default | Description | Config File |
|
|
27
|
+
|----------|------|---------|-------------|-------------|
|
|
28
|
+
| `PORT` | number | `3000` | Server port (1-65535) | server.config.ts |
|
|
29
|
+
| `HOST` | string | `'localhost'` | Server host | server.config.ts |
|
|
30
|
+
| `API_PREFIX` | string | `'/api'` | API route prefix (must start with `/`) | server.config.ts |
|
|
31
|
+
| `BACKEND_PORT` | number | `3001` | Backend-only mode port | server.config.ts |
|
|
32
|
+
| `ENABLE_REQUEST_LOGGING` | boolean | `true` | Enable request logging | server.config.ts |
|
|
33
|
+
| `SHOW_SERVER_BANNER` | boolean | `true` | Show startup banner | server.config.ts |
|
|
34
|
+
|
|
35
|
+
## CORS
|
|
36
|
+
|
|
37
|
+
| Variable | Type | Default | Description | Config File |
|
|
38
|
+
|----------|------|---------|-------------|-------------|
|
|
39
|
+
| `CORS_ORIGINS` | array | `['http://localhost:3000', 'http://localhost:5173']` | Allowed origins (comma-separated) | server.config.ts |
|
|
40
|
+
| `CORS_METHODS` | array | `['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']` | Allowed HTTP methods | server.config.ts |
|
|
41
|
+
| `CORS_HEADERS` | array | `['Content-Type', 'Authorization']` | Allowed headers | server.config.ts |
|
|
42
|
+
| `CORS_CREDENTIALS` | boolean | `false` | Allow credentials | server.config.ts |
|
|
43
|
+
| `CORS_MAX_AGE` | number | `86400` | Preflight cache duration (seconds) | server.config.ts |
|
|
44
|
+
|
|
45
|
+
## Client (Vite)
|
|
46
|
+
|
|
47
|
+
| Variable | Type | Default | Description | Config File |
|
|
48
|
+
|----------|------|---------|-------------|-------------|
|
|
49
|
+
| `VITE_PORT` | number | `5173` | Vite dev server port | client.config.ts |
|
|
50
|
+
| `VITE_HOST` | string | `'localhost'` | Vite dev server host | client.config.ts |
|
|
51
|
+
| `VITE_STRICT_PORT` | boolean | `true` | Fail if port unavailable | client.config.ts |
|
|
52
|
+
| `VITE_OPEN` | boolean | `false` | Auto-open browser | client.config.ts |
|
|
53
|
+
| `ENABLE_VITE_PROXY_LOGS` | boolean | `false` | Enable proxy logging | client.config.ts |
|
|
54
|
+
| `VITE_LOG_LEVEL` | enum | `undefined` | Log level: `error`, `warn`, `info`, `silent` | client.config.ts |
|
|
55
|
+
|
|
56
|
+
## Client Build
|
|
57
|
+
|
|
58
|
+
| Variable | Type | Default | Description | Config File |
|
|
59
|
+
|----------|------|---------|-------------|-------------|
|
|
60
|
+
| `CLIENT_OUTDIR` | string | `'dist/client'` | Client build output directory | client.config.ts |
|
|
61
|
+
| `CLIENT_SOURCEMAPS` | boolean | `true` (dev) / `false` (prod) | Generate source maps | client.config.ts |
|
|
62
|
+
| `CLIENT_MINIFY` | boolean | `false` (dev) / `true` (prod) | Minify output | client.config.ts |
|
|
63
|
+
| `CLIENT_TARGET` | string | `'esnext'` | Build target | client.config.ts |
|
|
64
|
+
| `CLIENT_ASSETS_DIR` | string | `'assets'` | Assets directory name | client.config.ts |
|
|
65
|
+
| `CLIENT_CSS_CODE_SPLIT` | boolean | `true` | Split CSS into chunks | client.config.ts |
|
|
66
|
+
| `CLIENT_CHUNK_SIZE_WARNING` | number | `500` | Chunk size warning limit (KB) | client.config.ts |
|
|
67
|
+
| `CLIENT_EMPTY_OUTDIR` | boolean | `true` | Empty output dir before build | client.config.ts |
|
|
68
|
+
|
|
69
|
+
## Build
|
|
70
|
+
|
|
71
|
+
| Variable | Type | Default | Description | Config File |
|
|
72
|
+
|----------|------|---------|-------------|-------------|
|
|
73
|
+
| `BUILD_TARGET` | enum | `'bun'` | Build target: `bun`, `node`, `docker` | build.config.ts |
|
|
74
|
+
| `BUILD_OUT_DIR` | string | `'dist'` | Build output directory | build.config.ts |
|
|
75
|
+
| `BUILD_SOURCE_MAPS` | boolean | `true` (dev) / `false` (prod) | Generate source maps | build.config.ts |
|
|
76
|
+
| `BUILD_CLEAN` | boolean | `true` | Clean output dir before build | build.config.ts |
|
|
77
|
+
| `BUILD_MODE` | enum | `'development'` / `'production'` | Build mode | build.config.ts |
|
|
78
|
+
| `BUILD_EXTERNAL` | array | `[]` | External dependencies (comma-separated) | build.config.ts |
|
|
79
|
+
| `BUILD_OPTIMIZE` | boolean | `true` | Enable optimizations | build.config.ts |
|
|
80
|
+
|
|
81
|
+
## Build Optimization
|
|
82
|
+
|
|
83
|
+
| Variable | Type | Default | Description | Config File |
|
|
84
|
+
|----------|------|---------|-------------|-------------|
|
|
85
|
+
| `BUILD_MINIFY` | boolean | `false` (dev) / `true` (prod) | Minify code | build.config.ts |
|
|
86
|
+
| `BUILD_TREESHAKE` | boolean | `true` | Remove unused code | build.config.ts |
|
|
87
|
+
| `BUILD_COMPRESS` | boolean | `false` (dev) / `true` (prod) | Compress output | build.config.ts |
|
|
88
|
+
| `BUILD_SPLIT_CHUNKS` | boolean | `true` | Split code into chunks | build.config.ts |
|
|
89
|
+
| `BUILD_BUNDLE_ANALYZER` | boolean | `false` | Enable bundle analyzer | build.config.ts |
|
|
90
|
+
| `BUILD_REMOVE_UNUSED_CSS` | boolean | `false` | Remove unused CSS | build.config.ts |
|
|
91
|
+
| `BUILD_OPTIMIZE_IMAGES` | boolean | `false` | Optimize images | build.config.ts |
|
|
92
|
+
|
|
93
|
+
## Logging
|
|
94
|
+
|
|
95
|
+
| Variable | Type | Default | Description | Config File |
|
|
96
|
+
|----------|------|---------|-------------|-------------|
|
|
97
|
+
| `LOG_LEVEL` | enum | `'info'` | Log level: `debug`, `info`, `warn`, `error` | logger.config.ts |
|
|
98
|
+
| `LOG_FORMAT` | enum | `'pretty'` | Log format: `pretty`, `json` | logger.config.ts |
|
|
99
|
+
| `LOG_DATE_FORMAT` | string | `'YYYY-MM-DD HH:mm:ss'` | Date format string | logger.config.ts |
|
|
100
|
+
| `LOG_OBJECT_DEPTH` | number | `4` | Object inspection depth | logger.config.ts |
|
|
101
|
+
| `LOG_TO_FILE` | boolean | `false` | Enable file logging | logger.config.ts |
|
|
102
|
+
| `LOG_MAX_SIZE` | string | `'20m'` | Max log file size | logger.config.ts |
|
|
103
|
+
| `LOG_MAX_FILES` | string | `'14d'` | Max log file retention | logger.config.ts |
|
|
104
|
+
| `LOG_TRANSPORTS` | array | `['console']` | Log transports (comma-separated) | logger.config.ts |
|
|
105
|
+
| `LOG_COLORS` | boolean | `true` | Enable colored output | logger.config.ts |
|
|
106
|
+
| `LOG_STACK_TRACE` | boolean | `true` | Show stack traces | logger.config.ts |
|
|
107
|
+
|
|
108
|
+
## Plugins
|
|
109
|
+
|
|
110
|
+
| Variable | Type | Default | Description | Config File |
|
|
111
|
+
|----------|------|---------|-------------|-------------|
|
|
112
|
+
| `FLUXSTACK_PLUGINS_ENABLED` | array | `['logger', 'swagger', 'vite', 'cors', 'static-files']` | Enabled plugins | plugins.config.ts |
|
|
113
|
+
| `FLUXSTACK_PLUGINS_DISABLED` | array | `[]` | Disabled plugins | plugins.config.ts |
|
|
114
|
+
| `PLUGINS_AUTO_DISCOVER` | boolean | `true` | Auto-discover plugins | plugins.config.ts |
|
|
115
|
+
| `PLUGINS_DIR` | string | `'plugins'` | Plugins directory | plugins.config.ts |
|
|
116
|
+
| `PLUGINS_DISCOVER_NPM` | boolean | `false` | Discover npm plugins | plugins.config.ts |
|
|
117
|
+
| `PLUGINS_DISCOVER_PROJECT` | boolean | `true` | Discover project plugins | plugins.config.ts |
|
|
118
|
+
| `PLUGINS_ALLOWED` | array | `[]` | Whitelist of allowed plugins | plugins.config.ts |
|
|
119
|
+
| `LOGGER_PLUGIN_ENABLED` | boolean | `true` | Enable logger plugin | plugins.config.ts |
|
|
120
|
+
|
|
121
|
+
## Swagger
|
|
122
|
+
|
|
123
|
+
| Variable | Type | Default | Description | Config File |
|
|
124
|
+
|----------|------|---------|-------------|-------------|
|
|
125
|
+
| `SWAGGER_ENABLED` | boolean | `true` | Enable Swagger UI | plugins.config.ts |
|
|
126
|
+
| `SWAGGER_TITLE` | string | `'FluxStack API'` | API documentation title | plugins.config.ts |
|
|
127
|
+
| `SWAGGER_VERSION` | string | `'1.11.0'` | API version | plugins.config.ts |
|
|
128
|
+
| `SWAGGER_DESCRIPTION` | string | `'API documentation for FluxStack application'` | API description | plugins.config.ts |
|
|
129
|
+
| `SWAGGER_PATH` | string | `'/swagger'` | Swagger UI path | plugins.config.ts |
|
|
130
|
+
| `SWAGGER_EXCLUDE_PATHS` | array | `[]` | Paths to exclude from docs | plugins.config.ts |
|
|
131
|
+
| `SWAGGER_SERVERS` | string | `''` | API servers (JSON string) | plugins.config.ts |
|
|
132
|
+
| `SWAGGER_PERSIST_AUTH` | boolean | `true` | Persist authorization | plugins.config.ts |
|
|
133
|
+
| `SWAGGER_DISPLAY_DURATION` | boolean | `true` | Display request duration | plugins.config.ts |
|
|
134
|
+
| `SWAGGER_ENABLE_FILTER` | boolean | `true` | Enable endpoint filter | plugins.config.ts |
|
|
135
|
+
| `SWAGGER_SHOW_EXTENSIONS` | boolean | `true` | Show extensions | plugins.config.ts |
|
|
136
|
+
| `SWAGGER_TRY_IT_OUT` | boolean | `true` | Enable "Try it out" | plugins.config.ts |
|
|
137
|
+
| `SWAGGER_AUTH_ENABLED` | boolean | `false` | Enable basic auth for Swagger | plugins.config.ts |
|
|
138
|
+
| `SWAGGER_AUTH_USERNAME` | string | `'admin'` | Swagger auth username | plugins.config.ts |
|
|
139
|
+
| `SWAGGER_AUTH_PASSWORD` | string | `''` | Swagger auth password | plugins.config.ts |
|
|
140
|
+
|
|
141
|
+
## Static Files
|
|
142
|
+
|
|
143
|
+
| Variable | Type | Default | Description | Config File |
|
|
144
|
+
|----------|------|---------|-------------|-------------|
|
|
145
|
+
| `STATIC_FILES_ENABLED` | boolean | `true` | Enable static file serving | plugins.config.ts |
|
|
146
|
+
| `STATIC_PUBLIC_DIR` | string | `'public'` | Public files directory | plugins.config.ts |
|
|
147
|
+
| `STATIC_UPLOADS_DIR` | string | `'uploads'` | Uploads directory | plugins.config.ts |
|
|
148
|
+
| `STATIC_CACHE_MAX_AGE` | number | `31536000` | Cache max age (seconds) | plugins.config.ts |
|
|
149
|
+
| `STATIC_ENABLE_UPLOADS` | boolean | `true` | Enable uploads serving | plugins.config.ts |
|
|
150
|
+
| `STATIC_ENABLE_PUBLIC` | boolean | `true` | Enable public files serving | plugins.config.ts |
|
|
151
|
+
|
|
152
|
+
## Vite Plugin
|
|
153
|
+
|
|
154
|
+
| Variable | Type | Default | Description | Config File |
|
|
155
|
+
|----------|------|---------|-------------|-------------|
|
|
156
|
+
| `VITE_PLUGIN_ENABLED` | boolean | `true` | Enable Vite plugin | plugins.config.ts |
|
|
157
|
+
| `VITE_EXCLUDE_PATHS` | array | `['/api', '/swagger']` | Paths to exclude from Vite proxy | plugins.config.ts |
|
|
158
|
+
|
|
159
|
+
## Monitoring
|
|
160
|
+
|
|
161
|
+
| Variable | Type | Default | Description | Config File |
|
|
162
|
+
|----------|------|---------|-------------|-------------|
|
|
163
|
+
| `ENABLE_MONITORING` | boolean | `false` | Enable monitoring | monitoring.config.ts |
|
|
164
|
+
| `MONITORING_EXPORTERS` | array | `[]` | Monitoring exporters | monitoring.config.ts |
|
|
165
|
+
| `ENABLE_HEALTH_CHECKS` | boolean | `true` | Enable health checks | monitoring.config.ts |
|
|
166
|
+
| `HEALTH_CHECK_INTERVAL` | number | `30000` | Health check interval (ms) | monitoring.config.ts |
|
|
167
|
+
| `ENABLE_ALERTS` | boolean | `false` | Enable alerting | monitoring.config.ts |
|
|
168
|
+
| `ALERT_WEBHOOK` | string | `undefined` | Alert webhook URL | monitoring.config.ts |
|
|
169
|
+
|
|
170
|
+
## Metrics
|
|
171
|
+
|
|
172
|
+
| Variable | Type | Default | Description | Config File |
|
|
173
|
+
|----------|------|---------|-------------|-------------|
|
|
174
|
+
| `ENABLE_METRICS` | boolean | `false` | Enable metrics collection | monitoring.config.ts |
|
|
175
|
+
| `METRICS_INTERVAL` | number | `5000` | Collection interval (ms, min 1000) | monitoring.config.ts |
|
|
176
|
+
| `HTTP_METRICS` | boolean | `true` | Collect HTTP metrics | monitoring.config.ts |
|
|
177
|
+
| `SYSTEM_METRICS` | boolean | `true` | Collect system metrics | monitoring.config.ts |
|
|
178
|
+
| `CUSTOM_METRICS` | boolean | `false` | Enable custom metrics | monitoring.config.ts |
|
|
179
|
+
| `METRICS_EXPORT_CONSOLE` | boolean | `true` (dev) / `false` (prod) | Export to console | monitoring.config.ts |
|
|
180
|
+
| `METRICS_EXPORT_FILE` | boolean | `false` | Export to file | monitoring.config.ts |
|
|
181
|
+
| `METRICS_EXPORT_HTTP` | boolean | `false` | Export via HTTP | monitoring.config.ts |
|
|
182
|
+
| `METRICS_EXPORT_URL` | string | `undefined` | HTTP export URL | monitoring.config.ts |
|
|
183
|
+
| `METRICS_RETENTION_PERIOD` | number | `3600000` | Retention period (ms) | monitoring.config.ts |
|
|
184
|
+
| `METRICS_MAX_DATA_POINTS` | number | `1000` | Max data points to store | monitoring.config.ts |
|
|
185
|
+
|
|
186
|
+
## Profiling
|
|
187
|
+
|
|
188
|
+
| Variable | Type | Default | Description | Config File |
|
|
189
|
+
|----------|------|---------|-------------|-------------|
|
|
190
|
+
| `PROFILING_ENABLED` | boolean | `false` | Enable profiling | monitoring.config.ts |
|
|
191
|
+
| `PROFILING_SAMPLE_RATE` | number | `0.1` (dev) / `0.01` (prod) | Sample rate (0-1) | monitoring.config.ts |
|
|
192
|
+
| `MEMORY_PROFILING` | boolean | `false` | Enable memory profiling | monitoring.config.ts |
|
|
193
|
+
| `CPU_PROFILING` | boolean | `false` | Enable CPU profiling | monitoring.config.ts |
|
|
194
|
+
| `HEAP_SNAPSHOT` | boolean | `false` | Enable heap snapshots | monitoring.config.ts |
|
|
195
|
+
| `PROFILING_OUTPUT_DIR` | string | `'profiling'` | Profiling output directory | monitoring.config.ts |
|
|
196
|
+
| `PROFILING_MAX_PROFILES` | number | `10` | Max profiles to keep | monitoring.config.ts |
|
|
197
|
+
|
|
198
|
+
## Runtime (Reloadable)
|
|
199
|
+
|
|
200
|
+
| Variable | Type | Default | Description | Config File |
|
|
201
|
+
|----------|------|---------|-------------|-------------|
|
|
202
|
+
| `ENABLE_SWAGGER` | boolean | `true` | Enable Swagger (runtime) | runtime.config.ts |
|
|
203
|
+
| `DEBUG` | boolean | `false` | Enable debug mode | runtime.config.ts |
|
|
204
|
+
| `RATE_LIMIT_ENABLED` | boolean | `true` | Enable rate limiting | runtime.config.ts |
|
|
205
|
+
| `RATE_LIMIT_MAX` | number | `100` | Max requests per window | runtime.config.ts |
|
|
206
|
+
| `RATE_LIMIT_WINDOW` | number | `60000` | Rate limit window (ms) | runtime.config.ts |
|
|
207
|
+
| `REQUEST_TIMEOUT` | number | `30000` | Request timeout (ms) | runtime.config.ts |
|
|
208
|
+
| `MAX_UPLOAD_SIZE` | number | `10485760` | Max upload size (bytes, default 10MB) | runtime.config.ts |
|
|
209
|
+
| `MAINTENANCE_MODE` | boolean | `false` | Enable maintenance mode | runtime.config.ts |
|
|
210
|
+
| `MAINTENANCE_MESSAGE` | string | `'System is under maintenance...'` | Maintenance message | runtime.config.ts |
|
|
211
|
+
|
|
212
|
+
## Database
|
|
213
|
+
|
|
214
|
+
| Variable | Type | Default | Description | Config File |
|
|
215
|
+
|----------|------|---------|-------------|-------------|
|
|
216
|
+
| `DATABASE_URL` | string | `''` | Database connection URL | database.config.ts |
|
|
217
|
+
| `DATABASE_PROVIDER` | enum | `'postgres'` | Provider: `postgres`, `mysql`, `sqlite`, `mssql`, `mongodb` | database.config.ts |
|
|
218
|
+
| `DATABASE_CONNECTION_TIMEOUT` | number | `5000` | Connection timeout (ms) | database.config.ts |
|
|
219
|
+
| `DATABASE_SSL` | boolean | `false` | Enable SSL connection | database.config.ts |
|
|
220
|
+
|
|
221
|
+
## Services - Email
|
|
222
|
+
|
|
223
|
+
| Variable | Type | Default | Description | Config File |
|
|
224
|
+
|----------|------|---------|-------------|-------------|
|
|
225
|
+
| `MAIL_HOST` | string | `'smtp.example.com'` | SMTP host | services.config.ts |
|
|
226
|
+
| `MAIL_PORT` | number | `587` | SMTP port | services.config.ts |
|
|
227
|
+
| `MAIL_USERNAME` | string | `''` | SMTP username | services.config.ts |
|
|
228
|
+
| `MAIL_PASSWORD` | string | `''` | SMTP password | services.config.ts |
|
|
229
|
+
| `MAIL_FROM_ADDRESS` | string | `'no-reply@example.com'` | From email address | services.config.ts |
|
|
230
|
+
| `MAIL_SECURE` | boolean | `false` | Use TLS/SSL | services.config.ts |
|
|
231
|
+
|
|
232
|
+
## Services - JWT
|
|
233
|
+
|
|
234
|
+
| Variable | Type | Default | Description | Config File |
|
|
235
|
+
|----------|------|---------|-------------|-------------|
|
|
236
|
+
| `JWT_SECRET` | string | `'change-me'` | JWT secret key | services.config.ts |
|
|
237
|
+
| `JWT_EXPIRES_IN` | string | `'1h'` | Token expiration | services.config.ts |
|
|
238
|
+
| `JWT_AUDIENCE` | string | `'fluxstack'` | JWT audience | services.config.ts |
|
|
239
|
+
| `JWT_ISSUER` | string | `'fluxstack'` | JWT issuer | services.config.ts |
|
|
240
|
+
|
|
241
|
+
## Services - Storage
|
|
242
|
+
|
|
243
|
+
| Variable | Type | Default | Description | Config File |
|
|
244
|
+
|----------|------|---------|-------------|-------------|
|
|
245
|
+
| `STORAGE_DRIVER` | enum | `'local'` | Storage driver: `local`, `s3` | services.config.ts |
|
|
246
|
+
| `STORAGE_LOCAL_DIR` | string | `'uploads'` | Local storage directory | services.config.ts |
|
|
247
|
+
| `STORAGE_S3_BUCKET` | string | `''` | S3 bucket name | services.config.ts |
|
|
248
|
+
| `STORAGE_S3_REGION` | string | `''` | S3 region | services.config.ts |
|
|
249
|
+
| `STORAGE_S3_ENDPOINT` | string | `''` | S3 endpoint URL | services.config.ts |
|
|
250
|
+
|
|
251
|
+
## Services - Redis
|
|
252
|
+
|
|
253
|
+
| Variable | Type | Default | Description | Config File |
|
|
254
|
+
|----------|------|---------|-------------|-------------|
|
|
255
|
+
| `REDIS_ENABLED` | boolean | `false` | Enable Redis | services.config.ts |
|
|
256
|
+
| `REDIS_URL` | string | `'redis://localhost:6379'` | Redis connection URL | services.config.ts |
|
|
257
|
+
|
|
258
|
+
## System
|
|
259
|
+
|
|
260
|
+
| Variable | Type | Default | Description | Config File |
|
|
261
|
+
|----------|------|---------|-------------|-------------|
|
|
262
|
+
| `USER` | string | `''` | Current user (Unix) | system.config.ts |
|
|
263
|
+
| `USERNAME` | string | `''` | Current user (Windows) | system.config.ts |
|
|
264
|
+
| `HOME` | string | `''` | Home directory (Unix) | system.config.ts |
|
|
265
|
+
| `USERPROFILE` | string | `''` | Home directory (Windows) | system.config.ts |
|
|
266
|
+
| `PWD` | string | `''` | Current working directory | system.config.ts |
|
|
267
|
+
| `PATH` | string | `''` | System PATH | system.config.ts |
|
|
268
|
+
| `SHELL` | string | `''` | Shell executable | system.config.ts |
|
|
269
|
+
| `TERM` | string | `''` | Terminal type | system.config.ts |
|
|
270
|
+
| `LANG` | string | `'en_US.UTF-8'` | System language | system.config.ts |
|
|
271
|
+
| `TMPDIR` | string | `''` | Temporary directory | system.config.ts |
|
|
272
|
+
| `CI` | boolean | `false` | Running in CI environment | system.config.ts |
|
|
273
|
+
|
|
274
|
+
## Validation Rules
|
|
275
|
+
|
|
276
|
+
### Port Numbers
|
|
277
|
+
- Must be between 1 and 65535
|
|
278
|
+
- Validated on startup
|
|
279
|
+
|
|
280
|
+
### Rate Limiting
|
|
281
|
+
- `RATE_LIMIT_MAX` must be positive
|
|
282
|
+
- `RATE_LIMIT_WINDOW` must be positive
|
|
283
|
+
|
|
284
|
+
### Metrics
|
|
285
|
+
- `METRICS_INTERVAL` must be at least 1000ms
|
|
286
|
+
|
|
287
|
+
### Profiling
|
|
288
|
+
- `PROFILING_SAMPLE_RATE` must be between 0 and 1
|
|
289
|
+
|
|
290
|
+
### API Prefix
|
|
291
|
+
- Must start with `/`
|
|
292
|
+
|
|
293
|
+
### Timeouts
|
|
294
|
+
- `REQUEST_TIMEOUT` must be positive
|
|
295
|
+
- `DATABASE_CONNECTION_TIMEOUT` must be positive
|
|
296
|
+
|
|
297
|
+
## Type Casting
|
|
298
|
+
|
|
299
|
+
### String to Number
|
|
300
|
+
```bash
|
|
301
|
+
PORT=3000 # → 3000 (number)
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### String to Boolean
|
|
305
|
+
```bash
|
|
306
|
+
ENABLE_FEATURE=true # → true
|
|
307
|
+
ENABLE_FEATURE=1 # → true
|
|
308
|
+
ENABLE_FEATURE=yes # → true
|
|
309
|
+
ENABLE_FEATURE=on # → true
|
|
310
|
+
ENABLE_FEATURE=false # → false
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### String to Array
|
|
314
|
+
```bash
|
|
315
|
+
CORS_ORIGINS=http://localhost:3000,http://localhost:5173
|
|
316
|
+
# → ['http://localhost:3000', 'http://localhost:5173']
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### String to Object
|
|
320
|
+
```bash
|
|
321
|
+
METADATA='{"key":"value"}' # → { key: "value" }
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## Related
|
|
325
|
+
|
|
326
|
+
- [Declarative System](./declarative-system.md) - Config schema and validation
|
|
327
|
+
- [Runtime Reload](./runtime-reload.md) - Reloadable configuration
|