crates/: Rust workspace crates —server(API + bins),db(SQLx models/migrations),executors,services,utils,git(Git operations),api-types(shared API types for local + remote),review(PR review tool),deployment,local-deployment,remote.packages/local-web/: Local React + TypeScript app entrypoint (Vite, Tailwind). Shell source inpackages/local-web/src.packages/remote-web/: Remote deployment frontend entrypoint.packages/web-core/: Shared React + TypeScript frontend library used by local + remote web (packages/web-core/src).shared/: Generated TypeScript types (shared/types.ts,shared/remote-types.ts) and agent tool schemas (shared/schemas/). Do not edit generated files directly.assets/,dev_assets_seed/,dev_assets/: Packaged and local dev assets.npx-cli/: Files published to the npm CLI package.scripts/: Dev helpers (ports, DB preparation).docs/: Documentation files.
crates/remote/AGENTS.md— Remote server architecture, ElectricSQL integration, mutation patterns, environment variables.docs/AGENTS.md— Mintlify documentation writing guidelines and component reference.packages/local-web/AGENTS.md— Web app design system styling guidelines.
ts-rs allows you to derive TypeScript types from Rust structs/enums. By annotating your Rust types with #[derive(TS)] and related macros, ts-rs will generate .ts declaration files for those types.
When making changes to the types, you can regenerate them using pnpm run generate-types
Do not manually edit shared/types.ts, instead edit crates/server/src/bin/generate_types.rs
For remote/cloud types, regenerate using pnpm run remote:generate-types
Do not manually edit shared/remote-types.ts, instead edit crates/remote/src/bin/remote-generate-types.rs (see crates/remote/AGENTS.md for details).
- Install:
pnpm i - Run dev (web app + backend with ports auto-assigned):
pnpm run dev - Backend (watch):
pnpm run backend:dev:watch - Web app (dev):
pnpm run local-web:dev - Type checks:
pnpm run check(frontend + all backend Rust workspaces) andpnpm run backend:check(all backend Rust workspaces, includingcrates/remote) - Rust tests:
cargo test --workspace - Generate TS types from Rust:
pnpm run generate-types(orgenerate-types:checkin CI) - Prepare SQLx (offline):
pnpm run prepare-db - Prepare SQLx (remote package, postgres):
pnpm run remote:prepare-db - Local NPX build:
pnpm run build:npxthenpnpm packinnpx-cli/ - Format code:
pnpm run format(runscargo fmtfor all backend Rust workspaces + web-core/web Prettier) - Lint:
pnpm run lint(runs web/ui ESLint +cargo clippyfor all backend Rust workspaces)
- Run
pnpm run formatto format all Rust workspaces and web code.
- Rust:
rustfmtenforced (rustfmt.toml); group imports by crate; snake_case modules, PascalCase types. - TypeScript/React: ESLint + Prettier (2 spaces, single quotes, 80 cols). PascalCase components, camelCase vars/functions, kebab-case file names where practical.
- Keep functions small, add
Debug/Serialize/Deserializewhere useful.
- Rust: prefer unit tests alongside code (
#[cfg(test)]), runcargo test --workspace. Add tests for new logic and edge cases. - Web app: ensure
pnpm run checkandpnpm run lintpass. If adding runtime logic, include lightweight tests (e.g., Vitest) in the same directory.
- Use
.envfor local overrides; never commit secrets. Key envs:FRONTEND_PORT,BACKEND_PORT,HOST - Dev ports and assets are managed by
scripts/setup-dev-environment.js.