# aditya18mew/movie-app-react architecture

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

- Interactive diagram: https://gitdiagram.com/aditya18mew/movie-app-react
- Repository: https://github.com/aditya18mew/movie-app-react

## Overview

1. **Overall shape**
This is a two-tier movie app: a **React/Vite frontend** in `React/` and an **Express/Node backend** in `express/`. The frontend handles the UI and routing, while the backend owns authentication, user persistence, and server-side integration with the TMDB movie API.

2. **Frontend boundary**
The React app is organized around **page-level routes** in `src/Pages/` such as `homepage`, `trending`, `moviedetails`, `signin`, `signup`, `wishlist`, `favorites`, and the password recovery screens. `main.jsx` and `App.jsx` act as the app entry and route composition layer.

3. **UI/component layer**
Reusable UI lives in `src/components/`: `Navbar`, `MovieCard`, `section`, `skeleton`, `buttons`, `otpform`, and provider/context helpers like `MovieProvider`, `useCustomcontext`, and `useFormdata`. This suggests the frontend centralizes movie/user state in a context layer and composes pages from shared presentational components.

4. **Movie data flow**
Movie discovery and detail views appear to flow from the frontend pages through API calls to the backend’s `moviesRoutes`. The backend likely proxies or normalizes requests to **The Movie Database (TMDB)**, since the README states the TMDB API key is configured server-side. That makes the backend the external API boundary, not the browser.

5. **Authentication flow**
Authentication is handled end-to-end by the backend `authRoutes` and `AuthController`, with the frontend pages `signin`, `signup`, `forget password`, `resetpassword`, and `otpform` covering the user journey. User data is stored in MongoDB through Mongoose, while the frontend likely stores only session/token state.

6. **Protected access**
`middleware/Authmiddleware.js` indicates route protection for authenticated operations, likely guarding user-specific pages such as dashboard, favorites, and wishlist. This creates a clear separation between public movie browsing and authenticated user features.

7. **Password recovery**
The presence of `nodemailer.js`, `otpform`, and reset-password pages indicates a recovery flow that uses email delivery plus a one-time code or reset token. That means the backend is responsible for generating, sending, and validating recovery credentials, while the frontend only collects and submits user input.

8. **Persistence and supporting services**
`utils/mongoosedb.js` connects the app to MongoDB for durable user storage. `config/Redis.js` plus `middleware/ratelimiter.js` show a Redis-backed or Redis-aware control plane for transient state and throttling, which is important for login/reset abuse prevention and short-lived auth workflows.

9. **Validation and security**
Both sides contain regex utilities: `React/src/utils/regex.js` and `express/regex/regex.js`. This implies input validation is duplicated intentionally across client and server, with the backend still acting as the authoritative validation/security layer.

10. **Deployment/runtime boundary**
The repo includes Dockerfiles for both apps, `compose.yaml`, and `nginx.conf` in the React folder. That points to a containerized deployment where the frontend is built and served by Nginx, the backend runs as a separate Node service, and supporting infrastructure like MongoDB/Redis is orchestrated alongside them.

11. **Typical request paths**
A user first loads the React app, navigates through pages, and either browses movie data or signs in. Auth requests go to Express, which validates input, talks to MongoDB, may send mail, and issues JWTs. Movie requests go from React to Express, which fetches TMDB data and returns it to the UI.

12. **Architecture diagram emphasis**
For a diagram, the main boxes should be: **React UI**, **Express API**, **MongoDB**, **Redis**, **TMDB external API**, and **Email service via Nodemailer**. The key arrows are: UI → Express for auth and movie data; Express → MongoDB for users; Express → Redis for throttling/transient state; Express → TMDB for movie metadata; Express → email for password reset delivery.

Main entry points: [`React/src/App.jsx`](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/App.jsx) (App shell), [`express/routes/authRoutes.js`](https://github.com/aditya18mew/movie-app-react/blob/main/express/routes/authRoutes.js) (Auth routes), [`express/utils/AuthController.js`](https://github.com/aditya18mew/movie-app-react/blob/main/express/utils/AuthController.js) (Auth logic), [`express/routes/moviesRoutes.js`](https://github.com/aditya18mew/movie-app-react/blob/main/express/routes/moviesRoutes.js) (Movie routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React UI"]
  node_react_main(("Main entry<br/>react-entry<br/>[main.jsx]"))
  node_react_app["App shell<br/>react-router-shell<br/>[App.jsx]"]
  node_home_page["Home<br/>page<br/>[homepage.jsx]"]
  node_trending_page["Trending<br/>page<br/>[trending.jsx]"]
  node_movie_details["Details<br/>page<br/>[moviedetails.jsx]"]
  node_signin_page["Sign in<br/>auth-page<br/>[signin.jsx]"]
  node_signup_page["Sign up<br/>auth-page<br/>[signup.jsx]"]
  node_recover_pages["Recovery<br/>auth-page"]
  node_dashboard_page["Dashboard<br/>protected-page<br/>[dashboard.jsx]"]
  node_wishlist_page["Wishlist<br/>protected-page<br/>[wishlist.jsx]"]
  node_favorites_page["Favorites<br/>protected-page<br/>[favorites.jsx]"]
  node_movie_provider{{"Movie state<br/>context/provider<br/>[MovieProvider.jsx]"}}
  node_ui_components["UI kit<br/>components<br/>[Navbar.jsx]"]
  node_react_regex["Client validation<br/>[regex.js]"]
end

subgraph group_backend["Express API"]
  node_server_entry(("Server entry<br/>node-entry<br/>[Server.js]"))
  node_auth_routes["Auth routes<br/>http-routes<br/>[authRoutes.js]"]
  node_movie_routes["Movie routes<br/>http-routes<br/>[moviesRoutes.js]"]
  node_auth_controller["Auth logic<br/>controller<br/>[AuthController.js]"]
  node_jwt_tokens["JWT tokens<br/>auth-utils<br/>[jwttokens.js]"]
end

subgraph group_infra["Services"]
  node_mongo_db[("MongoDB<br/>database<br/>[mongoosedb.js]")]
  node_redis_cache[("Redis<br/>cache<br/>[Redis.js]")]
  node_mailer["Email service<br/>mailer<br/>[nodemailer.js]"]
  node_tmdb_api(("TMDB API<br/>external-api"))
end

node_react_main -->|"loads"| node_react_app
node_react_app -->|"routes to"| node_home_page
node_react_app -->|"routes to"| node_trending_page
node_react_app -->|"routes to"| node_movie_details
node_react_app -->|"routes to"| node_signin_page
node_react_app -->|"routes to"| node_signup_page
node_react_app -->|"routes to"| node_recover_pages
node_react_app -->|"routes to"| node_dashboard_page
node_react_app -->|"routes to"| node_wishlist_page
node_react_app -->|"routes to"| node_favorites_page
node_home_page -->|"uses"| node_movie_provider
node_trending_page -->|"uses"| node_movie_provider
node_movie_details -->|"uses"| node_movie_provider
node_signin_page -->|"calls"| node_auth_routes
node_signup_page -->|"calls"| node_auth_routes
node_recover_pages -->|"calls"| node_auth_routes
node_dashboard_page -->|"calls"| node_auth_routes
node_wishlist_page -->|"calls"| node_auth_routes
node_favorites_page -->|"calls"| node_auth_routes
node_movie_details -->|"calls"| node_movie_routes
node_trending_page -->|"calls"| node_movie_routes
node_auth_routes -->|"delegates"| node_auth_controller
node_auth_controller -->|"stores"| node_mongo_db
node_auth_controller -->|"issues"| node_jwt_tokens
node_auth_controller -->|"sends"| node_mailer
node_auth_routes -->|"throttles"| node_redis_cache
node_movie_routes -->|"fetches"| node_tmdb_api
node_auth_routes -.->|"mirrors"| node_react_regex
node_server_entry -->|"mounts"| node_auth_routes
node_server_entry -->|"mounts"| node_movie_routes

click node_react_main "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/main.jsx"
click node_react_app "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/App.jsx"
click node_home_page "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/homepage.jsx"
click node_trending_page "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/trending.jsx"
click node_movie_details "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/moviedetails.jsx"
click node_signin_page "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/signin.jsx"
click node_signup_page "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/signup.jsx"
click node_recover_pages "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/forget password.jsx"
click node_dashboard_page "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/dashboard.jsx"
click node_wishlist_page "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/wishlist.jsx"
click node_favorites_page "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/favorites.jsx"
click node_movie_provider "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/components/MovieProvider.jsx"
click node_ui_components "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/components/Navbar.jsx"
click node_react_regex "https://github.com/aditya18mew/movie-app-react/blob/main/React/src/utils/regex.js"
click node_server_entry "https://github.com/aditya18mew/movie-app-react/blob/main/express/Server.js"
click node_auth_routes "https://github.com/aditya18mew/movie-app-react/blob/main/express/routes/authRoutes.js"
click node_movie_routes "https://github.com/aditya18mew/movie-app-react/blob/main/express/routes/moviesRoutes.js"
click node_auth_controller "https://github.com/aditya18mew/movie-app-react/blob/main/express/utils/AuthController.js"
click node_jwt_tokens "https://github.com/aditya18mew/movie-app-react/blob/main/express/utils/jwttokens.js"
click node_mongo_db "https://github.com/aditya18mew/movie-app-react/blob/main/express/utils/mongoosedb.js"
click node_redis_cache "https://github.com/aditya18mew/movie-app-react/blob/main/express/config/Redis.js"
click node_mailer "https://github.com/aditya18mew/movie-app-react/blob/main/express/utils/nodemailer.js"

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_react_main,node_react_app,node_home_page,node_trending_page,node_movie_details,node_signin_page,node_signup_page,node_recover_pages,node_dashboard_page,node_wishlist_page,node_favorites_page,node_movie_provider,node_ui_components,node_react_regex toneBlue
class node_server_entry,node_auth_routes,node_movie_routes,node_auth_controller,node_jwt_tokens toneAmber
class node_mongo_db,node_redis_cache,node_mailer,node_tmdb_api toneMint
```

## Components

### React UI

Vite/React client for browsing movies and managing user actions.

- [Main entry](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/main.jsx): react-entry · Bootstraps the React application. · `React/src/main.jsx`
- [App shell](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/App.jsx): react-router-shell · Composes global app structure and route wiring. · `React/src/App.jsx`
- [Home](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/homepage.jsx): page · Landing page and primary movie browsing surface. · `React/src/Pages/homepage.jsx`
- [Trending](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/trending.jsx): page · Movie discovery and trending listings. · `React/src/Pages/trending.jsx`
- [Details](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/moviedetails.jsx): page · Movie detail view. · `React/src/Pages/moviedetails.jsx`
- [Sign in](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/signin.jsx): auth-page · Login screen. · `React/src/Pages/signin.jsx`
- [Sign up](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/signup.jsx): auth-page · Account registration screen. · `React/src/Pages/signup.jsx`
- [Recovery](https://github.com/aditya18mew/movie-app-react/blob/HEAD/React/src/Pages/forget%20password.jsx): auth-page · Password recovery and reset screens. · `React/src/Pages/forget password.jsx`
- [Dashboard](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/dashboard.jsx): protected-page · Authenticated user dashboard. · `React/src/Pages/dashboard.jsx`
- [Wishlist](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/wishlist.jsx): protected-page · Saved movies list. · `React/src/Pages/wishlist.jsx`
- [Favorites](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/Pages/favorites.jsx): protected-page · Favorite movies list. · `React/src/Pages/favorites.jsx`
- [Movie state](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/components/MovieProvider.jsx): context/provider · Shared movie and user-facing state container. · `React/src/components/MovieProvider.jsx`
- [UI kit](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/components/Navbar.jsx): components · Reusable navigation, cards, sections, skeletons, buttons, and OTP form. · `React/src/components/Navbar.jsx`
- [Client validation](https://github.com/aditya18mew/movie-app-react/blob/main/React/src/utils/regex.js): validation · Frontend input validation helpers. · `React/src/utils/regex.js`

### Express API

Node server for auth, user state, and movie data integration.

- [Server entry](https://github.com/aditya18mew/movie-app-react/blob/main/express/Server.js): node-entry · Starts the Express application. · `express/Server.js`
- [Auth routes](https://github.com/aditya18mew/movie-app-react/blob/main/express/routes/authRoutes.js): http-routes · Authentication API surface. · `express/routes/authRoutes.js`
- [Movie routes](https://github.com/aditya18mew/movie-app-react/blob/main/express/routes/moviesRoutes.js): http-routes · Movie API surface. · `express/routes/moviesRoutes.js`
- [Auth logic](https://github.com/aditya18mew/movie-app-react/blob/main/express/utils/AuthController.js): controller · Registration, login, recovery, and account flow orchestration. · `express/utils/AuthController.js`
- [JWT tokens](https://github.com/aditya18mew/movie-app-react/blob/main/express/utils/jwttokens.js): auth-utils · Token creation and verification helpers. · `express/utils/jwttokens.js`

### Services

External and supporting runtime services used by the backend.

- [MongoDB](https://github.com/aditya18mew/movie-app-react/blob/main/express/utils/mongoosedb.js): database · Mongoose-backed persistence for users and related records. · `express/utils/mongoosedb.js`
- [Redis](https://github.com/aditya18mew/movie-app-react/blob/main/express/config/Redis.js): cache · Transient state and rate-limit support. · `express/config/Redis.js`
- [Email service](https://github.com/aditya18mew/movie-app-react/blob/main/express/utils/nodemailer.js): mailer · Nodemailer-backed recovery email delivery. · `express/utils/nodemailer.js`
- **TMDB API**: external-api · External movie metadata provider used by the backend.

## Connections

- Main entry → App shell: loads · Bootstraps the application shell.
- App shell → Home: routes to · Primary public landing route.
- App shell → Trending: routes to · Discovery route.
- App shell → Details: routes to · Movie detail route.
- App shell → Sign in: routes to · Authentication route.
- App shell → Sign up: routes to · Registration route.
- App shell → Recovery: routes to · Password recovery and reset flow.
- App shell → Dashboard: routes to · Protected user area.
- App shell → Wishlist: routes to · Protected user list.
- App shell → Favorites: routes to · Protected user list.
- Home → Movie state: uses · Reads shared movie state.
- Trending → Movie state: uses · Reads shared movie state.
- Details → Movie state: uses · Reads shared movie state.
- Sign in → Auth routes: calls · Submits login requests.
- Sign up → Auth routes: calls · Submits registration requests.
- Recovery → Auth routes: calls · Submits recovery and reset requests.
- Dashboard → Auth routes: calls · Loads authenticated user data.
- Wishlist → Auth routes: calls · Reads protected saved movies.
- Favorites → Auth routes: calls · Reads protected saved movies.
- Details → Movie routes: calls · Fetches movie metadata.
- Trending → Movie routes: calls · Fetches movie listings.
- Auth routes → Auth logic: delegates · Routes authentication workflows.
- Auth logic → MongoDB: stores · Persists and reads user records.
- Auth logic → JWT tokens: issues · Creates and validates auth tokens.
- Auth logic → Email service: sends · Delivers recovery emails.
- Auth routes → Redis: throttles · Supports rate limiting and transient auth state.
- Movie routes → TMDB API: fetches · Proxies movie data from TMDB.
- Auth routes → Client validation: mirrors · Shares validation rules with the client.
- Server entry → Auth routes: mounts · Registers auth endpoints.
- Server entry → Movie routes: mounts · Registers movie endpoints.
