12-Factor App Vocabulary
5 exercises — master the precise English vocabulary of the 12-Factor App methodology: environment-based config, backing services, disposability and graceful shutdown, dev/prod parity gaps, and treating logs as event streams.
0 / 5 completed
12-Factor App vocabulary quick reference
- Factor III: Config — everything that varies between environments belongs in env vars, never in code
- Factor IV: Backing Services — DB, queue, SMTP are attached resources; swap them by changing a URL in config, not code
- Factor VI: Processes — stateless, share-nothing; persist state in backing services (DB, cache)
- Factor IX: Disposability — fast startup for scale-out; graceful SIGTERM shutdown for zero dropped requests
- Factor X: Dev/Prod Parity — same backing services, short deploy cycles, dev = ops; close time, personnel, and backing service gaps
- Factor XI: Logs — write to stdout only; let the platform capture, route, and store the stream
- Factor XII: Admin Processes — one-off admin tasks (migrations, REPL) run in the same environment as the app, as one-off processes
1 / 5
Factor III: Config — The 12-Factor methodology states: "Config that varies between deploy environments must be stored in environment variables, not in the codebase."
Why does 12-Factor specifically mandate environment variables rather than config files committed to the repository?
The core principle: config that varies per environment must never be committed to version control — not even in .env files that are "not pushed".
The dev/prod config problem that Factor III solves:
Modern implementation in cloud-native deployments:
• Kubernetes:
• AWS: Systems Manager Parameter Store / Secrets Manager → Lambda env vars or ECS task definitions
• Vault Agent sidecar: automatically populates environment variables from Vault secrets at pod start
• Never store secrets in ConfigMaps — ConfigMaps are not encrypted at rest; use Secrets
One practical test (12-Factor litmus):
"Could you open-source your codebase right now, without compromising any credentials?" If the answer is no due to config in code, you are violating Factor III.
Key vocabulary:
• Factor III: Config — the 12-Factor principle requiring all environment-specific configuration to be stored in environment variables, not in the codebase
• Environment variable — a key-value pair provided to a process by the operating environment; language-agnostic and cannot be committed to version control
• Secrets management — securely storing, rotating, and injecting credentials using dedicated systems (Vault, AWS Secrets Manager, Kubernetes Secrets)
The dev/prod config problem that Factor III solves:
❌ Anti-pattern (config in code):
app.config.js:
database: {
host: 'localhost', ← dev DB; what happens in production?
password: 'dev123' ← committed to Git; leaked in public repos constantly
}
✓ 12-Factor (config in environment):
app.config.js:
database: {
host: process.env.DB_HOST, ← set per environment
password: process.env.DB_PASS, ← set via secrets manager, never in code
}
Why environment variables specifically (not just config files outside the repo):| Approach | Risk |
|---|---|
| Config in code | Config is code; wrong environment, leaked secrets, manual changes needed per deployment |
| Separate config files (not committed) | Language-specific formats; easy to accidentally commit; harder to manage across many services |
| Environment variables | OS-level; language-agnostic; cannot be committed to Git; standard contract between app and platform (Kubernetes Secrets, AWS Parameter Store, Vault) |
Modern implementation in cloud-native deployments:
• Kubernetes:
envFrom: secretRef — inject from Kubernetes Secrets• AWS: Systems Manager Parameter Store / Secrets Manager → Lambda env vars or ECS task definitions
• Vault Agent sidecar: automatically populates environment variables from Vault secrets at pod start
• Never store secrets in ConfigMaps — ConfigMaps are not encrypted at rest; use Secrets
One practical test (12-Factor litmus):
"Could you open-source your codebase right now, without compromising any credentials?" If the answer is no due to config in code, you are violating Factor III.
Key vocabulary:
• Factor III: Config — the 12-Factor principle requiring all environment-specific configuration to be stored in environment variables, not in the codebase
• Environment variable — a key-value pair provided to a process by the operating environment; language-agnostic and cannot be committed to version control
• Secrets management — securely storing, rotating, and injecting credentials using dedicated systems (Vault, AWS Secrets Manager, Kubernetes Secrets)
All done! Return to the Cloud-Native exercises overview →