# CLAUDE.md Guidance for working in this repository. ## What this is **Plein R** — website for an association of merchants/businesses in the Bassin de Pompey. A single Next.js application serving a public **Accueil** page and an authenticated, role-based **Backend** (admin + member space). Postgres is an external container. ## Stack - Next.js 15 (App Router, TypeScript, `output: "standalone"`) - PostgreSQL 16 + Drizzle ORM (`src/db/schema.ts`) with `drizzle-kit` migrations - Auth.js v5 (credentials provider, JWT sessions) — RBAC in `src/lib/rbac.ts` - One app container + one Postgres container (`docker-compose.yml`) ## Commands ```bash npm run dev # dev server npm run build # production build npm run db:generate # regenerate SQL after editing src/db/schema.ts npm run db:migrate # apply migrations npm run db:seed # seed demo data docker compose up --build # full stack ``` ## Conventions - **Styling**: faithful port of the original design as inline styles + a small design-system in `src/app/globals.css` (palette as CSS vars, fonts, twinkle/float animations, hover lifts, responsive grid helpers). No Tailwind. - **Mutations**: server actions in `src/app/backend/actions.ts`. Each action re-checks auth + capability via `auth()` and `can()` before writing, then `revalidatePath()`. - **Access control**: `src/middleware.ts` gates `/backend/*`; each page further guards by role (`isStaff`, `can`) and redirects. - **Data reads** for the public site live in `src/lib/queries.ts`. - After changing `src/db/schema.ts`, run `npm run db:generate` and commit the new file under `drizzle/`. ## Roles `admin` > `moderator` > `editor` are staff; `member` is an adhérent linked to a `members` row via `users.memberId`. Capability matrix is in `src/lib/rbac.ts`. ## Docker notes - Migrations + optional seed run on container start via `docker-entrypoint.sh`. - `npm run build:scripts` bundles `migrate`/`seed` into `dist/*.cjs` so the runtime image needs no dev dependencies. - The standalone server binds `HOSTNAME=0.0.0.0`, `PORT=3000`. ## Logo `public/assets/logo.svg` is a brand-colour recreation; swap in the official asset when available (referenced as `/assets/logo.svg`).