> ## Documentation Index
> Fetch the complete documentation index at: https://system.muzemus.online/llms.txt
> Use this file to discover all available pages before exploring further.

# Development setup

> How to set up the MUZE development environment locally

## Prerequisites

| Tool       | Version | Purpose                             |
| ---------- | ------- | ----------------------------------- |
| Node.js    | v20+    | Runtime                             |
| pnpm       | v9+     | Package manager                     |
| PostgreSQL | 14+     | Database (or a Neon cloud instance) |
| Git        | 2.x     | Version control                     |

MUZE is a pnpm workspace monorepo with `backend/` and `frontend/` packages. The full directory layout is in [Repository structure](/overview/repository-structure).

## Quick start

### 1. Clone and install

```bash theme={null}
git clone <repository-url>
cd muze-uniform-solutions

# Backend
cd backend
pnpm install

# Frontend
cd ../frontend
pnpm install
```

### 2. Environment setup

Copy the example environment files:

```bash theme={null}
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env
```

Configure the backend `.env` with your database URL and auth secrets. See [Environment variables](/operations/environment-variables) for the full reference.

### 3. Database setup

```bash theme={null}
cd backend
pnpm prisma migrate dev    # Apply all migrations
pnpm prisma generate       # Generate Prisma client
pnpm seed                  # Seed reference data (optional)
```

The seed script provisions roles, a super admin (configured via `SEED_ADMIN_EMAIL` and `SEED_ADMIN_PASSWORD` in `backend/.env`), regions, stores, categories, products, and entitlement rule sets.

### 4. Start the dev servers

```bash theme={null}
# Terminal 1: backend on http://localhost:3001
cd backend
pnpm run start:dev

# Terminal 2: frontend on http://localhost:5173
cd frontend
pnpm dev
```

Verify the backend with `GET http://localhost:3001/api/v1/health`.

## Development scripts

### Backend (`backend/`)

| Script            | Command                  | Purpose                             |
| ----------------- | ------------------------ | ----------------------------------- |
| `start:dev`       | `nest start --watch`     | Development mode with hot reload    |
| `build`           | `nest build`             | Production build                    |
| `start:prod`      | `node dist/src/main`     | Start production build              |
| `prisma:generate` | `prisma generate`        | Generate Prisma client              |
| `prisma:migrate`  | `prisma migrate dev`     | Create/apply development migrations |
| `prisma:deploy`   | `prisma migrate deploy`  | Apply pending migrations            |
| `prisma:studio`   | `prisma studio`          | Database GUI                        |
| `seed`            | `ts-node prisma/seed.ts` | Seed reference data                 |
| `test`            | `vitest run`             | Unit tests                          |
| `test:watch`      | `vitest`                 | Tests in watch mode                 |
| `lint`            | `eslint src/`            | Linter                              |

### Frontend (`frontend/`)

| Script       | Command           | Purpose                  |
| ------------ | ----------------- | ------------------------ |
| `dev`        | `vite`            | Vite dev server          |
| `build`      | `vite build`      | Production build         |
| `preview`    | `vite preview`    | Preview production build |
| `test`       | `vitest run`      | Unit tests               |
| `test:watch` | `vitest`          | Tests in watch mode      |
| `lint`       | `eslint src/`     | Linter                   |
| `e2e`        | `playwright test` | E2E tests                |

## IDE setup

Recommended VS Code extensions: ESLint, Prettier, Prisma, Tailwind CSS IntelliSense.

Both packages have their own `tsconfig.json`. The backend runs TypeScript in strict mode; the frontend uses Vite's built-in TypeScript handling.
