BBackend CourseLeroy Labs
0/0
Search the course

The Twelve-Factor App & feature flags

The twelve factors as a checklist for cloud-ready services, and feature flags (release, ops, experiment and permission flags) for decoupling deploy from release.

● intermediateIR3D (Kontentt)SperoTek (in dev)Hostel-Web-App

The twelve factors, scored against your projects

# Factor Status
I Codebase: one repo, many deploys ✅
II Dependencies: declared and isolated (Maven wrapper) ✅
III Config in the environment ✅ (Store’s hard-coded DB password moved to env vars in PR #1)
IV Backing services as attached resources (DB, broker, SMTP via URLs) ✅
V Build, release, run strictly separated ✅ Docker images + env (IR3D tags by SHA)
VI Stateless processes ✅ JWT; ⚠️ in-memory schedulers, limits and brokers (scaling lesson)
VII Port binding (embedded Tomcat) ✅
VIII Concurrency: scale out with processes ⚠️ Needs ShedLock and shared state first
IX Disposability: fast start, graceful stop ✅ Graceful shutdown; consider CDS for faster JVM start
X Dev/prod parity ✅ Testcontainers, compose with the same Postgres version
XI Logs as event streams to stdout ✅ IR3D prod console to CloudWatch; RM also writes files
XII Admin processes as one-offs ✅ CloudinaryToS3Migration, PlatformStaffCommand, AdminSeeder

Feature flags

A flag decouples deploying code from releasing behaviour.

Flag type Lifetime Example
Release Days to weeks, then delete Hide a new booking UI until ready
Ops / kill switch Long-lived Turn off link previews if abused
Experiment (A/B) Weeks Two checkout flows
Permission / entitlement Permanent Enterprise SSO only on paid plans
IR3D (Kontentt)app.campaigns.auto-approve · app.social-accounts.bio-code-enabled · app.media.signed-access.enabled · PlatformSettingsService (polled every 15 s) · FeatureDisabledException

Static flags live in properties. Runtime settings live in the DB and are polled every 15 s, so admins can toggle them without a deploy. FeatureDisabledException gives clean errors.

SperoTek (in dev)app.access.enforce-role-2fa · custom-roles: false

Policy flags gate security behaviour and future features.

Report-Manager-2MaintenanceModeFilter · maintenance_state table

A kill switch for the whole app: maintenance mode is stored in the DB, and the filter returns 503 to everyone except admins.

Tools

Unleash, Flagsmith and OpenFeature (open standard, self-hostable); LaunchDarkly and ConfigCat (SaaS); or your own table plus a cache, like IR3D.

Check yourself

1. Factor VI (stateless processes) is violated by…
2. Purpose of a release flag?