Files
likec4-template/README.md
T
2026-08-24 14:44:36 +02:00

66 lines
2.6 KiB
Markdown

# LikeC4 template
A small, vendor-neutral starter for describing software architecture with LikeC4. The included fictional Parcel Workshop model demonstrates a system boundary, two services, one relationship kind, and one view without prescribing a real architecture.
## Prerequisites
- Node.js 22.22.3 or newer
- npm
## Setup
```bash
npm ci
npm start
```
The development viewer serves the model locally and reloads when LikeC4 sources change.
## Scripts
| Command | Purpose |
| --- | --- |
| `npm start` | Start the local LikeC4 viewer. |
| `npm run dev` | Start the local LikeC4 viewer. |
| `npm run validate` | Validate the model. |
| `npm run format` | Format LikeC4 sources. |
| `npm run format:check` | Check LikeC4 source formatting. |
| `npm run build` | Build the static viewer into `dist/`. |
| `npm run export:drawio` | Export Draw.io files into `generated/drawio/`. |
| `npm run export:png` | Export PNG files into `generated/png/`. |
| `npm run export:json` | Export the model into `generated/model.json`. |
## Layout
```text
likec4-template/
|-- .opencode/skills/likec4/ LikeC4 guidance for OpenCode
|-- docs/modeling-conventions.md
|-- src/specification.c4 Element and relationship kinds
|-- src/model.c4 Architecture elements and relationships
|-- src/views.c4 Diagram views
|-- AGENTS.md Project instructions for OpenCode
|-- likec4.config.json LikeC4 project configuration
|-- opencode.json OpenCode project configuration
|-- package.json npm scripts and LikeC4 dependency
`-- package-lock.json Reproducible npm dependency lock
```
## Replace the starter
1. Replace the fictional elements and relationships in `src/model.c4`.
2. Keep only the kinds used by your model in `src/specification.c4`.
3. Update `src/views.c4` to show the perspectives your readers need.
4. Keep the relationship-kind table in `docs/modeling-conventions.md` synchronized with the specification.
5. Run `npm run format`, `npm run validate`, and `npm run build`.
LikeC4 merges source files, so a larger model can be split into additional `*.c4` files under `src/` while retaining the specification/model/views separation.
## Generated output
Build output is written to `dist/`; exports are written to `generated/`. Both directories are ignored by Git and can be recreated from the model sources.
## OpenCode support
`opencode.json` loads the project instructions in `AGENTS.md`. The bundled `.opencode/skills/likec4/` skill supplies LikeC4 documentation and directs model changes to follow `docs/modeling-conventions.md` and pass `npm run validate`.