# Data access layer & seed data

A step of the [Cloud application](https://gradus.kazet.blog/tree/cloud-application) tree on Gradus, in the Data & storage area: DB, cache, queues.

Page: https://gradus.kazet.blog/tree/cloud-application/step/data-access-layer

Put every query behind one data access layer, seed the database with the data the first journey needs and persist the journey's first write.

Usually comes after: [Choose a database](https://gradus.kazet.blog/tree/cloud-application/step/choose-database), [any option of Database](https://gradus.kazet.blog/tree/cloud-application).

Leads to: [Caching layer](https://gradus.kazet.blog/tree/cloud-application/step/caching), [Object storage](https://gradus.kazet.blog/tree/cloud-application/step/object-storage), [Message queue](https://gradus.kazet.blog/tree/cloud-application/step/message-queue), [Backups & recovery](https://gradus.kazet.blog/tree/cloud-application/step/backups-and-recovery), [Indexing & query tuning](https://gradus.kazet.blog/tree/cloud-application/step/indexing-and-query-tuning), [Where the frontend lives](https://gradus.kazet.blog/tree/cloud-application/step/choose-repo-layout).

## Prompt for your AI assistant

```
Add a data access layer to this service so that no handler talks to the database directly: one module per aggregate from docs/product/mvp.md with typed read and write functions. Add a seed script that fills a fresh database with the data the first journey needs, run it in the local setup and in CI and make the first journey's first write go through the new layer end to end.
```

Every step of the tree: https://gradus.kazet.blog/tree/cloud-application/llms.txt
