# rahulps1000/cinesynth architecture

> Architecture diagram of the GitHub repository rahulps1000/cinesynth, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rahulps1000/cinesynth
- Repository: https://github.com/rahulps1000/cinesynth

## Overview

1. **System shape**
   - This is a single Next.js application using the App Router. It combines the browser UI and server-side API routes in one codebase, so the main architectural boundary is between React components in `app/` and route handlers in `app/api/`.

2. **User-facing application**
   - The interactive entry point is `app/page.js`, which likely renders the movie/series recommendation experience. The page is assembled from small presentational components rather than a large monolith.

3. **UI component layer**
   - `app/NavBar.js`, `app/Card.js`, `app/Loader.js`, and `app/ImageWithFallback.js` form the reusable UI subsystem.
   - These components handle layout, result cards, loading states, and safe image rendering when posters or thumbnails are missing.

4. **Styling and app shell**
   - `app/layout.js` defines the shared page shell for the app.
   - `app/globals.css`, `tailwind.config.js`, and `postcss.config.js` indicate Tailwind-based styling, with global styles applied across the app.

5. **Recommendation backend**
   - `app/api/getRecomendation/route.js` is the core orchestration endpoint.
   - Based on the README, this route uses the Gemini API via the `GEMINI_API` environment variable to generate movie/series recommendations from user input.

6. **Movie metadata backend**
   - `app/api/movie/route.js` is a separate backend boundary for fetching movie/series data.
   - The README shows `TMDB_API_KEY` as a required environment variable, so this route likely talks to TMDB for searchable metadata, posters, and other title details.

7. **Data flow**
   - The browser UI collects a user prompt or preference.
   - The frontend calls `getRecomendation` to produce candidate titles.
   - Those results are then enriched or displayed using TMDB-backed movie data through the `movie` route, and rendered as cards in the UI.

8. **External services**
   - Gemini AI is the text-intelligence layer: it drives the recommendation logic.
   - TMDB is the catalog source of truth for structured movie/series data and imagery.
   - The architecture is therefore split between generative AI for suggestions and TMDB for validation/enrichment.

9. **Runtime and deployment model**
   - This is a Next.js serverless-style app that can be deployed directly, with API routes executed on the server side and the UI served from the same project.
   - The README’s Vercel guidance matches that deployment model.

10. **Repo-level supporting files**
   - `next.config.js`, `jsconfig.json`, and the lockfile/package files support the build/runtime environment.
   - `public/googleb611fac7f027bbeb.html` is a verification asset, likely for Google site ownership, and does not affect core application flow.

11. **Architecture summary**
   - The key diagram should show one React/Next.js frontend, two server API routes, and two external dependencies: Gemini for recommendations and TMDB for content metadata.
   - The important boundary is that the client does not talk directly to external APIs; all third-party access is mediated through Next.js route handlers.

Main entry points: [`app/page.js`](https://github.com/rahulps1000/cinesynth/blob/openai/app/page.js) (Home page), [`app/api/getRecomendation/route.js`](https://github.com/rahulps1000/cinesynth/blob/openai/app/api/getRecomendation/route.js) (Recommend API), [`app/api/movie/route.js`](https://github.com/rahulps1000/cinesynth/blob/openai/app/api/movie/route.js) (Movie API), [`app/globals.css`](https://github.com/rahulps1000/cinesynth/blob/openai/app/globals.css) (Global styles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_app_layout["Layout<br/>Next.js shell<br/>[layout.js]"]
  node_app_page["Home page<br/>Next.js page<br/>[page.js]"]
  node_navbar["NavBar<br/>UI component<br/>[NavBar.js]"]
  node_card["Card<br/>UI component<br/>[Card.js]"]
  node_loader["Loader<br/>UI component<br/>[Loader.js]"]
  node_image_fallback["Image fallback<br/>UI component"]
  node_globals_css["Global styles<br/>CSS<br/>[globals.css]"]
end

subgraph group_api["API Routes"]
  node_get_recommendation["Recommend API<br/>route handler<br/>[route.js]"]
  node_movie_api["Movie API<br/>route handler<br/>[route.js]"]
end

subgraph group_external["External Services"]
  node_gemini{{"Gemini API<br/>external AI"}}
  node_tmdb{{"TMDB<br/>external catalog"}}
end

node_next_config["Next config<br/>build config<br/>[next.config.js]"]
node_tailwind_config["Tailwind config<br/>build config<br/>[tailwind.config.js]"]
node_postcss_config["PostCSS config<br/>build config<br/>[postcss.config.js]"]
node_package_json["Package manifest<br/>project config<br/>[package.json]"]
node_verification_html["Verification file<br/>asset"]

node_app_layout -->|"wraps"| node_app_page
node_app_layout -->|"loads"| node_globals_css
node_app_page -->|"uses"| node_navbar
node_app_page -->|"uses"| node_card
node_app_page -->|"uses"| node_loader
node_app_page -->|"uses"| node_image_fallback
node_card -->|"embeds"| node_image_fallback
node_app_page -->|"calls"| node_get_recommendation
node_app_page -->|"calls"| node_movie_api
node_get_recommendation -->|"queries"| node_gemini
node_movie_api -->|"queries"| node_tmdb
node_next_config -.->|"supports"| node_app_page
node_tailwind_config -.->|"supports"| node_globals_css
node_postcss_config -.->|"supports"| node_globals_css
node_package_json -.->|"depends on"| node_get_recommendation
node_package_json -.->|"depends on"| node_movie_api
node_verification_html -.->|"served by"| node_next_config

click node_app_layout "https://github.com/rahulps1000/cinesynth/blob/openai/app/layout.js"
click node_app_page "https://github.com/rahulps1000/cinesynth/blob/openai/app/page.js"
click node_navbar "https://github.com/rahulps1000/cinesynth/blob/openai/app/NavBar.js"
click node_card "https://github.com/rahulps1000/cinesynth/blob/openai/app/Card.js"
click node_loader "https://github.com/rahulps1000/cinesynth/blob/openai/app/Loader.js"
click node_image_fallback "https://github.com/rahulps1000/cinesynth/blob/openai/app/ImageWithFallback.js"
click node_globals_css "https://github.com/rahulps1000/cinesynth/blob/openai/app/globals.css"
click node_get_recommendation "https://github.com/rahulps1000/cinesynth/blob/openai/app/api/getRecomendation/route.js"
click node_movie_api "https://github.com/rahulps1000/cinesynth/blob/openai/app/api/movie/route.js"
click node_next_config "https://github.com/rahulps1000/cinesynth/blob/openai/next.config.js"
click node_tailwind_config "https://github.com/rahulps1000/cinesynth/blob/openai/tailwind.config.js"
click node_postcss_config "https://github.com/rahulps1000/cinesynth/blob/openai/postcss.config.js"
click node_package_json "https://github.com/rahulps1000/cinesynth/blob/openai/package.json"
click node_verification_html "https://github.com/rahulps1000/cinesynth/blob/openai/public/googleb611fac7f027bbeb.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_layout,node_app_page,node_navbar,node_card,node_loader,node_image_fallback,node_globals_css toneBlue
class node_get_recommendation,node_movie_api toneAmber
class node_gemini,node_tmdb toneMint
class node_next_config,node_tailwind_config,node_postcss_config,node_package_json,node_verification_html toneNeutral
```

## Components

### Frontend

React UI and app shell in the Next.js App Router

- [Layout](https://github.com/rahulps1000/cinesynth/blob/openai/app/layout.js): Next.js shell · Shared application shell and root composition · `app/layout.js`
- [Home page](https://github.com/rahulps1000/cinesynth/blob/openai/app/page.js): Next.js page · Interactive recommendation entry point · `app/page.js`
- [NavBar](https://github.com/rahulps1000/cinesynth/blob/openai/app/NavBar.js): UI component · Top-level navigation and header UI · `app/NavBar.js`
- [Card](https://github.com/rahulps1000/cinesynth/blob/openai/app/Card.js): UI component · Renders recommendation result cards · `app/Card.js`
- [Loader](https://github.com/rahulps1000/cinesynth/blob/openai/app/Loader.js): UI component · Loading state for async interactions · `app/Loader.js`
- [Image fallback](https://github.com/rahulps1000/cinesynth/blob/openai/app/ImageWithFallback.js): UI component · Safe image rendering for missing posters · `app/ImageWithFallback.js`
- [Global styles](https://github.com/rahulps1000/cinesynth/blob/openai/app/globals.css): CSS · App-wide styling and Tailwind-backed globals · `app/globals.css`

### API Routes

Server-side boundaries for recommendations and movie metadata

- [Recommend API](https://github.com/rahulps1000/cinesynth/blob/openai/app/api/getRecomendation/route.js): route handler · Orchestrates AI-driven title recommendations · `app/api/getRecomendation/route.js`
- [Movie API](https://github.com/rahulps1000/cinesynth/blob/openai/app/api/movie/route.js): route handler · Fetches movie and series metadata · `app/api/movie/route.js`

### External Services

Third-party services used through the API routes

- **Gemini API**: external AI · Generative recommendation engine
- **TMDB**: external catalog · Source of truth for title metadata and imagery

### Other components

- [Next config](https://github.com/rahulps1000/cinesynth/blob/openai/next.config.js): build config · Next.js build and runtime settings · `next.config.js`
- [Tailwind config](https://github.com/rahulps1000/cinesynth/blob/openai/tailwind.config.js): build config · Tailwind CSS configuration · `tailwind.config.js`
- [PostCSS config](https://github.com/rahulps1000/cinesynth/blob/openai/postcss.config.js): build config · PostCSS pipeline configuration · `postcss.config.js`
- [Package manifest](https://github.com/rahulps1000/cinesynth/blob/openai/package.json): project config · Dependencies and scripts · `package.json`
- [Verification file](https://github.com/rahulps1000/cinesynth/blob/openai/public/googleb611fac7f027bbeb.html): asset · Site ownership verification asset · `public/googleb611fac7f027bbeb.html`

## Connections

- Layout → Home page: wraps · Root shell renders the application page
- Layout → Global styles: loads · Global styles are applied through the app shell
- Home page → NavBar: uses · Page composes shared navigation
- Home page → Card: uses · Page renders recommendation cards
- Home page → Loader: uses · Page shows loading state while fetching results
- Home page → Image fallback: uses · Page-related rendering relies on safe image handling
- Card → Image fallback: embeds · Cards display posters through fallback-aware images
- Home page → Recommend API: calls · Client-side interaction requests recommendations
- Home page → Movie API: calls · Client-side interaction fetches title metadata
- Recommend API → Gemini API: queries · Recommendation logic is delegated to Gemini
- Movie API → TMDB: queries · Metadata and imagery come from TMDB
- Next config → Home page: supports · Build/runtime configuration supports the app
- Tailwind config → Global styles: supports · Tailwind configuration shapes global styling
- PostCSS config → Global styles: supports · PostCSS processes the styling pipeline
- Package manifest → Recommend API: depends on · Project dependencies enable server routes and AI integration
- Package manifest → Movie API: depends on · Project dependencies enable metadata fetching
- Verification file → Next config: served by · Static verification asset is hosted with the app
