Building Cloud Native APPs using 12-factor

Rafey AhmedRafey Ahmed
2 min read

The 12-factor app is a set of best practices for building software-as-a-service (SaaS) applications that are portable, maintainable, and scalable. It was created by a group of software engineers with experience in building SaaS apps and aims to provide a guide for developing apps that can be deployed to any cloud platform.

The 12 factors include:

  1. Codebase: Each application should have only one codebase, managed through a version control system like Git.

  2. Dependencies: Explicitly declare and isolate dependencies to ensure that the app is self-contained and portable.

  3. Configuration: Store configuration in the environment rather than in the app code.

  4. Backing services: Treat backing services (like databases, caches, and message brokers) as attached resources that can be swapped out or scaled independently.

  5. Build, release, run: Separate the build, release, and run stages of the app lifecycle and keep them distinct.

  6. Processes: Use stateless processes to handle requests, making it easy to scale up or down.

  7. Port binding: Export services via port binding and make them available over the network.

  8. Concurrency: Scale out by adding more processes, rather than increasing the size of existing processes.

  9. Disposability: Maximize robustness with fast startup and graceful shutdown.

  10. Dev/prod parity: Keep development, staging, and production as similar as possible.

  11. Logs: Treat logs as event streams and aggregate and centralize them.

  12. Admin processes: Run admin/management tasks as one-off processes, rather than as part of the application.

Following these principles, developers can create applications that are easy to maintain, deploy, and scale. While the 12-factor methodology is not a rigid set of rules, it provides valuable guidelines that can be adapted to suit the needs of each application.

0
Subscribe to my newsletter

Read articles from Rafey Ahmed directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Rafey Ahmed
Rafey Ahmed

Aspiring software developer | Back-end development ( Nodejs) | Cloud practitioner (AWS, Gcloud) | DevOps Enthusiast| Open Source