Kloak manages Keycloak deployments.
# Install dependencies
bun install
# Run tests
bun test
# Start development server (with live reload)
bun run dev:watch
# Or start server without watch
bun run devKloak uses Biome for TypeScript/JavaScript linting and formatting.
# Check linting (no changes)
bun run lint:check
# Fix all linting issues
bun run lint
# Format code
bun run format# Start all services (app, PostgreSQL, Keycloak) with live reload
docker-compose up
# Access the app at http://localhost:3000
# Keycloak at http://localhost:8080/admin (admin/admin)
# PostgreSQL at localhost:5432
# Production deployment with health checks
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
# Run tests
docker exec kloak bun test
# Run linting
docker exec kloak bun run lint:checkDevelopment defaults (set in docker-compose.yml):
PORT=3000— Server portHOST=0.0.0.0— Server hostDATABASE_URL— PostgreSQL connection (optional, uses in-memory if not set)KEYCLOAK_BASE_URL=http://keycloak:8080— Keycloak serverKEYCLOAK_REALM_ADMIN_USER=admin— Keycloak admin userKEYCLOAK_REALM_ADMIN_PASSWORD=admin— Keycloak admin password
| Command | Purpose |
|---|---|
bun test |
Run all tests |
bun run dev |
Start server |
bun run dev:watch |
Start server with live reload |
bun run lint:check |
Check linting |
bun run lint |
Fix linting issues |
bun run format |
Format code |
bun run migrate |
Run database migrations |
src/
├── shared/ # Domain types and ubiquitous language
├── core/ # Deployment lifecycle (CoreService, repository)
├── database/ # PostgreSQL persistence layer
├── sync/ # Drift detection and reconciliation
├── keycloak/ # Keycloak integration
├── aws/ # AWS provisioning
├── infrastructure/ # Infrastructure abstraction layer
├── admin-ui/ # HTTP API server
├── orchestrator/ # Orchestration service
└── *.test.ts # Test files