vishal patel
Applied in productionFoundationUpdated 2026-09-23

The Twelve-Factor App

Twelve rules for building cloud-native services that are portable, scalable and deployable anywhere — config in env, stateless processes, logs as streams.

cloud-nativedevopscontainersconfig

The twelve, grouped

GroupFactors
Code & dependenciesI. One codebase, many deploys · II. Explicitly declared dependencies
Config & servicesIII. Config in the environment · IV. Backing services are attached resources (DB, Redis = URLs)
Build & runV. Strict build → release → run stages · VI. Stateless processes · VII. Port binding · VIII. Scale out via processes
OperationsIX. Disposability (fast start, graceful shutdown) · X. Dev/prod parity · XI. Logs as event streams · XII. Admin tasks as one-off processes
diagram

The ones that bite most

  • VI Stateless: no sessions or uploads on local disk. Put state in Redis or S3, or pods can't scale or restart freely.
  • IX Disposability: handle SIGTERM, finish in-flight requests, and release job locks. Kubernetes will kill your pod.
  • X Parity: "works locally" breaks when local uses SQLite and prod uses Mongo. Containers and a scripted local setup close the gap.
Where I've used it

The Claude-driven local setup agent our team built is really a Factor X tool. It brings 60+ services plus MongoDB and Redis up locally with prod-like config, so "works on my machine" means something.

Sources & further learning

Videos, courses, docs and books I recommend for this topic.

Related topics