# mustafa-j-wardeh17/film-and-series-central architecture

> Architecture diagram of the GitHub repository mustafa-j-wardeh17/film-and-series-central, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mustafa-j-wardeh17/film-and-series-central
- Repository: https://github.com/mustafa-j-wardeh17/film-and-series-central

## Overview

##### Project Type & Purpose
- Full-stack web application for browsing, searching, and reviewing movies/series.
- Next.js on the frontend (with server-side rendering and static generation), Prisma ORM on the backend, and Supabase (PostgreSQL) as the database.
- Deployed on Vercel; assets served from Vercel/CDN.

##### File Structure
- **src/app**: Next.js App Router handling pages, layouts, and loading states.
- **src/components**: Reusable UI components (cards, swipers, header/footer, loaders).
- **lib/**: Shared utilities (data fetching in actions.ts, Prisma client instantiation in prisma.ts, helpers in util.ts).
- **prisma/**: Database schema (schema.prisma) and migration history.
- **public/**: Static assets (images, video, manifest, robots.txt).
- Config files: next.config.mjs, tailwind.config.ts, tsconfig.json, .eslintrc.json.

##### Extract Architectural Insights from the README
- Next.js 14 for SSR/SSG and a fast UX.
- Prisma ORM abstracts the database; Supabase hosts Postgres.
- Emphasis on responsive design, search/filter capabilities, detailed pages for movies/series.

##### Main Components & Their Interactions
a. **Client (Browser)**
- Requests pages or JSON data via routes defined in src/app.
- Loads static assets (CSS, images) from the CDN.
b. **Next.js Server (Vercel Serverless Functions)**
- Handles routing (SSR, SSG).
- Imports lib/actions.ts to fetch data via Prisma.
- Renders React components, injects data into pages.
c. **Prisma Layer (lib/prisma.ts)**
- Manages database connections.
- Translates TypeScript queries into SQL.
d. **Database (Supabase/PostgreSQL)**
- Stores movies, series, genres, reviews, users, etc.
- Enforces relationships defined in schema.prisma.
e. **CDN / Static Asset Store**
- Serves the files in /public (images, videos, manifest).
f. **External Services**
- Vercel for hosting Next.js.
- Supabase hosting, authentication, and storage (if used).

##### Architectural Patterns & Design Principles
- **Separation of Concerns**:
- Presentation layer (React components)
- Data-access layer (Prisma)
- Business logic (lib/actions.ts)
- **Serverless/SSR Hybrid**: leverages Next.js App Router for both server-rendered and client-navigated paths.
- **Modular Components**: small, reusable UI components under /components.
- **Infrastructure as Code**: Prisma migrations define DB schema changes.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    Client["Client (Browser)"]:::client
    CDN["CDN / Static Assets"]:::external

    %% Frontend & Server Layer
    subgraph "Next.js Application"
        direction TB
        Pages["Next.js App Router\n(src/app)"]:::server
        Components["UI Components\n(src/components)"]:::server
        Configs["Config Files\n(next.config.mjs,\n tailwind.config.ts,\n tsconfig.json,\n .eslintrc.json)"]:::config
        Pages -->|renders| Components
        Pages -->|loads configs| Configs
    end

    %% Data Access Layer
    subgraph "Business & Data Layer"
        direction TB
        Actions["Business Logic /\nData Fetching\n(lib/actions.ts)"]:::logic
        PrismaClient["Prisma Client\n(lib/prisma.ts)"]:::prisma
        Utilities["Shared Utilities\n(lib/util.ts,\n lib/data.ts)"]:::logic
        Actions -->|calls| PrismaClient
        Actions -->|uses| Utilities
    end

    %% Database Layer
    subgraph "Database"
        direction TB
        Schema["Schema\n(prisma/schema.prisma)"]:::db
        Migrations["Migrations\n(prisma/migrations)"]:::db
        DB["PostgreSQL Database\n(Supabase)"]:::db
        Schema --> DB
        Migrations --> DB
    end

    %% External Services
    subgraph "External Services"
        direction TB
        Vercel["Vercel Hosting"]:::external
        SupabaseAuth["Supabase Auth/Storage"]:::external
    end

    %% Connections
    Client -->|HTTPS GET/POST\nrequests| Pages
    Client -->|fetch static assets| CDN
    Pages -->|invokes\nBusiness Logic| Actions
    PrismaClient -->|executes SQL| DB
    Vercel -.-> Pages
    SupabaseAuth -.-> DB

    %% Click Events
    click Client "https://github.com/mustafa-j-wardeh17/film-and-series-central/tree/master/src/app"
    click CDN "https://github.com/mustafa-j-wardeh17/film-and-series-central/tree/master/public"
    click Pages "https://github.com/mustafa-j-wardeh17/film-and-series-central/tree/master/src/app"
    click Components "https://github.com/mustafa-j-wardeh17/film-and-series-central/tree/master/src/components"
    click Actions "https://github.com/mustafa-j-wardeh17/film-and-series-central/blob/master/lib/actions.ts"
    click PrismaClient "https://github.com/mustafa-j-wardeh17/film-and-series-central/blob/master/lib/prisma.ts"
    click Utilities "https://github.com/mustafa-j-wardeh17/film-and-series-central/blob/master/lib/util.ts"
    click Utilities "https://github.com/mustafa-j-wardeh17/film-and-series-central/blob/master/lib/data.ts"
    click Schema "https://github.com/mustafa-j-wardeh17/film-and-series-central/blob/master/prisma/schema.prisma"
    click Migrations "https://github.com/mustafa-j-wardeh17/film-and-series-central/tree/master/prisma/migrations"
    click Configs "https://github.com/mustafa-j-wardeh17/film-and-series-central/blob/master/next.config.mjs"
    click Configs "https://github.com/mustafa-j-wardeh17/film-and-series-central/blob/master/tailwind.config.ts"
    click Configs "https://github.com/mustafa-j-wardeh17/film-and-series-central/blob/master/tsconfig.json"
    click Configs "https://github.com/mustafa-j-wardeh17/film-and-series-central/blob/master/.eslintrc.json"

    %% Styles
    classDef client fill:#D0E8FF,stroke:#3399FF,stroke-width:1px
    classDef server fill:#DFFFE0,stroke:#33CC33,stroke-width:1px
    classDef logic fill:#FFF8C6,stroke:#FFCC33,stroke-width:1px
    classDef prisma fill:#FFF4E5,stroke:#FF9900,stroke-width:1px
    classDef db fill:#FFE5E5,stroke:#FF3333,stroke-width:1px
    classDef external fill:#F0F0F0,stroke:#999999,stroke-width:1px
    classDef config fill:#E8E8F8,stroke:#6666CC,stroke-width:1px
```
