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

# Marketplace Setup

> How to run the SLM Marketplace codebase locally.

# Marketplace Setup

A Next.js marketplace for Small Language Models, built by Neurometric.ai.

## Local Development (Without Docker)

```bash theme={null}
npm install
npm run dev
```

Open [http://localhost:3000](http://localhost:3000).

## Local Development (With Docker)

1. **Copy env file and fill in values:**
   ```bash theme={null}
   cp .env.example .env
   ```

2. **Start app + database:**
   ```bash theme={null}
   docker compose up
   ```
   The app will be available at [http://localhost:3000](http://localhost:3000).

3. **Run database migrations (first time or after schema changes):**
   ```bash theme={null}
   docker compose exec app npm run db:migrate
   ```

4. **Seed the database:**
   ```bash theme={null}
   docker compose exec app npm run db:seed
   ```

5. **Open Prisma Studio (database browser):**
   ```bash theme={null}
   docker compose exec app npx prisma studio --port 5555 --browser none
   ```
   Available at [http://localhost:5555](http://localhost:5555).

## Database Commands

The project uses PostgreSQL with Prisma ORM.

| Command               | Description                                   |
| --------------------- | --------------------------------------------- |
| `npm run db:migrate`  | Create and apply a new migration              |
| `npm run db:deploy`   | Apply pending migrations (production)         |
| `npm run db:generate` | Regenerate Prisma Client after schema changes |
| `npm run db:seed`     | Seed the database                             |
| `npm run db:push`     | Push schema changes without a migration file  |
| `npm run db:studio`   | Open Prisma Studio                            |

## Analytics

PostHog tracking is set up via `src/lib/analytics.ts`. Use the `track()` helper to send events:

```ts theme={null}
import { track } from "@/lib/analytics";

track("model_viewed", { model_id: "phi-3-mini" });
track("build_form_submitted");
```
