Local development
Prerequisites
- Node.js 22.23.4 or later
- pnpm 9.15
- Docker (for the back end and Postgres)
Starting everything
pnpm installpnpm stack:up # starts the API + Postgres (Docker) and Vite at http://localhost:5173To start from scratch (clean database, migrations and demo data):
pnpm stack:fresh| Service | Address |
|---|---|
| Web (Vite) | http://localhost:5173 |
| API | http://localhost:8090 |
| Postgres | localhost:5433 |
Optionally, copy .env.example to .env and fill in only what you want to change. The most useful
variable locally is OPENROUTER_API_KEY, which turns on the AI assistant (use a key different from
production’s, with a credit limit).
Commands
Front end
| Command | Description |
|---|---|
pnpm dev:web |
The web app’s development server. |
pnpm build |
Builds every package (Turborepo). |
pnpm test |
All tests (Vitest). |
pnpm -F @modulecad/cad-engine test |
One package’s tests. |
pnpm lint |
ESLint. |
pnpm type-check |
Type checking. |
pnpm format |
Prettier. |
pnpm design-system:check |
Checks the design-system mirror. |
Back end
| Command | Description |
|---|---|
pnpm api:up |
Starts the containers without rebuilding. |
pnpm api:rebuild |
Rebuilds the images and starts them (after changing the Dockerfile or dependencies). |
pnpm api:down |
Stops the containers (keeps the database). |
pnpm api:reset |
Deletes the database and starts from scratch. |
pnpm api:migrate |
Applies the migrations (Alembic). |
pnpm api:seed |
Creates demo users and companies (idempotent). |
pnpm api:seed:wipe |
Clears the tables and recreates the demo (refused in production). |
pnpm api:seed:catalog |
Fills a company’s price catalog with realistic values. |
pnpm api:logs |
API logs. |
pnpm api:logs:mail |
Shows only the “sent” emails (log mode). |
pnpm api:psql |
Postgres console. |
pnpm api:test |
Back-end tests (pytest). |
pnpm api:lint |
Ruff. |
Demo accounts
They all use the password seedpass1 (in development).
| Company and role | |
|---|---|
alice@acmefurniture.com |
Acme Furniture — Owner |
bob@acmefurniture.com |
Acme Furniture — Admin |
carol@acmefurniture.com |
Acme Furniture — Designer |
dave@nordicstudio.com |
Nordic Studio — Owner |
eve@nordicstudio.com |
Nordic Studio — Designer |
frank@modulecad.com |
Acme Furniture — Designer and Nordic Studio — Representative |
frank is useful for testing company switching and read-only mode. Each company also gets an invite
token, printed by the seed script.
Demo catalog
docker compose exec api python scripts/seed_demo_catalog.py --company <slug>Creates a 15 mm row for each texture that ships with the app, plus a 3 mm HDF back panel, with
2750 × 1850 sheets and grain on the woods. It only inserts (never deletes); it accepts --dry-run,
--force and --markup.
Code standards
- Prettier: no semicolons, single quotes, trailing commas (es5), 100 columns, 2 spaces.
- ESLint: unused variables are an error (prefix arguments with
_);anyis a warning. - TypeScript strict, ES2022, ESM in every package.
- Names: components and types in PascalCase; functions and variables in camelCase.
- Tests: Vitest, in
__tests__/folders next to the code,*.test.ts(x)files. - Interface: always built from
@modulecad/uiand design tokens — hardcoded colors and spacing in the code are blocked by the linter. - Interface text in pt-BR and en, following the glossary in
CONTEXT.md.
Git hooks
pnpm install sets core.hooksPath to .githooks/.