Skip to content

Architecture as code

If the architecture lives in a drawing tool, it is a snapshot of an opinion. If it lives in the repository, it is subject to the same forces as the code: review, history, blame, and CI.

  • Models are text, under version control. A change to the architecture arrives as a diff someone approves, not as a file emailed round.
  • Diagrams are generated, never drawn. A hand-drawn box is a claim nothing verifies. A generated one is a rendering of a model that can be queried.
  • One model, many views. The eight landscapes are projections of the same source, which is what stops the C4 diagram and the event map from quietly disagreeing.
  • The build can read it. Anything a person can assert about the architecture, a pipeline should be able to check.

Ask what happens when a developer moves a dependency the diagram says should not exist. If the answer is “the diagram becomes wrong and nobody notices”, the architecture is not code — it is decoration.