Persistence
A generated Slice stores its data in DynamoDB. SQL is an explicit, additive choice you make for a Slice when a feature needs relational constraints or joins.
On this page
DynamoDB first
Every Slice starts with three data files. data/persistence.json declares which stores the Slice uses. data/key-value.ts gives the Slice a key-value store built on the runtime package. data/records.ts is a seeded example of product records that you replace with your own.
DynamoDB is the default because it has no cluster to size and no network to place it in. A Slice that only needs to read and write items by key is complete without anything else.
Start on DynamoDB. Add SQL when a feature needs it.
Choose Detail to inspect the labels. Download the SVG to keep or share this diagram.
SQL is additive. It does not move existing DynamoDB data, and no transaction spans both stores.
Optional SQL
When a feature needs integrity constraints, joins or reporting queries, run the sql generator for that Slice. It adds drizzle-orm, pg and @aws-sdk/rds-signer to the Slice and declares SQL in data/persistence.json. The Foundation then provisions a VPC and Aurora PostgreSQL for the stage.
See Add SQL for the steps.
Continue building