// RULES
Microservice rules
Best practices for microservices, one rule per page: why it matters, how to apply it and an example. They are grouped into checklists you can apply to a service.
8 rules of 70 · Clear filters
Architecture
- A routing layer sits between callers and the service
Requests reach the service through a gateway or proxy that can send each route to the old system or the new one.
HighChecked automatically
- Behaviour is compared with the legacy system before cutover
The new service is run against real traffic alongside the old one, and the differences are examined, before it serves users.
HighChecked by hand
- One capability is extracted at a time
The migration moves a single business capability end to end, and takes real traffic, before the next one starts.
HighChecked by hand
- The data moves with the capability
The extracted service owns the data for its capability in its own store. It does not keep reading or writing the legacy database.
HighChecked by hand
- The legacy model stays behind an anti-corruption layer
Calls to and from the legacy system pass through a translation layer, so its data model and quirks don't leak into the new service.
HighChecked by hand
- The service names its bounded context
The service says which part of the business it belongs to, so its boundary can be judged and its language is unambiguous.
HighChecked automatically
- Calls back to the legacy system are declared
Every call the new service still makes to the legacy system is listed as a dependency, with what it is for and how failure is handled.
MediumChecked by hand
- The replaced legacy code is removed
Once the new service carries all the traffic, the old code path, its data and its routes are deleted.
MediumChecked by hand