How imadeusf/jeux-bingo works
Project type and purpose
• This is a full‑stack web application built with Next.js (App Router) that hosts an online bingo game.
File structure
• Top‑level:
• prisma/ → database schema (schema.prisma) and migration scripts
• public/ → static assets (images, 90+ sound files)
• src/app/ → Next.js pages & server components (game, logs, API routes)
• src/components/, src/context/, src/hooks/ → React client components, context providers, custom hooks
• Configuration: next.config.ts, tsconfig.json, eslint.config.mjs
• API layer: src/app/api/logs/route.ts – Next.js Route Handler for logging draws
• Front‑end styling & logic: TypeScript + styled‑components + SCSS + React Context + hooks
README for additional insights
• Frontend: Next.js, TypeScript, styled‑components, SCSS, HTML5
• Backend: Neon (PostgreSQL), Prisma ORM, deployed on Vercel
a. Main components
1. Client Browser (UI)
2. Next.js Application
• Server Components (SSR/SSG)
• Client Components (GameBody, GameHeader, GameFooter, Button, etc.)
• React Context (GameContext) + Custom Hooks (useGameStart, useGameLogs)
3. Static Asset Server (public/images, public/sounds)
4. API Layer (/api/logs)
5. Prisma Client
6. Database (PostgreSQL on Neon)
7. Hosting Platforms (Vercel for Next.js, Neon for DB)
b. Relationships and interactions
• UI requests static sound file → served from public/sounds via Next.js static server
• If logging enabled → Client → POST /api/logs → Next.js Route Handler → Prisma Client → writes to Postgres
• Logs page (src/app/logs/page.tsx) → SSR fetch GET /api/logs → displays history
• Prisma migrations manage schema changes, run at deployment via Vercel hooks
c. Architectural patterns
• Next.js App Router with server+client components
• React Context for state management
• Custom hooks for encapsulating business logic
• API routes as thin controllers
• ORM (Prisma) as model layer
• Static assets served via Next.js “public” directory
d. Key technologies & libraries
• Next.js 13 (App Router)
• React + TypeScript
• styled‑components + SCSS
• Prisma ORM (schema.prisma + migrations)
• PostgreSQL (Neon)
• Vercel (hosting CI/CD)
Diagramming recommendations
• user actions → React Context → API calls
• API calls → DB operations
• asset requests → static server
• Frontend (blue)
• API/Server (green)
• Database (orange)
• Static Assets (gray)
• Rectangles for services/modules
• Clouds for hosting platforms