Files
comparaison/AGENTS.md
Hermes Agent 26c7ad4d7b Add Playwright E2E test suite (25 tests across 4 specs)
- playwright.config.ts: headless CI setup with JSON/HTML reporters
- e2e/global-setup.ts: app reachability check before tests
- e2e/auth.spec.ts: 6 auth tests (sign-in, session, protected routes)
- e2e/compare.spec.ts: 8 API tests (validation, SSE flow, DB persistence)
- e2e/comparisons.spec.ts: 6 CRUD tests (list, detail, 404, view counts)
- e2e/user.spec.ts: 5 user tests (stats, pagination, session binding)
- e2e/helpers.ts: shared SSE parsing, auth, URL resolution utilities
- e2e/README.md: setup and run instructions
- AGENTS.md: updated with LLM provider notes and testing docs
- .gitignore: added playwright report/result directories
- package.json: added @playwright/test and test:e2e scripts
2026-04-27 20:48:05 -07:00

2.1 KiB

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

# 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_URLhttps://nano-gpt.com/api/v1
  • LLM_MODELminimax/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.