Live example
Everything ayida produces is a projection of the HCL. The clearest way to see that is a finished
site. The microservices example
from the ayida repository is compiled with ayida build and hosted here:
View the compiled site → docs.mdstn.dev/ayida/demo
The same diagrams, element pages, breadcrumbs and navigation tree that ayida build writes to
dist/, served as a static site.
What the example models
microservices is an order-management platform split across one file per service — ayida merges
every *.ayida.hcl file beneath the project root into one architecture:
| File | Contains |
|---|---|
main.ayida.hcl | The project, the customer and partner actors, external providers, and two declared views |
gateway.ayida.hcl | The api_gateway system (edge) |
users.ayida.hcl | The user_service system |
orders.ayida.hcl | The order_service system |
notifications.ayida.hcl | The notification_service system |
platform.ayida.hcl | The platform system (event bus and shared stores) |
deployment.ayida.hcl | A prod deployment with Terraform bindings |
It exercises five systems, event-driven communication (kind = "async" and kind = "trigger"
relationships through an event bus), owners, and two declared views (order-flow and edge)
alongside the automatic ones.
The hosted copy adds prose for every element. Each system keeps its own overview, and each
person, external, container and component has its own markdown file under docs/people/,
docs/externals/, docs/containers/ and docs/components/. Each element page shows that prose
above its diagrams and neighbours. For example, the Order API
has its methods and status model, and the Rate limiter
explains its fail-open behaviour. The source lives in this site’s repository at
demo/ayida/microservices/.
What ayida build produced
ayida build -p demo/ayida/microservices --ignore wide_view
built demo/ayida/microservices/dist: 96 written, 0 unchanged, 0 removedThe hosted site is that output directory, unedited:
- An index with the landscape diagram and counts.
- Ten view pages: the landscape, one per system with containers, one per container with
components, the
proddeployment, and the two declared views. - Twenty-three element pages, each with its prose, the diagrams it appears in, its neighbours (“calls” and “called by”), and a breadcrumb to its parent.
- Diagrams as both
.d2source and rendered.svg, laid out with elk by default. - Markdown mirroring every page, for wikis and pull-request review.
Every file opens with a notice naming the *.ayida.hcl sources it came from, and the output is
byte-identical across runs — so a committed dist/ is reviewable in a diff.
Reproduce it locally
# Clone the repo and build the example — no d2 binary needed
git clone https://github.com/madstone-tech/ayida
cd ayida
ayida build -p examples/microservices
# Or preview it live, rebuilding on every edit
ayida serve -p examples/microservices # http://127.0.0.1:8080Then open examples/microservices/dist/index.html, or edit any *.ayida.hcl file under
examples/microservices/ and watch ayida serve rebuild. The quickstart walks
through building your own from an empty directory.