3.7 KiB
3.7 KiB
Development guide
Prerequisites
- Node.js ≥ 24
- pnpm ≥ 10 (
npm install -g pnpm@10) - Docker (for local infrastructure)
Local setup
# 1. Clone the repository
git clone git@git.mifi.dev:mifi-ventures/dwellops-platform.git
cd dwellops-platform
# 2. Copy environment files
cp .env.example .env
cp apps/api/.env.example apps/api/.env
cp apps/web/.env.example apps/web/.env
# 3. Start local services (Postgres + Mailpit)
docker compose up -d
# 4. Install all workspace dependencies
pnpm install
# 5. Generate Prisma client
pnpm db:generate
# 6. Run initial migration
pnpm db:migrate:dev
# 7. (Optional) Seed with dev data
pnpm db:seed
# 8. Start dev servers
pnpm dev
Dev Container (VS Code / GitHub Codespaces)
Open the repository in VS Code and click Reopen in Container when prompted,
or run the command palette → Dev Containers: Reopen in Container.
The container starts Postgres and Mailpit via Docker Compose.
On first create, pnpm install and pnpm db:generate run automatically.
All ports are forwarded: see .devcontainer/devcontainer.json for the full list.
Running tests
# Unit + integration tests (all workspaces)
pnpm test
# Watch mode
pnpm --filter @dwellops/api test:watch
pnpm --filter @dwellops/web test:watch
# End-to-end tests (requires the web app to be running)
pnpm test:e2e
# Coverage report
pnpm --filter @dwellops/api test -- --coverage
Storybook
# Run Storybook for the web app (includes packages/ui stories)
pnpm --filter @dwellops/web storybook
# Run Storybook for the UI package standalone
pnpm --filter @dwellops/ui storybook
Database operations
pnpm db:generate # Re-generate Prisma client after schema changes
pnpm db:migrate:dev # Create and apply a migration (dev only)
pnpm db:migrate # Deploy pending migrations (CI/production)
pnpm db:push # Push schema changes without a migration (prototype only)
pnpm db:studio # Open Prisma Studio in the browser
pnpm db:seed # Seed the database with dev data
i18n
# Aggregate component translations.json files into messages/<locale>.json
pnpm i18n:aggregate
Add new strings by editing translations.json files alongside components,
then running pnpm i18n:aggregate. Never hand-edit messages/en.json
for component-specific strings.
Code quality
pnpm lint # ESLint + Stylelint
pnpm lint:fix # Auto-fix lint issues
pnpm typecheck # TypeScript across all workspaces
pnpm format # Prettier
pnpm format:check # Check formatting without writing
Pre-commit hooks run lint-staged automatically.
Adding a new package
- Create
packages/<name>/withpackage.json,tsconfig.json, andsrc/index.ts. - Name the package
@dwellops/<name>. - Extend
@dwellops/config/tsconfig/base.json(ornode.json/react-library.json). - Add a
workspace:*reference in any consumer'spackage.json. - Add to root
tsconfig.jsonreferences. - Run
pnpm install.
Adding a new route in apps/api
- Create
src/modules/<feature>/<feature>.routes.ts. - Implement thin route handlers — call services for business logic.
- Register the routes in
src/app.ts. - Write
<feature>.test.tsalongside the routes. - Update Swagger schemas as part of the change.
Adding a new page in apps/web
- Create
src/app/[locale]/<path>/page.tsx— thin page that delegates to a view. - Create
src/views/<FeatureName>View/with the view component. - Create any new components in
src/components/orsrc/widgets/. - Add translations to
translations.jsonalongside each component. - Run
pnpm i18n:aggregate. - Add Storybook stories for any new components/widgets.