# Local development

Node 20+. PostgreSQL for the API.

## Backend

```bash
cd main-backend
npm install
npx prisma generate
npx prisma migrate deploy
npm run seed
npm run dev
```

API defaults to port **4000**. `npm run seed` upserts catalog packages
from `src/types/constants.ts`. Local schema changes use
`npx prisma migrate dev`, not `db push` — a push without a migration
folder is what left production missing `contact_replies`.

Required names (values stay in `.env`, never in git or these docs):
`DATABASE_URL`, `JWT` secret, `PORT`, Paystack secret **on the API
only**. Object storage names: `AWS_ACCESS_KEY_ID`,
`AWS_SECRET_ACCESS_KEY`, `AWS_REGION`, `AWS_BUCKET_NAME`,
`S3_ENDPOINT`, `S3_FORCE_PATH_STYLE` (local MinIO). Production R2 is
documented in [Production setup](./production.md).

Do not point `DATABASE_URL` at Cloudflare Hyperdrive. Hyperdrive is a
Workers pooler, not the API database. See
[Hyperdrive](./hyperdrive.md).

Optional Harbour Street Realty demo inventory (properties, published
listings, projects, and showcase pages):

```bash
npx ts-node --transpile-only scripts/seed-harbour-demo.ts
```

Run it from `main-backend` after the company slug `harbour-street-realty`
already exists. It is idempotent. Preview:
`http://localhost:3000/sites/harbour-street-realty`.

## App

```bash
cd re360muse-app
npm install
npm run dev
```

App defaults to port **3000**. Required names: `NEXT_PUBLIC_API_URL`,
`NEXTAUTH_SECRET`, `NEXTAUTH_URL`, `NEXT_PUBLIC_WS_APP_URL`. Optional:
`NEXT_PUBLIC_DOCS_URL` (defaults to `http://localhost:3002`).

Do not put `PAYSTACK_SECRET_KEY` in the frontend.

## Docs

```bash
cd re360muse-docs-site
npm install
npx playwright install chromium
npm run start
```

Docs default to port **3002**. `npm run build` fails on broken links or
invalid Mermaid.

## PWA

The app ships `manifest.webmanifest` and `sw.js` with theme color `#1B49BC`.
Install from the browser. There is no second native project.
