The calm-server executable provides a standalone HTTP server implementation of CALM validation functionality.
The calm-server provides:
- Bundled CALM Schemas - All CALM schemas (release and draft) are bundled during build
- Health Check Endpoint (
/health) - Status endpoint for monitoring - Validation Endpoint (
/calm/validate) - POST endpoint for validating CALM architectures - Rate Limiting - Protects against abuse with 100 requests per 15 minutes per IP
calm-server/
├── src/
│ ├── index.ts # Entry point, CLI argument parsing
│ ├── server/
│ │ ├── cli-server.ts # Express server startup
│ │ └── routes/
│ │ ├── routes.ts # Router setup
│ │ ├── health-route.ts # Health check endpoint
│ │ └── validation-route.ts # Architecture validation endpoint
│ └── *.spec.ts # Unit tests
├── dist/
│ ├── index.js # Compiled executable
│ └── calm/ # Bundled CALM schemas
│ ├── release/ # Released schema versions
│ └── draft/ # Draft schema versions
├── package.json
├── tsconfig.json
├── tsconfig.build.json
├── tsup.config.ts # Build configuration
├── vitest.config.ts # Test configuration
└── eslint.config.mjs # Linting configuration
npm run build:calm-serverThis builds the TypeScript code and copies all CALM schemas from calm/release and calm/draft into dist/calm/.
# Using bundled schemas (default)
./calm-server/dist/index.js --port 3000 --verbose
# Or with custom schemas
./calm-server/dist/index.js -s ../calm/release --port 3000 --verbose
# Or using npm
npm run build:calm-server
node calm-server/dist/index.js --port 3000npm run link:calm-server
# Use bundled schemas (default)
calm-server --port 3000
# Or provide custom schemas
calm-server -s /path/to/schemas --port 3000Usage: calm-server [options]
CALM Server - A server implementation for the Common Architecture Language Model
Options:
-V, --version output the version number
--port <port> Port to run the server on (default: "3000")
--host <host> Host to bind the server to (default: "127.0.0.1")
-s, --schema-directory <path> Path to the directory containing the meta schemas to use.
(default: bundled schemas in dist/calm)
-v, --verbose Enable verbose logging (default: false)
-c, --calm-hub-url <url> URL to CALMHub instance
--rate-limit-window <ms> Rate limit window in milliseconds (default: 900000 = 15 minutes)
--rate-limit-max <requests> Max requests per IP within the rate limit window (default: 100)
-h, --help display help for command
- Default Host: The server binds to
127.0.0.1(localhost) by default - No Authentication: The server has NO authentication or authorization controls
- Network Exposure Warning: If you bind to a non-localhost host (e.g.,
0.0.0.0,::, public IP), a warning will be logged. Only do this in trusted network environments
npm run test:calm-server# Start the server (uses bundled schemas)
node calm-server/dist/index.js &
SERVER_PID=$!
# Test health
curl http://localhost:3000/health
# Clean up
kill $SERVER_PID# With a CALM architecture JSON
curl -X POST http://localhost:3000/calm/validate \
-H "Content-Type: application/json" \
-d '{"architecture": "{\"$schema\": \"https://...\"...}"}'@finos/calm-shared- Shared utilities, validation logic, schema handlingexpress- HTTP server frameworkexpress-rate-limit- Rate limiting middlewarecommander- CLI argument parsing
The calm-server implementation mirrors the server functionality from the CLI package (cli/src/server/):
src/server/cli-server.ts- Express server setupsrc/server/routes/routes.ts- Route configurationsrc/server/routes/health-route.ts- Health checksrc/server/routes/validation-route.ts- Architecture validation
Both implementations share the same core logic for validation and schema handling through the @finos/calm-shared package.
The tsup configuration:
- Bundles shared packages (
@finos/calm-shared,@finos/calm-models,@finos/calm-widgets) - Adds Node.js shebang via banner for executable
- Outputs CommonJS format with tree-shaking enabled
- Marks external
node_modulesas external (not bundled)
After building, you can link the executable globally:
npm run link:calm-server
calm-server --helpThis allows testing the executable without needing to build or reference the dist directory.
Apache-2.0