Architecture as code
Describe your systems and their relationships in YAML, in your repository. ArchiCode generates C4 and ArchiMate views as PlantUML from that model.
The architecture is rarely versioned and reviewed like the code: it lives in diagram files, slides or wiki pages. A diagram written as code still means one view at a time, and it cannot be asked a question. Here the model is data, and the views are drawn from it.
The editor runs in your browser, nothing to install: open the sample, create a workspace, or pick a folder where your browser allows it. Your files are not uploaded.
What it produces
ArchiCode keeps the model (elements and relationships) apart from the views. You edit the model, and the views are generated from it.
Model
The workspace is a YAML, TOML or JSON file, optionally completed by manifests: more files in the same formats. Each element has a kind and an id, and optionally relationships. A JSON Schema (archicode query schemas workspace) lets your IDE validate and complete the files.
application:
elements:
- kind: "person"
id: "User"
relationships:
- destination: "EcommercePlatform.UserInterface"
- kind: "solution"
id: "EcommercePlatform"
elements:
- kind: "system"
id: "UserInterface"
relationships:
- destination: "EcommercePlatform.ProductCatalog"
- destination: "EcommercePlatform.UserManagement"
- destination: "EcommercePlatform.OrderProcessing"
- destination: "EcommercePlatform.ContentManagement"
- kind: "system"
id: "ProductCatalog"
- kind: "system"
id: "UserManagement"
relationships:
- destination: "SocialIdentityProvider"
- kind: "system"
id: "OrderProcessing"
relationships:
- destination: "EcommercePlatform.ProductCatalog"
- destination: "PaymentGateway"
- kind: "system"
id: "ContentManagement"
- kind: "system"
id: "SocialIdentityProvider"
- kind: "system"
id: "PaymentGateway"
Overview: what the element exchanges with the outside.
Detailed: the children of the element, and what they exchange with each other and with the outside.
Views
A viewpoint is a set of rules that extracts one perspective from the model: overview shows what an element exchanges with the outside, detailed its children and what they exchange, deep the same for all its descendants. The command generates every view of every viewpoint as PlantUML files in views/. Rendering them to images is up to your PlantUML tooling.
archicode views generate
archicode views generate --viewpoint=overview -o ./diagrams
Queries
archicode query graph prints the resolved elements and relationships as JSON, so you can ask the model a question with the tool you already have. archicode query views filters the generated views with JSONPath.
# what depends on PaymentGateway?
archicode query graph | jq -r '.relationships[] | select(.relationship.destination=="PaymentGateway") | .source'
EcommercePlatform.OrderProcessing
Plateaus and stories
A plateau is a state of the architecture, layered on the one it overrides: a baseline, a target, what comes after. Compare two states, fail a build on a change, fold a plateau into the one above it, and draw the steps of a story. See plateaus, plateau list, diff and stories in the manual.
# the plateaus of the workspace and the line they form
archicode plateau list
# new, changed and removed elements between two states
archicode diff --plateau target --against baseline
# a check for a build: exit code 3 on a new or removed element
archicode diff --fail-on new,removed
# fold a plateau into the one above it, writing nothing
archicode plateau fold target --dry-run
# draw the steps of the stories
archicode stories generate
For agents
An agent that has only the program starts here: archicode init writes a small workspace that loads and is drawn, archicode guide prints a versioned guide in Markdown that loads no workspace, archicode query graph checks that the files load and prints the resolved model as JSON, archicode query impact lists what a change to an element touches, and archicode query schemas manifest gives the exact keys of each kind.
# a first workspace
archicode init my-architecture
# how to write the files, generated from the code
archicode guide
# check that the workspace loads
archicode query graph
# what a change to an element touches
archicode query impact PaymentGateway
# the keys of a manifest
archicode query schemas manifest
The model of ArchiCode itself is a workspace an agent can read: the ArchiCode model in the editor, or its folder in the repository. A short summary for agents is in llms.txt.
Try it in the editor, online
Browse and edit a workspace in the browser: the elements as a tree, with their details and their diagrams, a map of the application layer and another of the technology layer. Nothing to install and nothing uploaded.
A layered workspace with plateaus and stories: compare the states of a marketplace and play its stories.
The as-is model of ArchiCode itself, which engineers and agents can browse and query.
Your own files: open the editor and pick the folder that holds your .archicode.yaml, edit, save.
Scope and limits
- The model covers the application layer (person, solution, system, container, component) and the technology layer (environments, deployment nodes). There is no business layer.
- PlantUML is the only renderer.
- It is pre-1.0: the model and the commands can change between releases.
Get started
Install, write a first workspace, draw it, open it.
Download the native program of a release for Linux or macOS (how, with the checksum), or use Docker.
docker run \
-u "$(id -u):$(id -g)" \
-v "$(pwd):/workdir" -w /workdir \
--rm ghcr.io/tmorin/archicode \
init my-architecture
archicode init my-architecture
It writes a person, a system and a view that load and are drawn. Kinds and relationships: the domain chapter; the first steps: init.
cd my-architecture
archicode views generate -i shop_overview
The PlantUML file is written to views/. To browse the workspace, run archicode editor serve (how), or open it in the online editor.