Werker architecture
How the repository is divided into apps and packages, what each one owns, and the tools that check it.
The processes and the limits that follow from them are in how it's built.
Package structure
apps/app/ SvelteKit UI and Node server; calls core, and
uses rules for pure logic the browser shares
apps/site/ Public site, docs, blog and waiting list; UI and rules only
apps/reels/ The web app's pages as scripted demos for the site
apps/worker/ Starts the run engine; enqueue script
apps/cli/ The command werker, for npm; types only
packages/ui/ Theme, logo and UI primitives; no dependencies
packages/domain/ Shared types; no dependencies
packages/rules/ Deterministic decisions over domain values
packages/db/ Postgres access, migrations, row-level security
packages/connections/ Provider adapters, secrets, capability bindings
packages/auth/ Sign-in, sessions, workspaces and roles (Better Auth)
packages/core/ Use cases the apps call
packages/runtime/ Run engine: queue claims, Pi harness, workflows
packages/scripts/ Runs an assistant's script in its own process
tools/checks/ Executable package and import boundaries
docs/ Generated glossary of the docs in apps/site Packages use the @werkerai npm scope. The project domain is werker.cloud: the public site is at the apex and the app at app.werker.cloud, both deployed on Coolify
(public site, Coolify).
Source entrypoints are under each package's src/index.ts.
Dependency direction
| Package | May depend on |
|---|---|
| domain | nothing |
| rules | domain |
| db | domain |
| connections | domain, rules |
| auth | domain, db |
| core | domain, rules, db, connections, auth |
| runtime | domain, rules, db, connections |
| scripts | domain |
| ui | nothing |
| web | core, domain, rules, scripts, ui |
| site | ui, rules |
| reels | web, domain, ui |
| worker | runtime, core, domain |
| cli | domain |
Each package may depend only on the packages its policy lists in tools/checks/policy.ts. Which package owns which third-party
dependency, and the other enforced rules, are in executable boundary checks.
Packages
One line each; the README has the detail.
- domain (opens in a new tab): shared types and the registry of platform parts.
- rules (opens in a new tab): deterministic decisions over domain values.
- db (opens in a new tab): Postgres access, migrations, row-level security and live-update listening.
- connections (opens in a new tab): provider adapters, sealed secrets and capability bindings (capabilities).
- auth (opens in a new tab): sign-in, sessions, workspaces and roles (workspaces and access).
- core (opens in a new tab): the use cases the apps call.
- runtime (opens in a new tab): the run engine: queue claims, Pi Durable, sandboxes, workflows.
- scripts (opens in a new tab): runs a script an assistant wrote over MCP (scripts).
- ui (opens in a new tab): theme, logo and UI primitives.
Apps
apps/app: the signed-in SvelteKit app and Node server. Product copy is inapps/app/src/lib/messaging/.GET /api/healthreports process liveness only. How pages update live: database and events.apps/site: the public landing page, pages, docs and blog, prerendered, with a Node server for the waiting list (public site). The app's/redirects to the dashboard or to sign-in.apps/reels: playsapps/app's pages with made-up data, for the public site to run in an iframe (reels (opens in a new tab)).pnpm reels:buildwrites it into the site's static files.apps/worker:src/main.tsstarts the run engine;src/enqueue.tsqueues a run or workflow.apps/cli: the commandwerker, for npm as@werkerai/cli. It talks to a Werker over HTTP and bundles the types it shares (API, CLI and MCP).
Tooling and checks
- Node 24.15+ and pnpm 12.
- SvelteKit 3 and Svelte 5 with the Node adapter.
- Strict TypeScript and shared
tsconfig.base.json. - Tailwind CSS 4.
- Vite+ for development, builds, linting, formatting, and Vitest.
- Playwright Chromium for browser component tests.
- wiki0 for documentation indexing and linting.
Dependency versions are centralised in the pnpm catalogue. pnpm check runs boundary checks, package type
checks, and root tooling type checks.
Tests
pnpm test:boundaries: Node tests for the checker and source parser.pnpm test:packages: Vitest tests for the package APIs.- Web
clientproject:*.svelte.test.tsin real Chromium. - Web
serverproject: other*.test.tsin Node.
pnpm test:unit runs all four groups. Tests require no credentials.
Configuration and deployment
Local development uses Postgres from compose.yaml (pnpm db:up,
port 54329). In development (pnpm dev) the worker reads WERKER_SECRET_KEY from the root .env through nopeek; pnpm start reads an .env if there is one.
The schema is the migrations in packages/db/sql/, applied in name
order by pnpm db:migrate and recorded in schema_migrations. 001_schema.sql is the baseline. Every change is a new numbered file,
and the existing ones are frozen. packages/db/schema.sql is the
schema those files produce, generated by pnpm db:schema (CI fails
when it is out of date) and never edited by hand. The rules for
foreign keys and their indexes are at the top of 001_schema.sql.
pnpm db:migrate applies a file once, so an edited file does not
reach an existing database. pnpm db:reset drops the local database
and rebuilds it: migrations and the dev seed. The seed adds the dev
user, a connection for each provider key in .env, and the sandbox
host from WERKER_SANDBOX_HOST in .env (for example ssh://user@box); without it, eval cases that need a shell are
skipped. The reset loses runs, workflows, agents and workspace-b (which pnpm db:rls-check needs; pnpm add-user adds it back, with
an email no other workspace has).
SvelteKit configuration lives in apps/app/vite.config.ts. The
optional root .env is read during development and builds, and loaded
by the production start command. ORIGIN sets the canonical origin
during the build; runtime HOST and PORT control the Node listener.
Local environment files, build output, databases, and browser reports are ignored by Git. .env.example (opens in a new tab) contains non-secret examples.