The Twelve-Factor App
You shipped something that runs great on your laptop and falls over the moment it meets a second server, a real database, or a deploy at 5pm on a Friday. Passwords live in the code. Restarting loses data. "Works on my machine" has become a personal insult. The Twelve-Factor App is the checklist that turns that fragile thing into something you can deploy, scale, and hand off without dread — and once you internalize it, most of "how do I make this production-ready" stops being a mystery.
How to read this
This is a field guide, not a spec. Each factor exists because of a specific terrible day it prevents, so we lead with the pain and then the rule. You do not have to adopt all twelve at once; read them as a set of moves you reach for when the matching problem shows up. If you only remember three, remember config in the environment, stateless processes, and logs as streams — those three carry most of the weight.
The phases
- One codebase, clean dependencies, config outside the code — the foundation that makes a deploy repeatable.
- Stateless processes, port binding, and scaling out — how the running app behaves so you can run many copies.
- Dev-prod parity, logs as streams, and the operations factors — the factors that keep you sane once it's live.
Phase 1: One codebase, clean dependencies, config outside the code →