# US01-02 — Establish Application and Database Foundation Epic: [E01](../E01-shared-identity-inventory.md) As an operator, I want the API, worker configuration, and database lifecycle to start consistently so later services share one durable foundation. ## Acceptance criteria - FastAPI factory, typed configuration, SQLAlchemy sessions, Alembic, WAL, foreign keys, structured logging, and readiness are configured. - Stable asset IDs, path occurrences, versions, and audit timestamps have migrations. - Secrets are referenced through configuration and never returned or logged. - Startup and shutdown leave no leaked worker or database resources. ## Automated tests - Migrations pass from an empty database and supported legacy schema snapshots. - Process-level integration tests verify readiness, restart, WAL, foreign keys, and clean shutdown. ## Dependencies - US01-01