Your first model in VS Code
Make a repository, write a small model in VS Code, see it drawn beside the editor as you type, and fix a mistake the editor reports. About fifteen minutes. The same model from the command line is Your first model from the command line.
1. Install
Install the Kanoniq extension and the kq command line, as Install describes. You need kq for the next step only; everything after it happens in VS Code.
2. Make a repository
A model lives in a repository: a folder that kq init sets up. In VS Code's terminal, make one, say my-model/:
kq init my-model
It writes the files of a repository, kanoniq.repository.json and model/my-model.kq among them, and AGENTS.md, the authoring brief an AI assistant reads, should you work with one. Open the my-model/ folder in VS Code with File › Open Folder…. The Explorer marks its model/ folder with an M and its portal/ folder with a P.
3. Write a model
Open my-model/model/my-model.kq and fill in its Ecosystem, giving it a name of its own:
From the top:
- An ecosystem is the outermost boundary, usually a company. Everything sits inside one.
kq initdeclared this one, with the folder's name as its Code. - The domain and its function say what the organization does, whatever the systems.
- The platform holds the components that do it.
web-shopis an app people use, with a single-page app as its user interface;order-serviceis a backend service. web-shop -> order-service/orders-api over http auth user-tokensays the web shop calls the order service's HTTP API, carrying the signed-in user's token. You don't declareorders-api: naming it is enough, and Kanoniq adds it.realizessays which components carry out which function.
The quoted text is what a reader sees, the element's name. The lowercase word before it is its Code, which other statements use to refer to it. See Names, Codes and paths.
4. See it
Open my-model/ in VS Code. The file is colored, and a mistake shows in the Problems panel as you type.
Right-click my-model.kq and choose Show Kanoniq Viewer. The diagram opens beside the editor and follows your edits:
The diagram in words
2026-10-05-getting-started · Whole model
Boxes
- Shop (Ecosystem)
- Selling (Domain)
- Place an order (Function)
- Storefront (Platform)
- Web Shop (User-facing app)
- Web Shop (SPA)
- Order Service (Backend)
- orders-api (HTTP API)
- Web Shop (User-facing app)
- Selling (Domain)
Lines
- Web Shop → orders-api: connection, HTTP · user-token
- Web Shop → Place an order: realization
- Order Service → Place an order: realization
That is the whole model. Pick Selling in the viewer to see the Domain's layered view instead: what Selling does, and the components that do it. See Views and notation.
5. Fix a mistake
Change the connection so it names the order service but not its interface:
The line is underlined at once, and the Problems panel lists the error, KQ022: a connection lands on an interface or a channel, never on a component. Put /orders-api back, and the error goes.
6. Commit it
Commit every .kq file, model/my-model.g.kq included: it holds the Ids that keep each element's identity when you rename or move it. Build again after every change; a build of an unchanged model changes nothing.
Next
- Concepts: the ideas the rest follows from, one page each.
- Model the applications: the first of the modeling guides, each growing one model a step at a time.
- Working in VS Code: what the editor does for you.
- Troubleshooting: what you see when something goes wrong, and what to do.
© 2026 Extenza Works. All rights reserved.