mirror of
https://github.com/R0m1k3/PleinR.git
synced 2026-10-21 22:28:04 +02:00
Implémente le site Plein R (Accueil + Backend) sur Next.js + Postgres + Docker
Application unique Next.js (App Router, TypeScript) servant : - Accueil public : héro, recherche, métiers, promotions, mises à l'honneur (données issues de Postgres) - Backend authentifié avec RBAC : tableau de bord, adhérents (CRUD), modération des promotions, administrateurs, espace adhérent (publication avec aperçu) Technique : - Drizzle ORM + drizzle-kit (migrations versionnées) sur driver pg - Auth.js v5 (credentials, sessions JWT), rôles admin/moderator/editor/member - Middleware de protection de /backend + gardes par rôle dans chaque vue - Server actions pour toutes les mutations (vérif auth + capacité + revalidate) - Design fidèle aux maquettes (design-system CSS, animations, responsive) Conteneurisation : - 1 conteneur applicatif (sortie standalone) + 1 conteneur Postgres externe - docker-compose avec healthcheck ; migrations + seed au démarrage - scripts migrate/seed bundlés (esbuild) pour un runtime sans devDeps Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XwfhYHzC9hQWPDnQ2p53GL
This commit is contained in:
45 files changed
+12013
No files matched your search
@@ -0,0 +1,59 @@
|
||||
# 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`).
|
||||
Reference in new issue
Block a user