> Every Pyahu Initializer guide: https://initializer.pyahu.io/llms.txt. Every Pyahu Community project: https://pyahu.io/llms.txt.

# Production checklist

Every item of every guide, grouped by part. Use it to review a service or to agree on a standard as a team:
mark each item pass, fail or not applicable and write down the reason for every exception. An item's step
explains why it matters. Items with a "when" apply only to services that use that option.

## Part 1: Foundations

### [Build and code quality](guides/build-quality.md)

- [ ] **BLD-01** Gradle wrapper committed with distributionSha256Sum and CI always runs ./gradlew. (step 1)
- [ ] **BLD-02** Java toolchain set to 25 in the build and CI builds inside the pinned JDK image. (step 1)
- [ ] **BLD-03** Every library and plugin version in gradle/libs.versions.toml; no version typed in a build file. (step 2)
- [ ] **BLD-04** Repositories declared only in settings.gradle.kts with repositoriesMode FAIL_ON_PROJECT_REPOS. (step 2)
- [ ] **BLD-05** BOMs imported with platform() in every configuration that needs them; no io.spring.dependency-management plugin. (step 3)
- [ ] **BLD-06** Error Prone runs on main code with warnings in generated code disabled. (step 4)
- [ ] **BLD-07** NullAway as an error with OnlyNullMarked and JSpecifyMode; RequireExplicitNullMarking fails a package without a package-info.java with @NullMarked. (step 5)
- [ ] **BLD-08** Spotless with a pinned palantir-java-format; spotlessCheck runs as part of check. (step 6)
- [ ] **BLD-09** build depends on cyclonedxBom and writes the SBOM to a fixed path. (step 7)
- [ ] **BLD-10** renovate.json extends config:recommended, sets minimumReleaseAge and groups libraries that must move together. (step 8)
- [ ] **BLD-11** Dependency update pull requests are reviewed and merged on a green build every week. (step 8)
- [ ] **BLD-12** PMD runs in check on handwritten code with a short ruleset for complexity, size and swallowed errors. (step 9)

### [Architecture: hexagonal and DDD layered](guides/architecture.md)

- [ ] **ARCH-01** One package per business capability under the base package, each a Spring Modulith module with a small API at its root. (step 1)
- [ ] **ARCH-02** A ModulithTest calls ApplicationModules.of(Application.class).verify() in every build. (step 7)
- [ ] **ARCH-03** One style per service, with the same package names in every capability. (step 2)
- [ ] **ARCH-04** Ports, adapters and application services marked with jMolecules hexagonal annotations; port signatures use domain types. (step 3; when architecture: hexagonal)
- [ ] **ARCH-05** ArchitectureTest runs JMoleculesArchitectureRules.ensureHexagonal(VerificationDepth.STRICT). (step 7; when architecture: hexagonal)
- [ ] **ARCH-06** An ArchUnit rule that nothing outside the adapter packages depends on them. (step 7; when architecture: hexagonal)
- [ ] **ARCH-07** An explicit ArchUnit graph for presentation, application, domain and infrastructure in which the domain depends on no other layer. (step 4; when architecture: ddd-layered)
- [ ] **ARCH-08** An ArchUnit rule keeps the domain package to the JDK, JSpecify and itself. (step 6)
- [ ] **ARCH-09** @Transactional only on application service methods, one per use case. (step 5)
- [ ] **ARCH-10** Module boundaries reviewed with the people who know the business whenever a capability is added. (step 8)
- [ ] **ARCH-11** ArchitectureTest keeps controllers in the web layer and @Transactional in the application, and forbids field injection, System.out and generic exceptions. (step 7)

### [Architecture styles compared](guides/architecture-styles.md)

- [ ] **STYLE-01** The style was chosen by comparing the consequences on a real scenario and the choice is recorded in an ADR. (step 1)
- [ ] **STYLE-02** Business rules that need tests without a database live in a style whose dependencies point toward the domain. (step 2)
- [ ] **STYLE-03** Each architectural claim is labelled as a definition from a source, a team policy, an executable check or judgment. (step 8)

### [Testing a Spring Boot service](guides/testing.md)

- [ ] **TEST-01** Domain classes depend on no Spring type and their tests start no Spring context. (step 2)
- [ ] **TEST-02** Each adapter has a slice test: @WebMvcTest for controllers, @DataJdbcTest for repositories, @RestClientTest for HTTP clients. (step 3)
- [ ] **TEST-03** An ApplicationModules.verify() test and an ArchUnit class with the jMolecules rule for the chosen style run in the normal build. (step 4)
- [ ] **TEST-04** Database tests run against Testcontainers PostgreSQL of the production major version through @ServiceConnection, never a database that runs in memory. (step 5; when database: postgres)
- [ ] **TEST-05** The real migrations run in tests, so a changeset that does not apply fails the build. (step 5; when database: postgres)
- [ ] **TEST-06** Outbound clients are built from Boot's RestClient.Builder and tested with @RestClientTest, error responses included. (step 6)
- [ ] **TEST-07** Integration tests import one shared @TestConfiguration; no @DirtiesContext and no @MockitoBean in @SpringBootTest classes. (step 7)
- [ ] **TEST-08** A suite starts the built image with a read-only root filesystem as a user other than root and asserts that /readyz answers 200. (step 8)
- [ ] **TEST-09** CI runners have Docker for the Testcontainers and image tests. (step 5)
- [ ] **TEST-10** Tests that start the application or a container carry @Tag("integration") and run in their own task after the fast tests. (step 9)
- [ ] **TEST-11** JaCoCo gates domain and application at 80% of lines and 70% of branches; PIT runs on them with a mutation threshold of 70; both are part of check. (step 9)

## Part 2: Build the service

### [gRPC services](guides/grpc.md)

- [ ] **GRPC-01** buf lint, buf format and buf breaking against the commit the change starts from run in CI for every .proto change. (step 2; when api: grpc)
- [ ] **GRPC-02** Deleted fields have their numbers and names reserved; no field number is reused or changes type. (step 2; when api: grpc)
- [ ] **GRPC-03** gRPC is served by spring-boot-starter-grpc-server on its own port (9090 by default), apart from the HTTP port. (step 3; when api: grpc)
- [ ] **GRPC-04** Every gRPC client channel sets default.deadline. (step 5; when api: grpc)
- [ ] **GRPC-05** Exceptions map to specific status codes with an ErrorInfo reason in one GrpcExceptionHandler; UNAVAILABLE only when the client may retry. (step 6; when api: grpc)
- [ ] **GRPC-06** Retry policies only on methods that are safe to repeat, with every attempt inside the deadline. (step 6; when api: grpc)
- [ ] **GRPC-07** gRPC probes select separate livenessState and readinessState checks; native probes use a plaintext health transport, never a TLS-only port or overall health for liveness. (step 8; when api: grpc)
- [ ] **GRPC-08** Server reflection is off in production unless the team relies on it there. (step 8; when api: grpc)
- [ ] **GRPC-09** Clients reach gRPC servers through a headless Service with a dns target or through a mesh that balances per call. (step 9; when api: grpc)
- [ ] **GRPC-10** spring.grpc.server.keepalive.connection.max-age is set so clients reconnect and spread over new pods. (step 9; when api: grpc)
- [ ] **GRPC-11** gRPC observations stay enabled on the server and on every client channel. (step 10; when api: grpc)
- [ ] **GRPC-12** gRPC traffic uses TLS from an SSL bundle or mesh mutual TLS; bypass-certificate-validation is never set outside tests. (step 10; when api: grpc)
- [ ] **GRPC-13** One AuthenticationProcessInterceptor names the rule of every method, leaves only the grpc.* services open and denies every other call. (step 4; when api: grpc; auth: true)
- [ ] **GRPC-14** Calls between services carry the user's token or the caller's own client credentials token, cached until it expires; no shared static key. (step 4; when api: grpc)
- [ ] **GRPC-15** Every streaming method stops its work on cancellation and ends after a fixed time; request and response calls are unary. (step 7; when api: grpc)

### [Protobuf contracts](guides/protobuf-contracts.md)

- [ ] **PROTO-01** The .proto files live in one contract project owned by the service; consumers depend on its jar and never copy the files. (step 1; when api: grpc)
- [ ] **PROTO-02** Packages end in a version such as v1, folders match them, and every method has its own request and response message. (step 2; when api: grpc)
- [ ] **PROTO-03** Every enum starts with an _UNSPECIFIED value; fields whose zero is a valid answer are optional; time uses Timestamp and Duration. (step 3; when api: grpc)
- [ ] **PROTO-04** Every list is paged with page_size and page_token, every update takes an update_mask and every create a request_id. (step 4; when api: grpc)
- [ ] **PROTO-05** Field rules are protovalidate annotations, checked by one server interceptor that answers INVALID_ARGUMENT with the violations. (step 5; when api: grpc)
- [ ] **PROTO-06** Each method's comment lists the status codes and ErrorInfo reasons it returns; no published reason is renamed or reused. (step 6; when api: grpc)
- [ ] **PROTO-07** Deleted fields have their numbers and names reserved; a breaking change goes into a new versioned package served next to the old one. (step 7; when api: grpc)

### [REST APIs, contract first](guides/rest-apis.md)

- [ ] **REST-01** An OpenAPI 3.1 contract lives in the repository and describes every response, errors included. (step 1; when api: rest)
- [ ] **REST-02** openApiGenerate runs the spring generator with interfaceOnly and useSpringBoot4; controllers implement the generated interfaces. (step 2; when api: rest)
- [ ] **REST-03** Generated models stay in the web adapter; the domain does not depend on generated code. (step 2; when api: rest)
- [ ] **REST-04** spring-boot-starter-validation on the classpath; input rules written in the contract; useSpringBuiltInValidation on. (step 3; when api: rest)
- [ ] **REST-05** spring.mvc.problemdetails.enabled is true and every error response uses one Problem schema with a stable type URI. (step 4; when api: rest)
- [ ] **REST-06** Creates return 201 with Location; a POST retried with the same Idempotency-Key returns the stored result. (step 5; when api: rest)
- [ ] **REST-07** Every list endpoint has a default and a maximum limit and rejects a limit above the maximum with 400. (step 6; when api: rest)
- [ ] **REST-08** Breaking changes ship as a new version next to the old one; the old version is deprecated with a sunset date before removal. (step 7; when api: rest)
- [ ] **REST-09** openApiValidate runs in every build and CI fails a pull request that breaks the contract without a new version. (step 8; when api: rest)

### [The database in production](guides/database.md)

- [ ] **DB-01** Connection budget computed: every pool times HPA maximum, surge and draining pods, plus migrations and admin, fits the user connections of each database server. (step 1; when database: postgres)
- [ ] **DB-02** Fixed pool: maximum-pool-size equals minimum-idle, 10 or less unless measured otherwise. (step 1; when database: postgres)
- [ ] **DB-03** connection-timeout between 2000 and 5000 ms, max-lifetime below every connection age cap, keepalive-time below network idle timeouts, leak-detection-threshold set. (step 2; when database: postgres)
- [ ] **DB-04** spring.transaction.default-timeout and spring.jdbc.template.query-timeout set. (step 3; when database: postgres)
- [ ] **DB-05** Runtime role has statement_timeout and idle_in_transaction_session_timeout. (step 3; when database: postgres)
- [ ] **DB-06** Separate migration and runtime users; the runtime user cannot change the schema or write Liquibase history/lock tables, and can read history for readiness. (step 4; when database: postgres)
- [ ] **DB-07** Migrations run in a Job before the rollout; the application sets spring.liquibase.enabled to false. (step 5; when database: postgres)
- [ ] **DB-08** Every schema change reviewed as expand and contract; no rename or drop in the same release as the code change. (step 7; when database: postgres)
- [ ] **DB-09** Transactional changesets start with SET LOCAL lock_timeout; changesets that ran are never edited. (step 7; when database: postgres)
- [ ] **DB-10** Integration tests run the real changelog on Testcontainers with the production PostgreSQL major version. (step 8; when database: postgres)
- [ ] **DB-11** Alerts on hikaricp.connections.pending and hikaricp.connections.timeout. (step 9; when database: postgres)
- [ ] **DB-12** Point in time restore rehearsed in the last quarter. (step 9; when database: postgres)
- [ ] **DB-13** Namespace, ServiceAccount, ConfigMaps, NetworkPolicies, database roles and Secrets exist before the migration Job; it completes before the rollout and a failed Job stops the release. (step 6; when database: postgres)
- [ ] **DB-14** The migration Job has a versioned name (or is recreated by its hook), a low backoffLimit, an activeDeadlineSeconds and a ttlSecondsAfterFinished. (step 6; when database: postgres)

### [JPA and jOOQ](guides/jpa-and-jooq.md)

- [ ] **ORM-01** Persistence annotations stay in the persistence adapter; domain classes carry none. (step 1)
- [ ] **ORM-02** spring.jpa.hibernate.ddl-auto is validate; Liquibase owns the schema. (step 2)
- [ ] **ORM-03** Every JPA association is LAZY, including @ManyToOne and @OneToOne; each use case loads what it needs with JOIN FETCH, an entity graph or a projection. (step 3)
- [ ] **ORM-04** hibernate.query.fail_on_pagination_over_collection_fetch is true and hibernate.log_slow_query is set. (step 3)
- [ ] **ORM-05** spring.jpa.open-in-view is false. (step 4)
- [ ] **ORM-06** List and search pages read projections; entities are loaded only to be changed. (step 5)
- [ ] **ORM-07** JDBC batching on (hibernate.jdbc.batch_size, order_inserts, order_updates) and SEQUENCE ids instead of IDENTITY. (step 6)
- [ ] **ORM-08** No second level cache by default; batch jobs flush and clear the persistence context per chunk. (step 7)
- [ ] **ORM-09** jOOQ classes are generated in the build from a PostgreSQL container migrated by Liquibase, never edited by hand. (step 8)

### [HTTP clients and resilience](guides/http-clients.md)

- [ ] **HTTP-01** RestClient and HTTP Service Clients for new code; no new RestTemplate usage. (step 1)
- [ ] **HTTP-02** One @ImportHttpServices group per downstream system, with base-url from configuration. (step 1)
- [ ] **HTTP-03** redirects dont-follow for calls between services, plus a status handler that rejects 3xx. (step 1)
- [ ] **HTTP-04** spring.http.clients connect-timeout and read-timeout set globally, tighter per group. (step 2)
- [ ] **HTTP-05** HTTP library chosen explicitly with spring.http.clients.imperative.factory. (step 2)
- [ ] **HTTP-06** Apache pool with maxConnPerRoute at or above the concurrency limit, a connection request timeout of 1 s or less and a connection TTL. (step 3)
- [ ] **HTTP-07** Each attempt is bounded by the client; the retry timeout plus one attempt fits the caller's own timeout. (step 4)
- [ ] **HTTP-08** @EnableResilientMethods present whenever @Retryable or @ConcurrencyLimit is used. (step 5)
- [ ] **HTTP-09** Every @Retryable sets includes, maxRetries of 2 or less, multiplier, jitter and timeout. (step 5)
- [ ] **HTTP-10** Only one layer in the call chain retries a given dependency. (step 5)
- [ ] **HTTP-11** POST and PATCH are retried only with an idempotency key created outside the retry. (step 6)
- [ ] **HTTP-12** @ConcurrencyLimit with policy REJECT on the class for each downstream system, rejection mapped to 503 or 429. (step 7)
- [ ] **HTTP-13** Circuit breaker or rate limiter only with a written reason, using resilience4j-spring-boot4. (step 7)
- [ ] **HTTP-14** Fallbacks never invent business results. (step 7)
- [ ] **HTTP-15** Clients come from Boot builders or HTTP Service groups, with histograms on http.client.requests. (step 8)

### [Virtual threads and concurrency](guides/virtual-threads.md)

- [ ] **VT-01** spring.threads.virtual.enabled is true only for I/O bound services; the decision is recorded. (step 1)
- [ ] **VT-02** HikariCP maximum-pool-size comes from the database connection budget; connection-timeout is 5 s or less. (step 2)
- [ ] **VT-03** Each downstream client shares a concurrency limit with explicit rejection; any waiting queue is bounded with an admission deadline, and outbound calls have connect and read timeouts. (step 3)
- [ ] **VT-04** CPU heavy work runs on a platform pool sized to the cores with a bounded queue and explicit rejection. (step 4)
- [ ] **VT-05** Pod CPU request of at least 1; either -XX:ActiveProcessorCount of at least 2 with no CPU limit or a CPU limit of at least 2. (step 4)
- [ ] **VT-06** No custom executor bean silently replaces the virtual thread @Async executor; spring.main.keep-alive is true for apps without a web server. (step 5)
- [ ] **VT-07** MDC, security and trace context are propagated across async boundaries; no business logic relies on ThreadLocal caching. (step 6)
- [ ] **VT-08** Fan out uses a long lived, context wrapped executor and cancels the tasks that miss the deadline. (step 7)
- [ ] **VT-09** A JFR pinning check runs once under load; dashboards show pool pending connections and GC. (step 8)

## Part 3: Events and data

### [Kafka with the outbox](guides/kafka.md)

- [ ] **KAFKA-01** Events tied to a database change are written to an outbox table in the same transaction; no direct KafkaTemplate send on that path. (step 1; when kafka.outbox: true)
- [ ] **KAFKA-02** Outbox rows are kept; a cleanup job deletes only rows below the published watermark and older than the retention window. (step 2; when kafka.outbox: true)
- [ ] **KAFKA-03** Publication and replication slot created before the app accepts writes; publication.autocreate.mode filtered; heartbeat.interval.ms set. (step 2; when kafka.outbox: true)
- [ ] **KAFKA-04** max_slot_wal_keep_size set in PostgreSQL and an alert on replication slot lag. (step 2; when kafka.outbox: true)
- [ ] **KAFKA-05** Event schemas are checked and registered from CI with explicit FULL_TRANSITIVE compatibility per subject, or a documented consumers-first BACKWARD_TRANSITIVE rollout; new fields have defaults and replay history is checked. (step 3; when kafka.enabled: true)
- [ ] **KAFKA-06** Topics created explicitly, one per aggregate type, keyed by aggregate id, with retention longer than the longest incident. (step 4; when kafka.enabled: true)
- [ ] **KAFKA-07** acks and enable.idempotence left at the Kafka defaults (all and true); spring.kafka.template.observation-enabled true. (step 5; when kafka.enabled: true)
- [ ] **KAFKA-08** Consumers store processed event ids in the same transaction as the work and skip duplicates; auto commit off; listener observation enabled. (step 6; when kafka.enabled: true)
- [ ] **KAFKA-09** DefaultErrorHandler with exponential backoff and a DeadLetterPublishingRecoverer; ErrorHandlingDeserializer around the deserializers. (step 7; when kafka.enabled: true)
- [ ] **KAFKA-10** Each dead letter topic has at least as many partitions as its original topic. (step 7; when kafka.enabled: true)
- [ ] **KAFKA-11** Alerts on consumer lag, slot lag and records in dead letter topics; a written replay procedure that has been tried. (step 8; when kafka.enabled: true)

### [RabbitMQ](guides/rabbitmq.md)

- [ ] **RMQ-01** RabbitMQ is used for tasks and commands; events that several services read or replay go to Kafka. (step 1; when rabbitmq: true)
- [ ] **RMQ-02** Work queues are durable quorum queues (x-queue-type: quorum). (step 2; when rabbitmq: true)
- [ ] **RMQ-03** The broker runs at least three nodes. (step 2; when rabbitmq: true)
- [ ] **RMQ-04** Queues, exchanges and bindings are declared as beans. (step 2; when rabbitmq: true)
- [ ] **RMQ-05** spring.rabbitmq.publisher-confirm-type is correlated, publisher-returns and template.mandatory are true. (step 3; when rabbitmq: true)
- [ ] **RMQ-06** Publishers wait on the CorrelationData confirm and treat a nack or a returned message as a failed send. (step 3; when rabbitmq: true)
- [ ] **RMQ-07** Listeners acknowledge only after the work is done; prefetch is sized to the time one message takes. (step 4; when rabbitmq: true)
- [ ] **RMQ-08** Listener retry is on with a small max-retries and a backoff. (step 5; when rabbitmq: true)
- [ ] **RMQ-09** Every work queue has a dead letter exchange with dead-letter-strategy at-least-once and overflow reject-publish. (step 5; when rabbitmq: true)
- [ ] **RMQ-10** Messages in dead letter queues are reviewed and replayed or discarded. (step 5; when rabbitmq: true)
- [ ] **RMQ-11** Every message has a messageId and consumers skip ids they already processed in the same transaction as the work. (step 6; when rabbitmq: true)
- [ ] **RMQ-12** Queues that can fill up have a maximum length and, where old work is useless, a message TTL. (step 7; when rabbitmq: true)
- [ ] **RMQ-13** The rabbitmq_prometheus plugin is scraped with alerts on growing depth, queues without consumers and dead lettered messages. (step 8; when rabbitmq: true)
- [ ] **RMQ-14** Template and listener observation are enabled. (step 8; when rabbitmq: true)

### [Caching with Valkey](guides/caching.md)

- [ ] **CACHE-01** Every cache has a written reason, a known staleness limit and a measured slow path it replaces. (step 1; when cache: true)
- [ ] **CACHE-02** @EnableCaching sits on its own configuration class and every cache is declared in spring.cache.cache-names. (step 2; when cache: true)
- [ ] **CACHE-03** spring.cache.redis.time-to-live is set; no cache entry lives forever. (step 3; when cache: true)
- [ ] **CACHE-04** Cache values are stored as JSON, keys keep the cache name prefix and carry a version. (step 4; when cache: true)
- [ ] **CACHE-05** The cache manager is transaction aware and writes evict entries after the commit. (step 5; when cache: true)
- [ ] **CACHE-06** Hot keys have spread expiry times and are loaded once per pod. (step 6; when cache: true)
- [ ] **CACHE-07** spring.data.redis.connect-timeout and spring.data.redis.timeout are set far below the request deadline. (step 7; when cache: true)
- [ ] **CACHE-08** A CacheErrorHandler turns cache errors into misses; the service keeps answering when Valkey is down. (step 7; when cache: true)
- [ ] **CACHE-09** Valkey has maxmemory below its container limit and maxmemory-policy allkeys-lru. (step 8; when cache: true)
- [ ] **CACHE-10** Hit ratio, command latency and evicted keys are on a dashboard; cache errors raise an alert. (step 8; when cache: true)

## Part 4: Run in production

### [The JVM in containers](guides/jvm-in-containers.md)

- [ ] **JVM-01** Memory request equals memory limit. (step 1)
- [ ] **JVM-02** MaxRAMPercentage set from the table, InitialRAMPercentage equal to it. (step 1)
- [ ] **JVM-03** GC flag explicit in the ENTRYPOINT (-XX:+UseG1GC unless ZGC or Parallel is documented). (step 2)
- [ ] **JVM-04** No CPU limit and ActiveProcessorCount equal to the CPU request rounded up, at least 2; with a CPU limit, no ActiveProcessorCount. (step 3)
- [ ] **JVM-05** ExitOnOutOfMemoryError set; heap dumps only to a volume larger than the heap. (step 1)
- [ ] **JVM-06** java.io.tmpdir and ErrorFile point at the writable /tmp volume, with ErrorFile on the ENTRYPOINT. (step 5)
- [ ] **JVM-07** AOT cache built in the image from the extracted layout, without --launcher, with remote calls disabled in the training run. (step 6)
- [ ] **JVM-08** CI fails the build if the cache is rejected (-XX:AOTMode=on check). (step 6)
- [ ] **JVM-09** Flags that affect the cache (GC, compact headers) are identical in training and production. (step 6)
- [ ] **JVM-10** startupProbe budget about three times measured p99 startup on the smallest node type, measured with the AOT cache. (step 8)
- [ ] **JVM-11** Confirm the heap percentage with Native Memory Tracking under load after each JDK or Boot upgrade. (step 1)

### [Configuration and secrets](guides/configuration.md)

- [ ] **CFG-01** Single application.yaml with production safe defaults; no dev, qa or prod profiles. (step 1)
- [ ] **CFG-02** All app settings bound through @ConfigurationProperties records with @Validated, @Valid on nested records and @DefaultValue for defaults. (step 3)
- [ ] **CFG-03** Secret components guarded against unresolved placeholders, with no other format constraint and toString() overridden. (step 4)
- [ ] **CFG-04** @ConfigurationPropertiesScan enabled; configuration processor on the annotation processor path. (step 3)
- [ ] **CFG-05** Per environment values in a versioned ConfigMap loaded with envFrom; a config change triggers a rollout. (step 1)
- [ ] **CFG-06** enableServiceLinks: false on every pod spec. (step 2)
- [ ] **CFG-07** Secrets in a vault, mounted by the CSI driver with a workload identity; spring.config.import: optional:configtree:... (step 5)
- [ ] **CFG-08** No secretObjects sync unless something other than the app needs a Kubernetes Secret. (step 5)
- [ ] **CFG-09** Token authentication preferred over stored secrets for databases and cloud services. (step 5)
- [ ] **CFG-10** Secret rotation runbook: add the new credential, update the vault, roll the pods, revoke the old one. (step 7)
- [ ] **CFG-11** management.endpoint.env.show-values and configprops.show-values are never or a SanitizingFunction bean exists. (step 6)
- [ ] **CFG-12** Only health and info exposed over the web, on the management port. (step 6)
- [ ] **CFG-13** No secret in manifests, images, ConfigMaps, logs or exception messages. (step 6)
- [ ] **CFG-14** An invalid setting makes the application context fail to start. (step 3)
- [ ] **CFG-15** Feature flags evaluated through OpenFeature with safe defaults; stale flags removed. (step 8)

### [Observability](guides/observability.md)

- [ ] **OBS-01** spring-boot-starter-opentelemetry on the classpath; no -javaagent and no agent injected through JAVA_TOOL_OPTIONS. (step 1)
- [ ] **OBS-02** spring.application.name, service.version and deployment.environment.name set. (step 2)
- [ ] **OBS-03** OTEL_EXPORTER_OTLP_ENDPOINT points at the collector in each environment. (step 2)
- [ ] **OBS-04** management.tracing.sampling.probability chosen deliberately (1.0 with tail sampling). (step 4)
- [ ] **OBS-05** management.otlp.metrics.export.base-time-unit is seconds. (step 5)
- [ ] **OBS-06** Histograms on http.server.requests and http.client.requests; explicit SLO buckets for SLI thresholds. (step 5)
- [ ] **OBS-07** No unbounded tag values; HTTP clients use URI templates and auto-configured builders only. (step 5)
- [ ] **OBS-08** Logback OpenTelemetry appender installed or stdout JSON collected by an agent, not both. (step 3)
- [ ] **OBS-09** A collector gateway with memory limiter first, Kubernetes metadata, PII transform, tail sampling, batch and retry. (step 6)
- [ ] **OBS-10** Grafana data sources linked from exemplars to traces, traces to logs and metrics and logs back to traces. (step 7)
- [ ] **OBS-11** Actuator on port 8081, exposure limited to health and info (plus prometheus when scraped), health details hidden. (step 8)
- [ ] **OBS-12** No NetworkPolicy rule admits port 8081. (step 8)

### [Security hardening](guides/security.md)

- [ ] **SEC-01** issuer-uri and audiences set; jws-algorithms explicit. (step 1; when auth: true)
- [ ] **SEC-02** scp mapped to SCOPE_ and roles to ROLE_; oid as the principal; the API registration issues v2 tokens. (step 2; when auth: true)
- [ ] **SEC-03** The API chain ends with anyRequest().denyAll(); business rules use @PreAuthorize; a catch-all handler rethrows security exceptions. (step 3; when auth: true)
- [ ] **SEC-04** Stateless sessions; CSRF off only because no endpoint uses cookie authentication; CORS with exact origins or none. (step 4; when auth: true)
- [ ] **SEC-05** Content-Security-Policy, Referrer-Policy and HSTS present on responses through the ingress. (step 5)
- [ ] **SEC-06** server.request.header.forwarded.strategy pinned; server.tomcat.remoteip.internal-proxies narrowed to the ingress addresses. (step 5)
- [ ] **SEC-07** spring.web.error.* at defaults; spring.mvc.problemdetails.enabled true; a catch-all handler returns a fixed text. (step 6)
- [ ] **SEC-08** Validation 400s carry errors with field and message, never the rejected value; request sizes bounded on purpose. (step 6)
- [ ] **SEC-09** URLs that users supply go through a client with InetAddressFilter.externalAddresses(), no redirects and https only. (step 7)
- [ ] **SEC-10** Pod runs non-root with a read-only root filesystem and /tmp emptyDir, drops ALL capabilities, uses RuntimeDefault and mounts no service account token. (step 8)
- [ ] **SEC-11** The namespace enforces Pod Security restricted; a NetworkPolicy denies by default with explicit allows and blocks 169.254.169.254. (step 8)
- [ ] **SEC-12** Where TLS ends is written down: at the ingress, in the pod or in a mesh. (step 9)
- [ ] **SEC-13** TLS in the pod or mTLS to a partner uses a named SSL bundle; server bundles set reload-on-update: true. (step 9)
- [ ] **SEC-14** Certificate Secrets mounted as directories, not with subPath; pods rolled when a client certificate is renewed. (step 9)

## Part 5: Ship

### [The container image and supply chain](guides/container-image.md)

- [ ] **IMG-01** Dockerfile with several stages; no JDK, Gradle or source code in the final image. (step 1)
- [ ] **IMG-02** extract --layers without --launcher; layers copied dependencies, loader, snapshots, application. (step 1)
- [ ] **IMG-03** AOT cache trained in the runtime stage with remote calls disabled; CI fails if -XX:AOTMode=on rejects it. (step 1)
- [ ] **IMG-04** Base images pinned as tag@sha256:digest in plain FROM lines with the distro codename in the tag, auxiliary images included. (step 3)
- [ ] **IMG-05** Every workload running the app image (Deployment, migration Job, CronJob) references the release digest, not a tag. (step 3)
- [ ] **IMG-06** Renovate or Dependabot updates base digests and action SHAs; JDK major bumps blocked. (step 3)
- [ ] **IMG-07** Numeric non-root USER 10001:10001 and exec form ENTRYPOINT. (step 4)
- [ ] **IMG-08** Runs with readOnlyRootFilesystem: true and /tmp as an emptyDir with a sizeLimit. (step 4)
- [ ] **IMG-09** Allow list .dockerignore; no secrets through ARG or ENV. (step 5)
- [ ] **IMG-10** CycloneDX plugin applied; app SBOM written by the build. /actuator/sbom not exposed by default; if it is, management port only and authenticated. (step 6)
- [ ] **IMG-11** Image SBOM (Syft, CycloneDX) attached as a signed attestation. (step 6)
- [ ] **IMG-12** Trivy or Grype gate on fixable high and critical findings in CI; a registry or cluster scanner rescans shipped images. (step 7)
- [ ] **IMG-13** Image signed by digest in CI; Deployments reference digests; an admission policy verifies the signature. (step 8)

### [CI pipelines](guides/ci-pipelines.md)

- [ ] **CI-01** Every action and reusable workflow is pinned to a full commit SHA with its version in a comment or locked by a workflow lockfile. (step 1)
- [ ] **CI-02** Every workflow starts with permissions contents read; write permissions are granted per job and only where needed. (step 2)
- [ ] **CI-03** The repository or organization default for the workflow token is read only. (step 2)
- [ ] **CI-04** No pull_request_target or workflow_run workflow checks out and runs pull request code while holding secrets. (step 2)
- [ ] **CI-05** The Gradle build runs inside the JDK image pinned by digest, the same digest as the Dockerfile's build stage. (step 3)
- [ ] **CI-06** The Gradle wrapper sets distributionSha256Sum. (step 3)
- [ ] **CI-07** No secret, token or credential is written to a cached path; caches are keyed by lock or version files. (step 4)
- [ ] **CI-08** The image is built from the production Dockerfile and behaviour tests run against it before anything is published. (step 5)
- [ ] **CI-09** Test reports upload with if always and the publishing job needs the test job. (step 5)
- [ ] **CI-10** Images are pushed and deployed by digest, with a provenance attestation and an SBOM attached to that digest. (step 6)
- [ ] **CI-11** Pull request runs never publish; only the default branch does. (step 6)
- [ ] **CI-12** Every workflow has paths filters that include the workflow file, a concurrency group per ref and timeout-minutes on every job. (step 7)
- [ ] **CI-13** No path filtered workflow is a required status check. (step 7)
- [ ] **CI-14** Renovate pull requests for actions, images and libraries are reviewed and merged when CI passes, after the minimum release age. (step 8)
- [ ] **CI-15** Every build writes build/reports/pyahu/quality.html and quality.json, also when it fails; CI keeps them and shows the summary on the run's page. (step 9)

### [Deploying to Kubernetes](guides/kubernetes-deployment.md)

- [ ] **KUBE-01** /livez and /readyz served on the main port (add-additional-paths) and open to the kubelet without authentication. (step 1)
- [ ] **KUBE-02** Liveness group holds livenessState only; no database, broker or HTTP dependency. (step 1)
- [ ] **KUBE-03** Readiness group holds readinessState; any added dependency is local to the pod and documented. (step 1)
- [ ] **KUBE-04** Probe timeoutSeconds is at least 2; startupProbe instead of initialDelaySeconds. (step 1)
- [ ] **KUBE-05** preStop sleep of at least 10 s with the native sleep action. (step 2)
- [ ] **KUBE-06** timeout-per-shutdown-phase set to 20s and terminationGracePeriodSeconds at least preStop plus the phase timeout plus 15 s. (step 2)
- [ ] **KUBE-07** Memory request equals memory limit; CPU request set and no CPU limit or a documented reason for one. (step 3)
- [ ] **KUBE-08** maxSurge 1, maxUnavailable 0 and minReadySeconds set; no spec.replicas when an autoscaler exists. (step 4)
- [ ] **KUBE-09** PodDisruptionBudget with maxUnavailable 1 and unhealthyPodEvictionPolicy AlwaysAllow. (step 5)
- [ ] **KUBE-10** HorizontalPodAutoscaler with explicit behavior and a capped scale up; minReplicas at least 3 in production; one autoscaler per Deployment. (step 6)
- [ ] **KUBE-11** Zone spread with DoNotSchedule and node spread with ScheduleAnyway, both with matchLabelKeys pod-template-hash. (step 7)
- [ ] **KUBE-12** Recurring work uses ShedLock or a CronJob with concurrencyPolicy Forbid. (step 8)
- [ ] **KUBE-13** A rollout under steady load has finished with zero failed requests at least once. (step 2)
- [ ] **KUBE-14** A pod that is not ready is diagnosed from its events, kubectl logs --previous and a direct call to /livez and /readyz. (step 9)

### [Kubernetes manifests: plain, Helm or Kustomize](guides/kubernetes-manifests.md)

- [ ] **MAN-01** One packaging tool per service: Kustomize for a service the team deploys itself, Helm when others install it with their own values. The choice is written down. (step 1)
- [ ] **MAN-02** CI renders every environment and validates the rendered output, not the templates. (step 8)
- [ ] **MAN-03** Recommended app.kubernetes.io labels on every object. Selectors use name, instance and component only, never version. (step 3)
- [ ] **MAN-04** No spec.replicas in any manifest when an HPA manages the Deployment. (step 6)
- [ ] **MAN-05** Production images pinned by digest through the Kustomize images transformer. (step 5)
- [ ] **MAN-06** Config changes roll the pods: configMapGenerator hash or checksum/config. Plain YAML has an explicit restart step. (step 4)
- [ ] **MAN-07** Kustomize uses labels, patches and replacements only, with components for optional features. No deprecated fields. (step 2)
- [ ] **MAN-08** Applied with --server-side and a named field manager. Drift checked with kubectl diff --server-side or a GitOps controller. (step 6)
- [ ] **MAN-09** kubeconform -strict with CRD schemas for Kubernetes 1.36 and 1.37, plus pluto for the newest version. (step 8)
- [ ] **MAN-10** kube-linter and trivy config pass. Every suppression has a written reason. (step 8)
- [ ] **MAN-11** With more than one person deploying or more than one cluster, a GitOps controller applies the manifests with pruning on. (step 7)
- [ ] **MAN-12** Dependencies such as a migration before the app are ordered explicitly: Argo CD sync waves or Flux dependsOn. (step 7)

## Part 6: Grow

### [Local development](guides/local-development.md)

- [ ] **LOCAL-01** Local dependencies run in containers with the image versions production runs; no embedded database stands in for PostgreSQL. (step 1)
- [ ] **LOCAL-02** spring-boot-docker-compose is a developmentOnly dependency and compose.yml sits next to the app, with a healthcheck per service. (step 3; when pyahuCli: false)
- [ ] **LOCAL-03** No connection URL, user or password for a local container appears in application.yaml; service connections provide them. (step 3; when pyahuCli: false)
- [ ] **LOCAL-04** Local dependencies are started one way only at development time, the Pyahu CLI, Docker Compose support or Testcontainers, never two of them. (step 4)
- [ ] **LOCAL-05** grafana/otel-lgtm 0.41.1 runs locally for traces, metrics and logs and never in a shared or production environment. (step 6)
- [ ] **LOCAL-06** Every setting uses the same key locally and in the cluster, with local defaults as placeholders overridden by environment variables. (step 7)
- [ ] **LOCAL-07** spring-boot-devtools is a developmentOnly dependency and never reaches the image. (step 8)
- [ ] **LOCAL-08** Every environment except local sets spring.liquibase.contexts to a value without dev, so sample data changesets never run there. (step 10; when database: postgres)
- [ ] **LOCAL-09** Probes, mounts and policies are checked in a local cluster before manifests change. (step 11)
- [ ] **LOCAL-10** pyahu.yaml lists the services the project needs, with the images production runs, so pyahu up starts the same local stack for every developer. (step 2; when pyahuCli: true)
- [ ] **LOCAL-11** On the laptop the service connects as the runtime role and migrates as the migration role that db/roles.sql creates; no user or password appears in application.yaml. (step 2; when database: postgres; pyahuCli: true)
- [ ] **LOCAL-12** The laptop signs in with a real OIDC provider over HTTPS, and the service and the frontend trust the local CA through the files pyahu up writes; no certificate check is turned off. (step 5; when auth: true; pyahuCli: true)
- [ ] **LOCAL-13** One command, mise run dev, starts the dependencies, each service and a compiler that makes devtools restart it; mise.toml holds only tasks that call Gradle, npm or the Pyahu CLI, and no tool versions. (step 9)
- [ ] **LOCAL-14** Each service listens for a debugger on its own port, on localhost only, and never waits for one to start. (step 9)
- [ ] **LOCAL-15** On the laptop the console prints text a person reads; every other environment, the tests included, writes the structured JSON, and the logs reach the backend over OTLP either way. (step 9)
- [ ] **LOCAL-16** One task runs the service in the local cluster with the manifests of every environment and the same apply script; its local overlay changes only what a laptop needs, and the Secrets carry the names every environment uses. (step 11; when pyahuCli: true)

### [Monorepos with several services](guides/monorepo.md)

- [ ] **MONO-01** The decision to keep several services in one repository is recorded in an ADR with its reason and the owning teams. (step 1; when layout: monorepo)
- [ ] **MONO-02** The build fails when a service depends on another service's project; services use only api projects and libraries, and api projects and libraries use only libraries. (step 3; when layout: monorepo)
- [ ] **MONO-03** Each service owns its database and its migration history. (step 3; when layout: monorepo)
- [ ] **MONO-04** libs/ holds only deliberately reusable code, never shared entities or service internals. (step 3; when layout: monorepo)
- [ ] **MONO-05** Each contract lives in its service's api project (verticals/<vertical>/api), which generates the code once; consumers depend on that project. (step 4; when layout: monorepo)
- [ ] **MONO-06** CI compares every contract with the base of each change and fails on a breaking change; a deliberate removal is approved explicitly. (step 4; when layout: monorepo)
- [ ] **MONO-07** Build logic lives in an included build-logic build, added with includeBuild inside pluginManagement; no buildSrc, allprojects, subprojects or afterEvaluate. (step 5; when layout: monorepo)
- [ ] **MONO-08** Convention plugins have their own Gradle TestKit tests, including one that a service depending on another service fails. (step 5; when layout: monorepo)
- [ ] **MONO-09** One version catalog at gradle/libs.versions.toml, imported into build-logic; no build file or convention plugin writes a version. (step 6; when layout: monorepo)
- [ ] **MONO-10** Each project is included by a flat name with an explicit projectDir; the root project has no sources. (step 2; when layout: monorepo)
- [ ] **MONO-11** One workflow that always runs builds and tests every project and ends in a gate job that is the only required check. (step 9; when layout: monorepo)
- [ ] **MONO-12** Each service has its own image repository, built from the repository root, and its own deploy/ folder. (step 10; when layout: monorepo)
- [ ] **MONO-13** The same image digest is promoted between environments. (step 10; when layout: monorepo)
- [ ] **MONO-14** CODEOWNERS names an owner for every vertical folder (service, contract and web app), build-logic and gradle/, and code owner review is required. (step 2; when layout: monorepo)
- [ ] **MONO-15** Every project, libraries and api projects included, applies one convention plugin. (step 5; when layout: monorepo)
- [ ] **MONO-16** The configuration cache, the build cache and parallel execution are on, and only builds of main save the CI build cache. (step 7; when layout: monorepo)
- [ ] **MONO-17** Each vertical has its own AGENTS.md; one pyahu.yaml at the root starts every vertical's dependencies, with a database per vertical that has one. (step 8; when layout: monorepo)

### [Next.js next to the service](guides/nextjs.md)

- [ ] **NEXT-01** Data fetching and service calls live in server components; modules that hold secrets or call the service start with import 'server-only'. (step 1; when frontend: nextjs)
- [ ] **NEXT-02** The TypeScript client types are generated from the service's contract, its OpenAPI document or its .proto files, and CI fails when the generated files are out of date. (step 2; when frontend: nextjs)
- [ ] **NEXT-03** The browser never calls the service directly; the Next.js server calls it by its cluster name. (step 2; when frontend: nextjs)
- [ ] **NEXT-04** Login runs the OIDC code flow on the server with a maintained library; the session is an httpOnly, secure, sameSite cookie and the access token never reaches the browser. (step 3; when auth: true; frontend: nextjs)
- [ ] **NEXT-05** Every Server Action and every data access function checks the user itself, not only proxy.ts. (step 3; when auth: true; frontend: nextjs)
- [ ] **NEXT-06** One image is promoted across environments; no environment specific value uses the NEXT_PUBLIC_ prefix. (step 4; when frontend: nextjs)
- [ ] **NEXT-07** Nothing that depends on the user's session is cached in a shared cache; cached reads have a tag and a lifetime. (step 5; when frontend: nextjs)
- [ ] **NEXT-08** When cached data must be shared across replicas, Cache Components uses cacheHandlers.remote with shared storage and tag coordination; per-pod caches require an explicit tolerance for staleness. (step 5; when frontend: nextjs)
- [ ] **NEXT-09** The image is built with output: 'standalone', copies only .next/standalone, .next/static and public, runs as the node user and starts with CMD ["node", "server.js"]. (step 6; when frontend: nextjs)
- [ ] **NEXT-10** Probes point at a route handler that returns 200 and the grace period covers the slowest request; each frontend release embeds a unique deploymentId, and apps with Server Actions coordinate their build-time encryption key. (step 6; when frontend: nextjs)
- [ ] **NEXT-11** next.config.js sets nosniff, a referrer policy, frame denial and HSTS on every path, poweredByHeader is false and a Content Security Policy is in place. (step 7; when frontend: nextjs)
- [ ] **NEXT-12** instrumentation.ts registers OpenTelemetry and exports to the same collector as the service; calls to the service carry the trace context, through fetch.propagateContextUrls over REST or an interceptor over gRPC. (step 8; when frontend: nextjs)

### [gRPC behind a Next.js frontend](guides/grpc-frontend.md)

- [ ] **GWEB-01** The browser never calls a gRPC service; only Next.js server code does, and the services have no public route. (step 1; when api: grpc; frontend: nextjs)
- [ ] **GWEB-02** TypeScript clients come from buf generate with a pinned protoc-gen-es; CI fails when the committed output is stale. (step 2; when api: grpc; frontend: nextjs)
- [ ] **GWEB-03** One transport per service lives in a server-only module; the user's token is passed with each call, never stored in the transport. (step 3; when api: grpc; frontend: nextjs)
- [ ] **GWEB-04** Every transport sets defaultTimeoutMs; Route Handlers pass request.signal to their calls. (step 4; when api: grpc; frontend: nextjs)
- [ ] **GWEB-05** Server Actions return expected gRPC errors as values, matched on code and ErrorInfo reason; users never see a raw error message. (step 5; when api: grpc; frontend: nextjs)
- [ ] **GWEB-06** Server streams reach the browser as server-sent events with the request signal passed, a heartbeat and a longer route timeout on the gateway. (step 6; when api: grpc; frontend: nextjs)
- [ ] **GWEB-07** Frontend calls are balanced per request by a mesh, or the services set keepalive.connection.max-age. (step 7; when api: grpc; frontend: nextjs)
- [ ] **GWEB-08** Every transport has an interceptor that injects the trace context into the call headers. (step 8; when api: grpc; frontend: nextjs)
