Data & Storage
Database schema, migrations, query patterns, caching, and background job processing.
The Data & Storage domain covers everything related to persistent state: the PostgreSQL database, Redis cache, and Inngest background job system.
Topics
Schema Design
Table conventions, column patterns, tenant scoping, relationships, enums, reference data, and seeding. Start here to understand how the database is structured.
Migrations
Migration workflow from development through CI deployment, rollback procedures, seed data management, and the Drizzle Kit toolchain.
Query Patterns
The withTenantContext wrapper, connection management, the tRPC procedure chain, Drizzle query patterns, and performance considerations.
Caching
Redis cache-aside pattern via @repo/cache, key conventions, invalidation strategies, and health monitoring.
Background Jobs
Inngest durable execution, job definitions, event patterns, retry configuration, and local development.
Key Packages
| Package | Role |
|---|---|
@repo/db | Drizzle schemas, migrations, tenant context, seed data |
@repo/cache | Redis client, cache-aside wrapper, health checks |
Cross-Domain References
- Identity & Access — RLS policies and CASL authorization that Data & Storage enforces at the query level
- Infrastructure — Cloud SQL, Redis hosting, and Inngest runtime
- Delivery — CI migration pipeline and quality gates