Design file upload as a stateful pipeline with admission limits, type verification, quarantine, archive budgets, asynchronous scanning, and safe downloads.
Use unique ordering, keyset queries, opaque tokens, and explicit snapshot semantics to prevent duplicates and gaps while a collection changes.
Rotate database credentials, signing keys, and encryption keys safely with versioned secrets, dual-read migration, atomic reload, and verified revocation.
Design graceful shutdown as a bounded state machine covering traffic removal, HTTP GOAWAY, request draining, message consumers, and forced termination.
Build a production cache contract around complete keys, HTTP freshness, validators, request coalescing, versioned invalidation, and observable outcomes.