Compartment lets you define as many services as you need inside a singleDocumentation Index
Fetch the complete documentation index at: https://docs.compartment.dev/llms.txt
Use this file to discover all available pages before exploring further.
compartment.yml. Each service gets its own build, container, and readiness check, while sharing a project name and routing layer. This guide uses a real example — a web frontend and a backoffice API — to show the full setup.
Project structure
The example repository has two runnable services underservices/:
Define services in compartment.yml
Createcompartment.yml at the repository root:
web— the defaultkind(web) means Compartment treats this service as the public-facing frontend and exposes it directly.backoffice—kind: apimarks this service as an internal API; it is not exposed directly but can receive forwarded traffic fromweb.path— a path relative to the repository root where Compartment builds and runs that service.readiness— Compartment polls the given HTTP path before promoting the candidate container to active traffic. The deploy waits up totimeoutMsmilliseconds for a successful response.
Configure cross-service routing
Createcompartment.routes.yml next to compartment.yml to forward requests from web to backoffice:
web service on any path matching /api/*, proxy it to backoffice and strip the /api prefix before forwarding. The backoffice service sees the request at the original path without the prefix.
compartment.routes.yml manages browser-facing proxy rules. Secrets, environment-specific values, and domain configuration live outside this file — see Configuration reference for the full schema.Deploy all services
From the repository root, run:compartment.yml and compartment.routes.yml, builds every service in parallel, and applies the routing rules once all services pass their readiness checks.
Deploy a single service
When you change only one service and want to redeploy just that part, use--service:
Check status for all services
Next steps
- Understand the promotion lifecycle — see Promote and rollback.
- Scope environment variables to individual services — see Variables.
- View the full
compartment.routes.ymlschema — see Routes configuration.