# This is NOT the Next.js you know This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code. Heed deprecation notices. # Comparaison — Project Agent Rules ## LLM Provider - **Base URL**: `https://nano-gpt.com/api/v1` (not `api.nano-gpt.com`) - **API Key**: Use `NANOGPT_API_KEY` env var from the host's Docker `.env` - **Model**: `minimax/minimax-m2.7` (supports `response_format: {type: json_object}`) - **Schema tolerance**: The LLM output may deviate from the requested schema. The provider code (`src/lib/llm/providers/openai.ts`) includes `normalizeResult()` to handle common deviations (overallScore as object, sources as strings, dimensions as array of objects). Do NOT assume the LLM returns the exact schema. ## Development ```bash # Local dev npm run dev # Build Docker image docker compose build # Run container docker compose up -d # Run E2E tests npm install npm run test:e2e:install npm run test:e2e ``` ## Deployment Deployed to `ubuntu:/srv/compose/comparaison/` via `docker compose`. Traefik routes `comparaison.local.tophermayor.com` → container port 3000. ## Environment Variables Required in `.env`: - `DATABASE_URL` — PostgreSQL connection string - `BETTER_AUTH_SECRET` — Session secret (min 32 chars) - `BETTER_AUTH_URL` — Auth callback URL - `LLM_API_KEY` — NanoGPT API key (Hermes `NANOGPT_API_KEY` works) - `LLM_BASE_URL` — `https://nano-gpt.com/api/v1` - `LLM_MODEL` — `minimax/minimax-m2.7` ## Key Routes | Route | Method | Auth | Description | |-------|--------|------|-------------| | `/api/compare` | POST | Yes | Start SSE comparison stream | | `/api/comparisons/[slug]` | GET | Yes | Get comparison by slug | | `/api/user/comparisons` | GET | Yes | List user's comparisons | | `/api/user/stats` | GET | Yes | User statistics | | `/api/auth/sign-in/email` | POST | No | Email/password sign-in | ## Testing E2E tests live in `e2e/` and use Playwright. See `e2e/README.md` for setup.