How leosilva-dev/moviematch works
Project type and purpose
• This is a full-stack web application built with Next.js (App Router), using React for the UI, Prisma + a SQL database for persistence, and integrating with The Movie Database (TMDB) API.
• Users can create “sessions” (identified by a code), browse popular movies (via TMDB), and vote on movies within a session.
High-level file-structure analysis
• infra/docker-compose.yaml: local Docker setup (database, possibly Prisma Studio).
• prisma/: database schema and migrations for sessions & votes tables.
• src/app/: Next.js App Router—pages (SSR/SSG), server-side API routes under src/app/api.
• src/components/: shared UI components (buttons, cards, inputs).
• src/lib/: helper modules (Prisma client, TMDB API client, utility functions).
• next.config.ts, eslint.config.mjs, postcss.config.mjs, tsconfig.json: configuration.
Key README insights
• Bootstrapped via create-next-app.
• Standard dev workflow (npm run dev).
• Deployed on Vercel (supports serverless functions for API routes).
Main components
a. Client (Browser) – React pages & UI components
b. Next.js Server –
• App Router + Page rendering (SSR/SSG)
• API Routes (serverless functions)
c. Internal Services –
• TMDB Service (wrapped in src/lib/tmdb.ts)
• Prisma Service (src/lib/prisma.ts)
d. Database – PostgreSQL (or another SQL) managed via Docker Compose
e. External Service – TMDB REST API
Relationships & data flow
• Browser → Next.js Page (SSR) → Next.js API Route (if client-side fetch or form submit).
• API Route uses Prisma client to read/write sessions & votes in the database.
• API Route may call TMDB client to fetch popular movies.
• Next.js Page renders data returned from API or fetches directly via getServerSideProps / server components.
• Prisma client issues SQL queries to the database.
• Docker Compose hosts the database; Prisma migrations manage schema.
Architectural patterns & design principles
• Separation of concerns:
• UI Components vs. Data-access (Prisma) vs. External API (TMDB)
• API routes as thin controllers invoking service libraries.
• DTOs/Types in src/types to keep domain models typed.
• Migrations with Prisma to ensure reproducible schema changes.
• Infra folder codifies environment setup (Docker for local dev).
Technologies & frameworks in each layer
• Frontend: Next.js App Router, React, CSS modules or global CSS (globals.css), Vercel Font Optimization.
• Backend: Next.js API Routes (serverless), TypeScript.
• Data layer: Prisma ORM, PostgreSQL.
• External: TMDB REST API via Axios or native fetch wrapper in src/lib/tmdb.ts.
• Infra: Docker Compose for local DB.