12-Factor Application

Overview

The 12-Factor methodology defines practices for building cloud-ready applications with portability, repeatability, and operational consistency.

Core Factors in Practice

flowchart LR A[Build] --> B[Release] B --> C[Run]

Practical Example

A web API stores environment-specific settings outside source code.

# Development setx DATABASE_URL "postgres://dev-db:5432/app" setx REDIS_URL "redis://dev-cache:6379" # Production pipeline setx DATABASE_URL "postgres://prod-db:5432/app" setx REDIS_URL "redis://prod-cache:6379"
var databaseUrl = Environment.GetEnvironmentVariable("DATABASE_URL"); var redisUrl = Environment.GetEnvironmentVariable("REDIS_URL");

Operational Benefits

Common Pitfalls

Key Takeaways