# huxn-webdev/mern-movies-app architecture

> Architecture diagram of the GitHub repository huxn-webdev/mern-movies-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/huxn-webdev/mern-movies-app
- Repository: https://github.com/huxn-webdev/mern-movies-app

## Overview

This is a MERN movie-catalog application: visitors browse, filter, sort, and review movies; registered users manage profiles; administrators manage movies, genres, and comments. The frontend routes pages and uses RTK Query for API requests, while Express routes dispatch to controllers that read and write MongoDB models. The tree also includes image uploads and an admin dashboard. Some frontend and backend wiring is inferred only from endpoint definitions and route registration; uncertain links are omitted rather than treated as verified calls.

Main entry points: [`frontend/src/main.jsx`](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/main.jsx) (Application routes), [`frontend/src/pages/Movies/AllMovies.jsx`](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Movies/AllMovies.jsx) (Movie catalog), [`frontend/src/redux/api/movies.js`](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/redux/api/movies.js) (Movie API client), [`backend/index.js`](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/index.js) (Express server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browse["Movie discovery"]
  node_home["Home<br/>[Home.jsx]"]
  node_catalog["Movie catalog<br/>[AllMovies.jsx]"]
  node_movie_detail["Movie details<br/>[MovieDetails.jsx]"]
end

subgraph group_identity["User identity"]
  node_auth_pages["Login and registration<br/>[Register.jsx]"]
  node_profile["User profile<br/>[Profile.jsx]"]
end

subgraph group_admin["Administration"]
  node_admin_movies["Movie management<br/>[CreateMovie.jsx]"]
  node_admin_genres["Genre management<br/>[GenreList.jsx]"]
  node_admin_comments["Comment moderation<br/>[AllComments.jsx]"]
  node_dashboard["Admin dashboard<br/>[Main.jsx]"]
end

subgraph group_frontend["Frontend foundation"]
  node_app_routes["Application routes<br/>[main.jsx]"]
  node_movie_api["Movie API client<br/>[movies.js]"]
  node_genre_api["Genre API client<br/>[genre.js]"]
  node_movie_state["Catalog state<br/>[moviesSlice.js]"]
  node_user_api["User API client<br/>[users.js]"]
  node_auth_state["Authentication state<br/>[authSlice.js]"]
end

subgraph group_backend["Backend API and data"]
  node_server["Express server<br/>[index.js]"]
  node_movie_routes["Movie routes<br/>[moviesRoutes.js]"]
  node_user_routes["User routes<br/>[userRoutes.js]"]
  node_genre_routes["Genre routes<br/>[genreRoutes.js]"]
  node_upload_routes["Image uploads<br/>[uploadRoutes.js]"]
  node_movie_controller["Movie operations<br/>[movieController.js]"]
  node_user_controller["User operations<br/>[userController.js]"]
  node_genre_controller["Genre operations<br/>[genreController.js]"]
  node_auth_middleware["Access control<br/>[authMiddleware.js]"]
  node_movie_model[("Movie records<br/>[Movie.js]")]
  node_user_model[("User records<br/>[User.js]")]
  node_genre_model[("Genre records<br/>[Genre.js]")]
end

node_visitor(("Visitor"))
node_user(("Signed-in user"))
node_admin_actor(("Administrator"))
node_mongo[("MongoDB")]

node_visitor -->|"opens app"| node_app_routes
node_user -->|"opens app"| node_app_routes
node_admin_actor -->|"opens app"| node_app_routes
node_app_routes -->|"routes to"| node_home
node_app_routes -->|"routes to"| node_catalog
node_app_routes -->|"routes to"| node_movie_detail
node_app_routes -->|"routes to"| node_auth_pages
node_app_routes -->|"routes to"| node_profile
node_app_routes -->|"routes to"| node_admin_movies
node_app_routes -->|"routes to"| node_admin_genres
node_app_routes -->|"routes to"| node_admin_comments
node_app_routes -->|"routes to"| node_dashboard
node_home -->|"renders"| node_catalog
node_catalog -->|"fetches films"| node_movie_api
node_catalog -->|"fetches genres"| node_genre_api
node_catalog -->|"updates filters"| node_movie_state
node_movie_detail -->|"fetches details"| node_movie_api
node_auth_pages -->|"submits credentials"| node_user_api
node_auth_pages -->|"sets credentials"| node_auth_state
node_profile -->|"updates profile"| node_user_api
node_profile -->|"reads identity"| node_auth_state
node_admin_movies -->|"manages films"| node_movie_api
node_admin_movies -->|"loads genres"| node_genre_api
node_admin_comments -->|"moderates comments"| node_movie_api
node_dashboard -->|"queries films"| node_movie_api
node_dashboard -->|"queries users"| node_user_api
node_server -->|"registers routes"| node_movie_routes
node_server -->|"registers routes"| node_user_routes
node_server -->|"registers routes"| node_genre_routes
node_server -->|"registers routes"| node_upload_routes
node_movie_routes -->|"dispatches requests"| node_movie_controller
node_movie_routes -->|"guards requests"| node_auth_middleware
node_user_routes -->|"dispatches requests"| node_user_controller
node_user_routes -->|"guards requests"| node_auth_middleware
node_genre_routes -->|"dispatches requests"| node_genre_controller
node_genre_routes -->|"guards requests"| node_auth_middleware
node_movie_controller -->|"reads and writes"| node_movie_model
node_user_controller -->|"reads and writes"| node_user_model
node_genre_controller -->|"reads and writes"| node_genre_model
node_auth_middleware -->|"loads user"| node_user_model
node_movie_model -.->|"persists records"| node_mongo
node_user_model -.->|"persists records"| node_mongo
node_genre_model -.->|"persists records"| node_mongo

click node_app_routes "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/main.jsx"
click node_home "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Home.jsx"
click node_catalog "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Movies/AllMovies.jsx"
click node_movie_detail "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Movies/MovieDetails.jsx"
click node_movie_api "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/redux/api/movies.js"
click node_genre_api "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/redux/api/genre.js"
click node_movie_state "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/redux/features/movies/moviesSlice.js"
click node_auth_pages "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Auth/Register.jsx"
click node_profile "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/User/Profile.jsx"
click node_user_api "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/redux/api/users.js"
click node_auth_state "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/redux/features/auth/authSlice.js"
click node_admin_movies "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Admin/CreateMovie.jsx"
click node_admin_genres "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Admin/GenreList.jsx"
click node_admin_comments "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Admin/AllComments.jsx"
click node_dashboard "https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Admin/Dashboard/Main/Main.jsx"
click node_server "https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/index.js"
click node_movie_routes "https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/routes/moviesRoutes.js"
click node_user_routes "https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/routes/userRoutes.js"
click node_genre_routes "https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/routes/genreRoutes.js"
click node_upload_routes "https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/routes/uploadRoutes.js"
click node_movie_controller "https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/controllers/movieController.js"
click node_user_controller "https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/controllers/userController.js"
click node_genre_controller "https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/controllers/genreController.js"
click node_auth_middleware "https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/middlewares/authMiddleware.js"
click node_movie_model "https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/models/Movie.js"
click node_user_model "https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/models/User.js"
click node_genre_model "https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/models/Genre.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_home,node_catalog,node_movie_detail,node_user toneBlue
class node_auth_pages,node_profile,node_mongo toneAmber
class node_admin_movies,node_admin_genres,node_admin_comments,node_dashboard toneMint
class node_app_routes,node_movie_api,node_genre_api,node_movie_state,node_user_api,node_auth_state toneRose
class node_server,node_movie_routes,node_user_routes,node_genre_routes,node_upload_routes,node_movie_controller,node_user_controller,node_genre_controller,node_auth_middleware,node_movie_model,node_user_model,node_genre_model,node_visitor,node_admin_actor toneIndigo
```

## Components

### Movie discovery

- [Home](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Movie catalog](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Movies/AllMovies.jsx): `frontend/src/pages/Movies/AllMovies.jsx`
- [Movie details](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Movies/MovieDetails.jsx): `frontend/src/pages/Movies/MovieDetails.jsx`

### User identity

- [Login and registration](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Auth/Register.jsx): `frontend/src/pages/Auth/Register.jsx`
- [User profile](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/User/Profile.jsx): `frontend/src/pages/User/Profile.jsx`

### Administration

- [Movie management](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Admin/CreateMovie.jsx): `frontend/src/pages/Admin/CreateMovie.jsx`
- [Genre management](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Admin/GenreList.jsx): `frontend/src/pages/Admin/GenreList.jsx`
- [Comment moderation](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Admin/AllComments.jsx): `frontend/src/pages/Admin/AllComments.jsx`
- [Admin dashboard](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/pages/Admin/Dashboard/Main/Main.jsx): `frontend/src/pages/Admin/Dashboard/Main/Main.jsx`

### Frontend foundation

- [Application routes](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Movie API client](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/redux/api/movies.js): `frontend/src/redux/api/movies.js`
- [Genre API client](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/redux/api/genre.js): `frontend/src/redux/api/genre.js`
- [Catalog state](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/redux/features/movies/moviesSlice.js): `frontend/src/redux/features/movies/moviesSlice.js`
- [User API client](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/redux/api/users.js): `frontend/src/redux/api/users.js`
- [Authentication state](https://github.com/huxn-webdev/mern-movies-app/blob/main/frontend/src/redux/features/auth/authSlice.js): `frontend/src/redux/features/auth/authSlice.js`

### Backend API and data

- [Express server](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/index.js): `backend/index.js`
- [Movie routes](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/routes/moviesRoutes.js): `backend/routes/moviesRoutes.js`
- [User routes](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/routes/userRoutes.js): `backend/routes/userRoutes.js`
- [Genre routes](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/routes/genreRoutes.js): `backend/routes/genreRoutes.js`
- [Image uploads](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/routes/uploadRoutes.js): `backend/routes/uploadRoutes.js`
- [Movie operations](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/controllers/movieController.js): `backend/controllers/movieController.js`
- [User operations](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Genre operations](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/controllers/genreController.js): `backend/controllers/genreController.js`
- [Access control](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/middlewares/authMiddleware.js): `backend/middlewares/authMiddleware.js`
- [Movie records](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/models/Movie.js): `backend/models/Movie.js`
- [User records](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/models/User.js): `backend/models/User.js`
- [Genre records](https://github.com/huxn-webdev/mern-movies-app/blob/main/backend/models/Genre.js): `backend/models/Genre.js`

### Other components

- **Visitor**
- **Signed-in user**
- **Administrator**
- **MongoDB**

## Connections

- Visitor → Application routes: opens app (evidence: `frontend/src/main.jsx`)
- Signed-in user → Application routes: opens app (evidence: `frontend/src/main.jsx`)
- Administrator → Application routes: opens app (evidence: `frontend/src/main.jsx`)
- Application routes → Home: routes to (evidence: `frontend/src/main.jsx`)
- Application routes → Movie catalog: routes to (evidence: `frontend/src/main.jsx`)
- Application routes → Movie details: routes to (evidence: `frontend/src/main.jsx`)
- Application routes → Login and registration: routes to (evidence: `frontend/src/main.jsx`)
- Application routes → User profile: routes to (evidence: `frontend/src/main.jsx`)
- Application routes → Movie management: routes to (evidence: `frontend/src/main.jsx`)
- Application routes → Genre management: routes to (evidence: `frontend/src/main.jsx`)
- Application routes → Comment moderation: routes to (evidence: `frontend/src/main.jsx`)
- Application routes → Admin dashboard: routes to (evidence: `frontend/src/main.jsx`)
- Home → Movie catalog: renders (evidence: `frontend/src/pages/Home.jsx`)
- Movie catalog → Movie API client: fetches films (evidence: `frontend/src/pages/Movies/AllMovies.jsx`)
- Movie catalog → Genre API client: fetches genres (evidence: `frontend/src/pages/Movies/AllMovies.jsx`)
- Movie catalog → Catalog state: updates filters (evidence: `frontend/src/pages/Movies/AllMovies.jsx`)
- Movie details → Movie API client: fetches details (evidence: `frontend/src/pages/Movies/MovieDetails.jsx`)
- Login and registration → User API client: submits credentials (evidence: `frontend/src/pages/Auth/Register.jsx`)
- Login and registration → Authentication state: sets credentials (evidence: `frontend/src/pages/Auth/Register.jsx`)
- User profile → User API client: updates profile (evidence: `frontend/src/pages/User/Profile.jsx`)
- User profile → Authentication state: reads identity (evidence: `frontend/src/pages/User/Profile.jsx`)
- Movie management → Movie API client: manages films (evidence: `frontend/src/pages/Admin/CreateMovie.jsx`)
- Movie management → Genre API client: loads genres (evidence: `frontend/src/pages/Admin/CreateMovie.jsx`)
- Comment moderation → Movie API client: moderates comments (evidence: `frontend/src/pages/Admin/AllComments.jsx`)
- Admin dashboard → Movie API client: queries films (evidence: `frontend/src/pages/Admin/Dashboard/Main/Main.jsx`)
- Admin dashboard → User API client: queries users (evidence: `frontend/src/pages/Admin/Dashboard/Main/Main.jsx`)
- Express server → Movie routes: registers routes (evidence: `backend/index.js`)
- Express server → User routes: registers routes (evidence: `backend/index.js`)
- Express server → Genre routes: registers routes (evidence: `backend/index.js`)
- Express server → Image uploads: registers routes (evidence: `backend/index.js`)
- Movie routes → Movie operations: dispatches requests (evidence: `backend/routes/moviesRoutes.js`)
- Movie routes → Access control: guards requests (evidence: `backend/routes/moviesRoutes.js`)
- User routes → User operations: dispatches requests (evidence: `backend/routes/userRoutes.js`)
- User routes → Access control: guards requests (evidence: `backend/routes/userRoutes.js`)
- Genre routes → Genre operations: dispatches requests (evidence: `backend/routes/genreRoutes.js`)
- Genre routes → Access control: guards requests (evidence: `backend/routes/genreRoutes.js`)
- Movie operations → Movie records: reads and writes (evidence: `backend/controllers/movieController.js`)
- User operations → User records: reads and writes (evidence: `backend/controllers/userController.js`)
- Genre operations → Genre records: reads and writes (evidence: `backend/controllers/genreController.js`)
- Access control → User records: loads user (evidence: `backend/middlewares/authMiddleware.js`)
- Movie records → MongoDB: persists records
- User records → MongoDB: persists records
- Genre records → MongoDB: persists records
