Skip to content

Self-contained ​

A service should carry everything it needs to run β€” no invisible assumptions about the environment, no implicit shared state, no "works on my machine".

This applies at every layer:

  • Config β€” dependencies declared as env vars, validated at startup. If something is missing, it fails loudly. β†’ Configuration
  • Modules β€” each NestJS module declares its own imports, providers, and exports. Nothing leaks in from the outside implicitly.
  • Backing services β€” databases, queues, external APIs are attached resources referenced by config, not assumed to be there. Swap the connection string, swap the environment. β†’ Factor IV
  • Tests β€” the test environment spins up its own containers. No shared state, no dependency on a running local stack. β†’ Integration Testing
  • Behavior β€” VAPI assistants, scheduled jobs, workspace schemas are defined in code, not configured in a UI that lives outside the repo. β†’ Code-driven

TIP

Any engineer can clone the repo, set env vars, and have a fully working environment. Onboarding is a git clone away.

CAUTION

Without this: knowledge lives in someone's head, a Slack message, or a dashboard setting nobody remembers changing.