Data Ownership
Does this service own its data cleanly? No shared database, clear consistency boundaries, sagas with a way back, safe schema changes and tested backups.
15 rules · 47% checked automatically
Check your service against it
Apply this checklist to a service described in MICROSERVICE.md™: 7 of its 15 rules are checked against the design automatically, and each failing rule points to where to fix it.
0 of 15 ticked · kept in this browser only
Data
- The service owns its data and says what it holds
Each data store belongs to this service alone, and the design says what is kept in it.
HighChecked automatically
- No other service reads or writes its database
The service is the only thing that touches its tables. Everyone else goes through its API or its events.
CriticalChecked by hand
- Other services' data is reached through their API or events
The service never reads another service's tables, files or cache. It calls the owner or keeps its own copy built from the owner's events.
HighChecked by hand
- No transaction spans services
A business operation that changes several services is a sequence of local transactions with compensation, not a two-phase commit.
HighChecked by hand
- The aggregates the service owns are declared
The service names its aggregates, so it is clear what changes together in one transaction and what does not.
MediumChecked automatically
- Each aggregate states its invariants
Every aggregate lists the rules that must hold whenever it is saved, so the consistency boundary has a reason.
MediumChecked automatically
- Each saga names its trigger and its steps
A saga the service takes part in is written down: what starts it and the steps of the normal path, in order.
MediumChecked automatically
- Each saga has compensating steps
For every step of a saga that can be followed by a failure, there is a defined action that undoes it.
HighChecked automatically
- A read model names the service that writes the data
A service that is the read side of a CQRS pair says which service owns the writes, so the source of truth is never in doubt.
MediumChecked automatically
- Materialized views name their source and storage
Every materialized view says what it is built from and where it is kept.
MediumChecked automatically
- Derived data can be rebuilt from its source
A materialized view or read model can be dropped and recreated from the data it derives from, and the procedure has been run.
MediumChecked by hand
- Schema changes are backward compatible
A database migration never breaks the version of the service that is running: expand first, migrate, contract later.
HighChecked by hand
- Retention and deletion are defined
For each kind of data it owns, the service says how long it is kept and how it is removed.
MediumChecked by hand
- Backups exist and a restore has been tested
The data store is backed up automatically, and the team has restored from a backup recently enough to trust it.
HighChecked by hand
Security
- The database account has only the rights it needs
The service connects to its data store with an account limited to its own schema and to the operations it performs.
MediumChecked by hand