Architecture
Project Architecture
High-level repository layers, execution flow, and deployment structure.
The repository is split between a Go engine and a Next.js frontend. The Go side owns parsing, layout, definitions, and export. The web side owns editing, preview interaction, theming, docs, and the builder UX.
The API route /api/generate is deployed as a Go serverless function. The frontend is deployed from web/ as a Next.js app, while vercel.json wires both runtimes together.
Repository layers
| Path | Responsibility |
|---|---|
| cmd/ | CLI entrypoints and local API dev server |
| internal/ctl/ | Main orchestration pipeline |
| internal/types/ | Runtime model for resources, links, and geometry |
| internal/definition/ | Definition loading and icon metadata |
| pkg/diagram/ | Public Go wrapper for embedding |
| api/generate.go | Vercel serverless handler |
| web/ | Next.js frontend, builder, docs, editor, preview |
Execution flow
- Input YAML is parsed.
- Definition files are loaded and validated.
- Resources and links are constructed into the runtime graph.
- Layout is computed deterministically where possible.
- Output is exported as PNG, PDF, or draw.io XML.