Thanks for helping draft a better studio. PRs and issues are welcome — this document covers the 10 minutes you need before your first patch.
git clone git@github.com:Livin21/KloudArch.git
cd KloudArch
npm install
npm run dev # landing on /, studio on /studioThe studio works with zero configuration. For the AI copilot, copy
.env.example to .env.local and add one provider key.
Before pushing:
npm run lint && npm test && npm run buildCI runs exactly those three commands on every PR.
The generators and validators are covered by Vitest:
npm test # run once
npm run test:watchtests/ holds targeted assertions plus golden snapshots of every
starter template in both IaC formats (tests/__snapshots__/). If you change
a generator on purpose, review the snapshot diff and update it with:
npx vitest run -uA snapshot diff you didn't expect means your change altered generated IaC for an existing design — read it before updating.
| Path | What it is |
|---|---|
src/lib/catalog.ts |
Service registry — categories, config fields, icons |
src/lib/terraform.ts |
Design graph → HCL (one emitter per service) |
src/lib/cloudformation.ts |
Design graph → CloudFormation JSON (deploy engine) |
src/lib/validate.ts |
Design checks shown in the studio |
src/lib/store.ts |
Zustand design store — history, persistence, actions |
src/lib/templates.ts |
Starter architectures |
src/lib/ai-bridge.ts |
AI tool calls → store mutations |
tests/ |
Vitest suite + golden snapshots |
src/components/studio/ |
Canvas, palette, inspector, panels |
src/app/api/chat/route.ts |
AI SDK route (client-executed tools) |
- Catalog entry in
src/lib/catalog.ts— id, name, abbr, category, lucide icon, blurb, and typed config fields. That alone puts it in the palette, inspector, and AI catalog. - Two emitters, keyed by your service id in the
EMITTERSrecords ofsrc/lib/terraform.ts(returns an HCL string) andsrc/lib/cloudformation.ts(callsctx.res()to add resources). Both share the sameCtxshape —ctx.out()/ctx.inn()for connected services,ctx.zone()for VPC/subnet containment,ctx.once()for shared blocks. Prefer a# TODO/ placeholder over silently emitting broken IaC. - Optionally add a validation rule in
src/lib/validate.tsif the service has an easy-to-miss requirement (e.g. needs a subnet, needs a target). - A test in
tests/— assert the key resources/wiring your emitters produce (see the existing service blocks for the pattern). Runnpm test; if you added the service to a template, update snapshots withnpx vitest run -u. - If the AI should configure it well, make sure the field names are self-explanatory — the catalog is injected into the copilot's prompt.
- TypeScript strict; keep
npm run lintclean. - Match the existing visual language: Saira + Chivo Mono, the existing color
tokens (
bg-panel,text-fg-dim, …), 1px hairlines, mono micro-labels. - Keep comments for constraints the code can't express, not narration.
- One change per PR, with a screenshot/GIF for anything visual.
- Reference an issue when one exists.
- New services: include a small design in the PR description showing the generated Terraform for a connected example.