# Local setup

## Prerequisites

- Node.js **20+** (docs-site engines)  
- PostgreSQL  
- Backend on **4000**, frontend on **3000**, docs on **3001**  

## Backend

```bash
cd backend
cp .env.example .env
npm install
npx prisma generate
npx prisma migrate deploy   # or migrate dev
npm run db:seed
npm run db:seed-rbac
npm run dev
```

## Frontend

```bash
cd frontend
cp .env.example .env.local
# NEXT_PUBLIC_API_URL=http://localhost:4000/api/v1
npm install
npm run dev
```

## Docs site

```bash
cd docs-site
npm install
npx playwright install chromium   # once — Mermaid SSR
npm start                         # http://localhost:3001
```

Optional: `REALCREDI_APP_URL=https://your-app.example` when building docs against a deployed app.

## Seed users

After `db:seed` + `db:seed-rbac`:

| Email | Password | Role |
|-------|----------|------|
| `admin@realcredi.com` | `admin123` | SUPER_ADMIN |
| `instructor@realcredi.com` | `instructor123` | INSTRUCTOR |
| `student@realcredi.com` | `student123` | STUDENT |
| `corporate@realcredi.com` | `corporate123` | CORPORATE |

No seeded EMPLOYER — register at `/auth/register/employer`.

## MVP demo script

1. Admin → tracks at `/admin/career/tracks`.  
2. Instructor → coach setup until match ready.  
3. Student → intake → evidence → publish `/u/{slug}`.  
4. Employer → org → invoice → admin marks paid → search → intro.  
5. Confirm `/credentials/{code}` vs `/verify`.
