Demo project for erode — a tool that detects architecture erosion in PRs by comparing code changes against an architecture model.
frontend → api-gateway → user-service → database
→ product-service → database
- frontend — Express server serving pages, fetches from api-gateway via HTTP
- api-gateway — Express server proxying to user-service and product-service via HTTP
- user-service — Express server managing users, imports database directly
- product-service — Express server managing products, imports database directly
- database — In-memory Map store (library, no server)
npm install
npm run buildTest that the model is set up correctly before opening a PR.
# Parse and validate the LikeC4 model
npx likec4 export json -o /tmp/model.json likec4/
# List all components erode finds in the model
npx erode components /tmp/model.json
# Dry-run drift analysis on the current branch
npx erode analyze --model /tmp/model.json --diff "$(git diff main)"The structurizr/ directory contains the same architecture in Structurizr format.
workspace.dsl is the human-readable source; workspace.json is the pre-exported
JSON that erode loads directly (no Java/Docker needed).
# Validate the Structurizr model
npx erode validate structurizr/workspace.json --model-format structurizr
# List all components
npx erode components structurizr/workspace.json --model-format structurizrThese are the kinds of violations erode should catch:
frontendaddsfetch("http://user-service:3001/users")— bypasses api-gatewayapi-gatewayaddsimport { findAll } from "@playground/database"— bypasses servicesproduct-serviceaddsfetch("http://user-service:3001/users")— no relationship in model