This is article 10 of 10 in the Mercado Tech Brasil series on solutions architecture. Throughout the series, we have talked about requirements, styles, integrations, data, scale, security and delivery. All of those choices get lost if they live only in the memory of whoever made them. To wrap up, see how ADRs and the C4 model help record the why and the how of a solution without turning documentation into red tape.
Why document with ADRs and the C4 model
Months after go-live, someone asks: "why did we use a queue here instead of a direct call?" If the answer is "I don't remember," the team may undo a good decision without knowing it, or keep a bad one out of fear. Documenting is not writing huge manuals; it is recording the essentials at the moment the decision is made.
ADR: the record of each architecture decision
An ADR, short for architecture decision record, is a short, one-page text with a fixed structure:
- Title: the decision in a few words, such as "Use events to notify invoice issuance."
- Context: the problem, the non-functional requirements involved and the constraints.
- Alternatives considered: what else was evaluated.
- Decision: what was chosen.
- Consequences: what is gained, what is accepted as a loss and what needs to be monitored.
- Status: proposed, accepted or superseded.
ADRs live in the repository, next to the code, numbered in sequence. An accepted ADR is not rewritten: when the context changes, a new one is created to supersede the previous one. That way, the history shows how the thinking evolved.
The C4 model: diagrams at zoom levels
The C4 model organizes architecture diagrams into four levels, like a map that gradually zooms in:
- Context: the solution as a box, surrounded by the people and systems it talks to, such as the CRM, the ERP and the email platform. It serves leadership and business areas.
- Containers: the runnable parts, such as the web application, the API, the queue and the database, and how they communicate. It serves the technical team, security and operations.
- Components: the internal building blocks of each container. Useful for developers.
- Code: the detail of classes and functions, rarely drawn by hand.
Each level serves a different audience, and the first two are almost always enough.
How to use ADRs and the C4 model in solutions architecture
- Start with the context diagram and the first ADR during the discovery phase.
- Prefer diagrams described as text and versioned in the repository over loose drawings in files nobody updates.
- Include reviewing the ADRs and diagrams in the definition of done for stories that change the architecture.
- Reference the ADRs in code reviews and planning meetings.
Solutions architecture as a continuous method
Putting it all together: clear requirements guide the architectural style; integrations and data follow contracts; scale, security and delivery are planned from the start; and every relevant decision is recorded. This cycle repeats with each new business need.
In practice
In my consulting projects, I deliver a context diagram, a container diagram and the ADRs for the important decisions along with each automation. That package speeds up onboarding for new people, makes security audits easier and gives the client autonomy to evolve the solution after the project ends.
Translated from the original in Portuguese. Read the original.