This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Environment: This project uses a Nix flake environment with
direnv. Usepnpm nxfor project tasks andtask(Taskfile) for orchestrated workflows. - Context Awareness: Read
README.mdfor domain-specific vocabulary (flow nodes, delta system) before starting complex tasks. - File Editing: Verify files exist before editing. Use
git statusandgit diffto verify changes. Never revert changes you didn't author unless instructed. Never commit changes unless explicitly asked. - Verification: Always test, lint, and compile after making changes.
task dev:desktop # Full desktop app (Electron + React + Go Server)
pnpm nx run server:dev # Go server with hot reload
pnpm nx run client:dev # React frontend
pnpm nx run spec:build # Regenerate from TypeSpec (after editing .tsp files)
pnpm nx run db:generate # Regenerate sqlc (after editing .sql files)
cd apps/cli && task build:release # Build CLI binarytask test # All unit tests
pnpm nx run server:test # Server tests only
pnpm nx run db:test # DB tests only
pnpm nx run cli:test # CLI tests only
# Single Go test (use -run for specific functions)
cd packages/server && go test -run TestFunctionName ./path/to/package/ -v -timeout 30s
cd packages/db && go test -run TestFunctionName ./path/to/package/ -v -timeout 10s
cd apps/cli && go test -run TestFunctionName ./path/to/package/ -v -timeout 30stask lint # ESLint + format checks + golangci-lint
task fix # Prettier + Syncpack auto-fix
pnpm nx run server:lint # Go linters (golangci-lint + norawsql + notxread)task benchmark:run # Run benchmarks
task benchmark:baseline # Save baseline
task benchmark:compare # Compare against baselineNever manually edit version numbers in package.json. Use Nx version plans:
# 1. Create a version plan (commits a .nx/version-plans/<name>.md file)
# Bump types: patch, minor, major
# Projects: desktop, cli, api-recorder-extension
task version-plan project=desktop # Interactive — prompts for bump type + message
# Or create the file directly (non-interactive):
# .nx/version-plans/<descriptive-name>.md
# ---
# desktop: patch
# ---
# Changelog message here.
# 2. Commit & push the version plan file
# 3. Trigger the release workflow (via GitHub Actions):
gh workflow run release.yaml -f desktop=true # -f cli=true, -f web=true, etc.The release workflow reads version plans, bumps versions, creates git tags + GitHub releases, and dispatches platform-specific build workflows (Electron Builder, Go binaries, etc.).
DevTools is a local-first, open-source API testing platform (Postman alternative) — desktop app, CLI, and Chrome extension. Features request recording, visual flow building, and CI/CD integration.
apps/desktop— Electron app (TypeScript/React, electron-vite)apps/cli— Go CLI (cobra). Embedspackages/worker-js(TypeScript worker bundled via tsup)packages/server— Go backend (Connect RPC, SQLite/LibSQL)packages/client— React frontend (TanStack Router/Query, Effect-TS, React Flow)packages/ui— Shared React component library (React Aria, Tailwind Variants, Storybook)packages/db— Go database package (devtoolsdb), sqlc generated code, SQLite driverspackages/spec— TypeSpec definitions → Protobuf → Go/TypeScript codegen (single source of truth)packages/worker-js— TypeScript worker bundled into CLI binarytools/— Custom Go linters (norawsql,notxread), benchmarking, spec emitter, ESLint config
go.work with Go 1.25. Modules: apps/cli, packages/db, packages/server, packages/spec, and tools.
- Services:
sprefix (shttp,senv,sflow,suser,sworkspace) - Models:
mprefix (mhttp,mflow,menv,muser) - RPC handlers:
rprefix (rhttp,rflowv2,renv) - IDs: All use
idwrap.IDWrap(ULID-based) frompackages/server/pkg/idwrap
- RPC Layer (
packages/server/internal/api) — Connect RPC handlers. All follow Fetch-Check-Act:- FETCH: Read data via Reader services (non-blocking, parallel)
- CHECK: Validate permissions/rules (pure Go, in memory)
- ACT: Write via Writer services inside a short transaction
- Publishes events to
eventstreamafter successful transactions
- Service Layer (
packages/server/pkg/service) — Domain logic, split into Reader (read-only,*sql.DBpool) and Writer (write-only,*sql.Tx, per-transaction) - Model Layer (
packages/server/pkg/model) — Pure Go domain structs bridging API (Proto) and DB (sqlc) types - Data Access (
packages/db/pkg/sqlc) — sqlc-generated code. Schema inschema/, queries inqueries/, output ingen/
Large RPC handlers are split by concern: rhttp_crud.go, rhttp_exec.go, rhttp_delta_*.go, etc.
pnpm nx run spec:build runs: TypeSpec compile → buf generate → post-process. Output in packages/spec/dist/:
buf/go/— Go protobuf + Connect RPCbuf/typescript/— TypeScript protobuf typestanstack-db/typescript/— TanStack DB types
- Strictness:
@tsconfig/strictest, noany - Styling: Tailwind CSS v4
- State: Effect-TS + TanStack Query
- Formatting: Prettier (single quotes, JSX single quotes). ESLint with perfectionist import sorting
- Dependencies: Pnpm catalog mode (strict) — all versions centralized in
pnpm-workspace.yaml - No TS unit tests — quality enforced via ESLint + strict TypeScript
- Isolated service tests:
sqlitemem.NewSQLiteMem(ctx)— single-connection in-memory SQLite - RPC/integration tests:
testutil.CreateBaseDB/dbtest.GetTestDB(ctx)— shared-cache in-memory SQLite - One DB per test. Never share DB instances across tests
- Seeding:
BaseTestServices.CreateTempCollectionfor workspace/user/collection state t.Parallel()only if each subtest creates its own independent DB- Transactions: Keep short. Use
devtoolsdb.TxnRollbackin defer. Commit before reading from a different connection - Server tests run with
-p 8(8 parallel test packages)
For tests requiring external services (APIs, cloud):
- File naming:
integration_*.go - Build tags:
//go:build ai_integration - Env var guard:
if os.Getenv("RUN_XX_INTEGRATION") != "true" { t.Skip() }
Server lint (pnpm nx run server:lint) includes:
golangci-lintwith extensive rules (govet, gosec, errorlint, revive, exhaustive, etc.)go tool norawsql— enforces sqlc usage, no raw SQL stringsgo tool notxread— prevents reads inside transactions (SQLite deadlock prevention)
- Functional design, lean packages. No complex OOP hierarchies
- SQLite reads before transactions. Transactions as short as possible
- Map errors to Connect RPC codes (
connect.CodeNotFound, notCodePermissionDeniedfor missing resources — prevents ID enumeration) - Strict model separation: API types (Proto) ↔ Domain types (model) ↔ Storage types (sqlc gen)
- Flow Engine & Nodes:
packages/server/docs/specs/FLOW.md - HTTP & Proxy:
packages/server/docs/specs/HTTP.md - Real-time Sync:
packages/server/docs/specs/SYNC.md - Mutation System:
packages/server/docs/specs/MUTATION.md - Service Architecture:
packages/server/docs/specs/BACKEND_ARCHITECTURE_V2.md - Bulk Operations:
packages/server/docs/specs/BULK_SYNC_TRANSACTION_WRAPPERS.md