Skip to content

Commit b48ae35

Browse files
committed
docs: enhance production readiness and deployment documentation
1 parent ba0b046 commit b48ae35

8 files changed

Lines changed: 1525 additions & 56 deletions

File tree

CLAUDE.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ somon compile app.som # Compile to JavaScript
4141
somon run app.som # Compile and execute
4242
somon bundle src/main.som -o dist/app.js # Bundle modules
4343
somon module-info src/main.som --graph # Analyze dependencies
44+
somon serve --port 8080 # Start management server
45+
somon resolve "./utils" --from src/main.som # Resolve module paths
46+
47+
# Production mode with all safety features
48+
somon compile app.som --production
49+
NODE_ENV=production somon run app.som
4450
```
4551

4652
## Architecture
@@ -100,6 +106,41 @@ projects:
100106
modules internally, enabling seamless interop between compiled output and source
101107
modules.
102108

109+
### Production Systems (`src/module-system/`)
110+
111+
The module system includes comprehensive production features:
112+
113+
- **CircuitBreakerManager** (`circuit-breaker.ts`) - Fault isolation
114+
- Automatic failure detection and recovery
115+
- Configurable thresholds and timeouts
116+
- State tracking: closed → open → half-open
117+
118+
- **PrometheusExporter** (`prometheus-metrics.ts`) - Metrics collection
119+
- Standard Prometheus text format
120+
- Module compilation metrics
121+
- Cache hit/miss ratios
122+
- Circuit breaker states
123+
- Memory and CPU usage
124+
125+
- **ManagementServer** (`runtime-config.ts`) - HTTP endpoints
126+
- `/health` - Health status with detailed checks
127+
- `/metrics` - Prometheus metrics endpoint
128+
- `/ready` - Kubernetes readiness probe
129+
- `/config` - Runtime configuration (GET/POST)
130+
- Graceful shutdown with connection draining
131+
132+
- **ResourceLimiter** (`resource-limiter.ts`) - Resource management
133+
- Memory limits with automatic cleanup
134+
- Module count limits
135+
- Compilation timeouts
136+
- Cache size management
137+
138+
- **StructuredLogger** (`structured-logger.ts`) - Production logging
139+
- JSON-formatted logs for aggregation
140+
- Log levels: debug, info, warn, error
141+
- Context preservation across operations
142+
- Integration with monitoring systems
143+
103144
### Configuration System
104145

105146
**File**: `somon.config.json` (auto-discovered up the directory tree)
@@ -109,7 +150,18 @@ modules.
109150
"compilerOptions": { "target": "es2020", "sourceMap": true },
110151
"moduleSystem": {
111152
"resolution": { "baseUrl": ".", "extensions": [".som", ".js"] },
112-
"loading": { "circularDependencyStrategy": "warn" }
153+
"loading": { "circularDependencyStrategy": "warn" },
154+
"metrics": true,
155+
"circuitBreakers": true,
156+
"logger": true,
157+
"managementServer": true,
158+
"managementPort": 8080,
159+
"resourceLimits": {
160+
"maxMemory": 512,
161+
"maxModules": 1000,
162+
"maxCacheSize": 100,
163+
"compilationTimeout": 5000
164+
}
113165
},
114166
"bundle": { "format": "commonjs", "minify": false }
115167
}

0 commit comments

Comments
 (0)