Chapter 04Field guide
The data layer gives the system memory.
The data layer stores the state of the system and gives it a shape. It is where SQL, NoSQL and data modeling turn a passing request into something that can be trusted later.
At the database layer, full stack developers need to have a good understanding of database fundamentals and be able to use SQL to query and update data. They should be familiar with data modeling techniques and be able to create efficient data structures.
What the layer owns
The data layer owns persistence, integrity and the shape of stored information. It decides how records relate, what must remain unique, what can be derived and what has to be kept for later. It also owns the queries that turn those structures into useful answers.
Model before you store
Data modeling is the work of deciding what the system needs to remember and how those pieces relate. A clear model makes common queries simple and prevents duplicate or contradictory state. An unclear model pushes complexity into every layer above it.
SQL and NoSQL
SQL databases provide a structured, relational model and a mature query language. NoSQL systems cover a wider range of models, including document stores. Neither choice is automatically better. The work is to match the model to the access patterns and the guarantees the product needs.
What will the system need to ask of this data in six months? The answer is often more useful than the shape of today's form.
Where the layer connects
The data layer serves the application layer and is carried by the infrastructure layer. Good boundaries here make backups, migrations and scale easier to reason about.
05 / Continue Infrastructure: see what carries the systemReference shelf
Work with data carefully.
Documentation for relational and document databases, query practice and data modeling.