shtukbasehub

Standard: The Twelve-Factor App

The Twelve-Factor App: dependencies declared and pinned by a lock file, config in the environment, logs to stdout; what cannot be seen in files is left to a judge for the other factors.

Packagestd-twelve-factorv0.1.013 files

Standard: The Twelve-Factor App

What the standard is. The Twelve-Factor App is twelve rules for an application that runs as a service: https://12factor.net/ (the text has no version number; the package relies on the edition on the site as of 28.11.2026). The factors: I Codebase, II Dependencies, III Config, IV Backing services, V Build, release, run, VI Processes, VII Port binding, VIII Concurrency, IX Disposability, X Dev/prod parity, XI Logs, XII Admin processes.

When to install. The project is a service or a web application deployed in several environments (development, staging, production). For a desktop application, a library or a set of scripts the standard fits partly: install it and switch off the norms you do not need (status: paused).

How to configure. The page /norms/standards/twelve-factor.md: what not to look at (exclude; by default tests, fixtures, archives, vendor, docs), which extensions count as code (code). A line where a hardcoded value is needed on purpose can be marked 12factor:allow.

What is checked

  • TF-R01 (SHOULD, observe): factor III, config: the code has no address of a database, queue or cache (postgres://…, redis://…), no login with a password in an address, no DATABASE_URL = "https://…" as a literal. A line that reads the environment (process.env, os.environ, env::var …) is not a finding: a default value next to an environment read is acceptable. Example hosts (localhost, example.com, .test, .invalid) are skipped. It is a heuristic, so it observes. The config check.
  • TF-R02 (MUST, enforce): factor II, dependencies: a manifest with dependencies has a lock file in git next to it or above it (the workspace root). package.json: bun.lock, package-lock.json, yarn.lock, pnpm-lock.yaml; Cargo.toml: Cargo.lock; pyproject.toml: uv.lock, poetry.lock, pdm.lock, Pipfile.lock, pylock.toml or requirements.txt; requirements*.txt: every line with == (or the file is built from .in); Pipfile, Gemfile, go.mod, composer.json: their own lock. The lock check.
  • TF-R03 (SHOULD, observe): factor XI, logs: the application does not write logs to files itself (Python logging file handlers, winston/pino/log4js transports, tracing/log4rs/zap file appenders, appending to *.log). It is a heuristic, so it observes. The logs check.
  • TF-R04 (SHOULD, observe): the other factors (I, IV–X, XII) and what the heuristics do not see in II, III and XI. The judge is judges/twelve-factor.md.

What is not checked

  • Factors I, IV–X, XII are not checked by a machine: they are about how deployment is arranged, not about files. A judge looks at them.
  • Whether the lock file is fresh and matches the manifest: that is the package manager's job (bun install --frozen-lockfile, cargo build --locked).
  • Config hardcoded not as an address string (a port number, an environment flag if prod), and secrets: the std-owasp-secrets package looks for them.

The package only reads files. It writes nothing.