Aurora overview
Luna uses an Aurora PostgreSQL cluster as a relational data store. There are three patterns for working with it:
OLTP streams — the primary pattern. A Lambda function reads from a DynamoDB stream and writes denormalised records into the shared oltp database. All stream-based services share a single schema managed through the @bhag-business-platform/luna-oltp-schema package.
Service-owned databases (source of truth) — some services own their own named database in the same Aurora cluster instead of using the shared oltp DB. They write to Aurora directly via the RDS Data API rather than consuming a DynamoDB stream. Their schema lives inside the service rather than in the shared luna-oltp-schema package. See Non-OLTP Services — activities is the reference.
Service-owned search projection — DynamoDB remains the source of truth; a service-owned Aurora database holds a denormalised copy used for flexible search/filtering. The contacts service is the reference: DDB streams dual-write into a contacts database, and GET /v2/contacts queries Aurora then hydrates results from DynamoDB. Schema and migrations live in services/contacts.
Sections
- OLTP Streams — architecture, code structure, infrastructure, tests, schema package, and end-to-end process
- Local Development — docker compose, migrations, seeds, SAM invocation, Drizzle Studio
- Remote Clusters — tunnel, user creation, permissions, running remote migrations
- Non-OLTP Services — services with their own Aurora database
