Check a SvelteKit frontend
You have a SvelteKit frontend and want chisel-js to find architecture violations in it. This guide installs the TypeScript CLI, runs a check, and explains how to read the output.
Install
Section titled “Install”npm install -g chisel-js # or: bun add -g chisel-jschisel-js --versionRequires Node 20+. Runtime deps (chalk, commander, estree-walker,
fast-glob, svelte, typescript) install automatically — TypeScript is
used to parse and resolve your imports, so it ships with the CLI.
Initialise
Section titled “Initialise”Run init once. It works out which topology your project has and writes
chisel.config.json:
chisel-js init ./your-frontend| Mode | What it means |
|---|---|
sveltekit-standalone |
SvelteKit owns its data layer — Drizzle under $lib/server, no separate backend |
sveltekit-bff |
SvelteKit fronts a separate API through a generated openapi-fetch client |
The mode decides which rules apply: a standalone app has repositories and
remote functions, a BFF has a generated API client. Detection runs only
here — from then on check reads the file, so the rule set can’t change
because someone edited a dependency. Override with
--mode sveltekit-bff if the guess is wrong.
check still works without a config; it detects a mode, says so, and
suggests running init.
Run a check
Section titled “Run a check”Point chisel-js check at your project root. Default path is ..
chisel-js check ./your-frontendNon-zero exit on any ERROR-level violation. That’s what makes it safe to gate commits and CI on.
Read the output
Section titled “Read the output”Coloured, grouped by category, one block per violation. Each violation names the file, line, rule ID, and a short message.
chisel-js check ./your-frontendFor scripts, agents, or CI, ask for JSON; see
Understand a violation for how
to read the deduplicated --json output.
What’s next
Section titled “What’s next”- Understand a violation: read
a rule’s description and fix guidance with
chisel-js explain. - Turn off a rule for a file: exempt legacy files or justified exceptions.
- Block violations before commit:
wire
chisel-jsinto a pre-commit hook. - TypeScript rules reference: every rule, grouped by category.