LikeC4 Model
Erode reads a LikeC4 architecture model to understand your system’s intended structure. It compares pull request changes against this model to detect drift.
What is LikeC4
Section titled “What is LikeC4”LikeC4 is a DSL (domain-specific language) for describing software architecture as code. It lets you define components, their relationships, and how they are deployed in a structured, version-controlled format.
For full documentation, see likec4.dev.
Basic example
Section titled “Basic example”A minimal LikeC4 model with two components and a relationship:
specification { element component}
model { component backend "Backend API" { description "Handles business logic and data access" link https://github.com/your-org/backend }
component frontend "Frontend App" { description "Web application served to users" link https://github.com/your-org/frontend }
frontend -> backend "Calls REST API"}Each component needs a link pointing to its GitHub repository. Erode uses this to match a pull request to the right component in the model. Components without a link are invisible to the analysis.
This declares that the frontend depends on the backend through a REST API. If a pull request introduces a direct database call from the frontend, Erode would flag this as an undeclared dependency.
Where to put model files
Section titled “Where to put model files”Erode loads all .c4 files from the directory you point it at. There are two options:
Same repository
Section titled “Same repository”Place model files in a dedicated directory:
my-repo/ architecture/ model.c4 views.c4 src/ ...Then set model-path to ./architecture when using the CLI, or model-path: architecture in the GitHub Action.
Separate repository (recommended)
Section titled “Separate repository (recommended)”Keep the architecture model in its own repository so it can be shared across services:
your-org/architecture/ model.c4 views.c4Point the GitHub Action at this repository using model-repo:
- uses: erode-app/erode@0 with: model-repo: your-org/architecture github-token: ${{ secrets.GITHUB_TOKEN }} gemini-api-key: ${{ secrets.GEMINI_API_KEY }}See GitHub Actions for all model repository options including model-path, model-ref, and model-repo-token.
Multiple LikeC4 projects
Section titled “Multiple LikeC4 projects”A workspace can hold several LikeC4 projects, each in a folder with its own likec4.config.json. Erode loads one project per run. If the workspace has more than one and you have not picked one, Erode stops and lists the project names it found.
Set the project in .eroderc.json:
{ "adapter": { "likec4": { "project": "shop" } }}Or set ERODE_LIKEC4_PROJECT=shop. The value is the name from that project’s likec4.config.json. A workspace with a single project needs no setting.
How Erode uses the model
Section titled “How Erode uses the model”During analysis, Erode:
- Loads the architecture model and resolves the component(s) relevant to the repository
- Extracts dependency changes from the PR diff
- Compares those changes against the declared relationships in the model
- Reports any dependencies that exist in the code but are missing from the model
The more accurately the model reflects the dependencies that matter, the better Erode can detect drift. You do not need to model every detail. Focus on the relationships worth protecting.
Version requirements
Section titled “Version requirements”Erode bundles its own copy of the likec4 npm package (currently ^1.61.0) to parse your model. The Docker image and GitHub Action include it. No local installation needed.
If your model repository declares likec4 in its package.json, the lowest version in that range must be 1.45.0 or newer. Erode stops with an error when it is older.
If that range starts above the version Erode bundles, the CLI prints a warning and Erode keeps going. Syntax added in newer LikeC4 releases may fail to parse. When parsing does fail, the error message repeats the warning so you can tell a version gap from a broken model.