• Home
  • BVSSH
  • Engineering Enablement
  • Playbooks
  • Frameworks
  • Good Reads
Search

What are you looking for?

Practice : Twelve-Factor App

Purpose and Strategic Importance

The Twelve-Factor App methodology defines a set of principles for building modern, scalable, and maintainable web applications. Originating from Heroku, these principles support best practices for software-as-a-service (SaaS), cloud-native development, and DevOps automation.

Following these factors helps teams standardise deployments, reduce operational overhead, and improve portability and resilience - enabling faster delivery and better long-term sustainability.


Description of the Practice

The twelve factors include:

  1. Codebase – One codebase tracked in version control, many deploys.
  2. Dependencies – Explicitly declare and isolate dependencies.
  3. Config – Store configuration in the environment.
  4. Backing Services – Treat backing services as attached resources.
  5. Build, Release, Run – Strictly separate build and run stages.
  6. Processes – Execute the app as one or more stateless processes.
  7. Port Binding – Export services via port binding.
  8. Concurrency – Scale out via the process model.
  9. Disposability – Fast startup and graceful shutdown for robustness.
  10. Dev/Prod Parity – Keep development, staging, and production as similar as possible.
  11. Logs – Treat logs as event streams.
  12. Admin Processes – Run admin/management tasks as one-off processes.

How to Practise It (Playbook)

1. Getting Started

  • Audit existing applications for alignment with the twelve factors.
  • Start by externalising config, declaring dependencies, and using environment variables.
  • Refactor code to ensure stateless processes and clean separation of build and run stages.
  • Implement logging practices that stream logs to stdout/stderr or observability tools.

2. Scaling and Maturing

  • Build pipeline automation around build-release-run separation.
  • Use containers (e.g. Docker) to standardise dev/prod parity and disposability.
  • Run applications behind load balancers with health checks for resiliency.
  • Use process-level scaling for horizontal elasticity.
  • Consolidate monitoring and alerting across backing services and app logs.

3. Team Behaviours to Encourage

  • Treat infrastructure as ephemeral and restartable.
  • Focus on portable deployment practices that reduce vendor lock-in.
  • Maintain a shared understanding of each factor and its trade-offs.
  • Document architectural decisions based on adherence to the twelve principles.

4. Watch Out For…

  • Config baked into code or source control.
  • Shared state across processes (e.g. session data not externalised).
  • Manual admin tasks tightly coupled with application logic.
  • Long-lived processes that don’t shut down gracefully.

5. Signals of Success

  • Applications are portable across environments and cloud platforms.
  • Deployment pipelines are consistent, automated, and reliable.
  • Failures are isolated, recoverable, and observable.
  • Applications scale predictably under load.
  • Teams confidently build, test, and release independently.
Associated Standards
  • Developer workflows are fast and frictionless
  • Systems recover quickly and fail safely
  • Operational tasks are automated before they become recurring toil

Technical debt is like junk food - easy now, painful later.

Awesome Blogs
  • LinkedIn Engineering
  • Github Engineering
  • Uber Engineering
  • Code as Craft
  • Medium.engineering