# divesh-kumar-chordia/youtube-clone architecture

> Architecture diagram of the GitHub repository divesh-kumar-chordia/youtube-clone, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/divesh-kumar-chordia/youtube-clone
- Repository: https://github.com/divesh-kumar-chordia/youtube-clone

## Overview

This MERN YouTube clone supports account access, video browsing and playback, video management, and comments. The main user journey runs through the React app to routed server endpoints and MongoDB-backed controllers. The README also describes video-file storage through Firebase, but the sampled source does not show the upload implementation or frontend API calls; those links are therefore marked unverified or omitted.

Main entry points: [`front-end-client/src/App.js`](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/App.js) (App routing), [`back-end-server/index.js`](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/index.js) (API server), [`back-end-server/models/User.js`](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/models/User.js) (User records), [`front-end-client/src/pages/Video.jsx`](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/pages/Video.jsx) (Video playback)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_app["App routing<br/>[App.js]"]
  node_navigation["Navigation menu<br/>[Menu.jsx]"]
  node_home["Video browsing<br/>[Home.jsx]"]
  node_video_page["Video playback<br/>[Video.jsx]"]
  node_video_cards["Video cards<br/>[Card.jsx]"]
  node_signin["Sign-in UI<br/>[SignIn.jsx]"]
  node_comments_ui["Comment display<br/>[Comments.jsx]"]
  node_comment_item["Comment item<br/>[Comment.jsx]"]
end

subgraph group_server["Express API"]
  node_api_entry["API server<br/>[index.js]"]
end

subgraph group_identity["Accounts and access"]
  node_auth_routes["Auth routes<br/>[auth.js]"]
  node_auth_logic["Signup and sign-in<br/>[auth.js]"]
  node_user_routes["User routes<br/>[users.js]"]
  node_user_logic["User operations<br/>[user.js]"]
  node_token_check["Token verification<br/>[verifyToken.js]"]
  node_user_model[("User records<br/>[User.js]")]
end

subgraph group_media["Video and comments"]
  node_video_routes["Video routes<br/>[videos.js]"]
  node_video_logic["Video operations<br/>[video.js]"]
  node_comment_routes["Comment routes<br/>[comments.js]"]
  node_comment_logic["Comment operations<br/>[comment.js]"]
  node_video_model[("Video records<br/>[Video.js]")]
  node_comment_model[("Comment records<br/>[Comment.js]")]
  node_authoring["Video authoring"]
end

node_viewer(("Viewer"))
node_mongo[("MongoDB")]
node_firebase[("Firebase Storage")]

node_viewer -->|"uses"| node_app
node_app -->|"renders"| node_navigation
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_video_page
node_app -->|"routes to"| node_signin
node_home -->|"renders"| node_video_cards
node_video_page -->|"renders"| node_comments_ui
node_video_page -->|"renders"| node_video_cards
node_comments_ui -->|"renders"| node_comment_item
node_api_entry -->|"mounts"| node_auth_routes
node_api_entry -->|"mounts"| node_user_routes
node_api_entry -->|"mounts"| node_video_routes
node_api_entry -->|"mounts"| node_comment_routes
node_auth_routes -->|"dispatches"| node_auth_logic
node_auth_logic -->|"reads and writes"| node_user_model
node_user_routes -->|"dispatches"| node_user_logic
node_user_routes -->|"guards"| node_token_check
node_user_logic -->|"accesses"| node_user_model
node_video_routes -->|"dispatches"| node_video_logic
node_video_routes -->|"guards"| node_token_check
node_video_logic -->|"reads and writes"| node_video_model
node_video_logic -->|"reads"| node_user_model
node_comment_routes -->|"dispatches"| node_comment_logic
node_api_entry -->|"connects"| node_mongo
node_video_model -->|"stores records"| node_mongo
node_user_model -->|"stores records"| node_mongo
node_comment_model -->|"stores records"| node_mongo
node_viewer -->|"creates videos"| node_authoring
node_authoring -.->|"stores media"| node_firebase
node_app -.->|"uses API"| node_api_entry

click node_app "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/App.js"
click node_navigation "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/components/Menu.jsx"
click node_home "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/pages/Home.jsx"
click node_video_page "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/pages/Video.jsx"
click node_video_cards "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/components/Card.jsx"
click node_signin "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/pages/SignIn.jsx"
click node_comments_ui "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/components/Comments.jsx"
click node_comment_item "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/components/Comment.jsx"
click node_api_entry "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/index.js"
click node_auth_routes "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/routes/auth.js"
click node_auth_logic "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/controllers/auth.js"
click node_user_routes "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/routes/users.js"
click node_user_logic "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/controllers/user.js"
click node_token_check "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/verifyToken.js"
click node_video_routes "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/routes/videos.js"
click node_video_logic "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/controllers/video.js"
click node_comment_routes "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/routes/comments.js"
click node_comment_logic "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/controllers/comment.js"
click node_video_model "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/models/Video.js"
click node_user_model "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/models/User.js"
click node_comment_model "https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/models/Comment.js"
click node_authoring "https://github.com/divesh-kumar-chordia/youtube-clone/tree/master/front-end-client/src/pages"

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,node_navigation,node_home,node_video_page,node_video_cards,node_signin,node_comments_ui,node_comment_item,node_viewer toneBlue
class node_api_entry,node_mongo,node_firebase toneAmber
class node_auth_routes,node_auth_logic,node_user_routes,node_user_logic,node_token_check,node_user_model toneMint
class node_video_routes,node_video_logic,node_comment_routes,node_comment_logic,node_video_model,node_comment_model,node_authoring toneRose
```

## Components

### React client

- [App routing](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/App.js): `front-end-client/src/App.js`
- [Navigation menu](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/components/Menu.jsx): `front-end-client/src/components/Menu.jsx`
- [Video browsing](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/pages/Home.jsx): `front-end-client/src/pages/Home.jsx`
- [Video playback](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/pages/Video.jsx): `front-end-client/src/pages/Video.jsx`
- [Video cards](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/components/Card.jsx): `front-end-client/src/components/Card.jsx`
- [Sign-in UI](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/pages/SignIn.jsx): `front-end-client/src/pages/SignIn.jsx`
- [Comment display](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/components/Comments.jsx): `front-end-client/src/components/Comments.jsx`
- [Comment item](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/front-end-client/src/components/Comment.jsx): `front-end-client/src/components/Comment.jsx`

### Express API

- [API server](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/index.js): `back-end-server/index.js`

### Accounts and access

- [Auth routes](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/routes/auth.js): `back-end-server/routes/auth.js`
- [Signup and sign-in](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/controllers/auth.js): `back-end-server/controllers/auth.js`
- [User routes](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/routes/users.js): `back-end-server/routes/users.js`
- [User operations](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/controllers/user.js): `back-end-server/controllers/user.js`
- [Token verification](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/verifyToken.js): `back-end-server/verifyToken.js`
- [User records](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/models/User.js): `back-end-server/models/User.js`

### Video and comments

- [Video routes](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/routes/videos.js): `back-end-server/routes/videos.js`
- [Video operations](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/controllers/video.js): `back-end-server/controllers/video.js`
- [Comment routes](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/routes/comments.js): `back-end-server/routes/comments.js`
- [Comment operations](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/controllers/comment.js): `back-end-server/controllers/comment.js`
- [Video records](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/models/Video.js): `back-end-server/models/Video.js`
- [Comment records](https://github.com/divesh-kumar-chordia/youtube-clone/blob/master/back-end-server/models/Comment.js): `back-end-server/models/Comment.js`
- [Video authoring](https://github.com/divesh-kumar-chordia/youtube-clone/tree/master/front-end-client/src/pages): `front-end-client/src/pages`

### Other components

- **Viewer**
- **MongoDB**
- **Firebase Storage**

## Connections

- Viewer → App routing: uses (evidence: `front-end-client/src/App.js`)
- App routing → Navigation menu: renders (evidence: `front-end-client/src/App.js`)
- App routing → Video browsing: routes to (evidence: `front-end-client/src/App.js`)
- App routing → Video playback: routes to (evidence: `front-end-client/src/App.js`)
- App routing → Sign-in UI: routes to (evidence: `front-end-client/src/App.js`)
- Video browsing → Video cards: renders (evidence: `front-end-client/src/pages/Home.jsx`)
- Video playback → Comment display: renders (evidence: `front-end-client/src/pages/Video.jsx`)
- Video playback → Video cards: renders (evidence: `front-end-client/src/pages/Video.jsx`)
- Comment display → Comment item: renders (evidence: `front-end-client/src/components/Comments.jsx`)
- API server → Auth routes: mounts (evidence: `back-end-server/index.js`)
- API server → User routes: mounts (evidence: `back-end-server/index.js`)
- API server → Video routes: mounts (evidence: `back-end-server/index.js`)
- API server → Comment routes: mounts (evidence: `back-end-server/index.js`)
- Auth routes → Signup and sign-in: dispatches (evidence: `back-end-server/routes/auth.js`)
- Signup and sign-in → User records: reads and writes (evidence: `back-end-server/controllers/auth.js`)
- User routes → User operations: dispatches (evidence: `back-end-server/routes/users.js`)
- User routes → Token verification: guards (evidence: `back-end-server/routes/users.js`)
- User operations → User records: accesses (evidence: `back-end-server/controllers/user.js`)
- Video routes → Video operations: dispatches (evidence: `back-end-server/routes/videos.js`)
- Video routes → Token verification: guards (evidence: `back-end-server/routes/videos.js`)
- Video operations → Video records: reads and writes (evidence: `back-end-server/controllers/video.js`)
- Video operations → User records: reads (evidence: `back-end-server/controllers/video.js`)
- Comment routes → Comment operations: dispatches (evidence: `back-end-server/routes/comments.js`)
- API server → MongoDB: connects (evidence: `back-end-server/index.js`)
- Video records → MongoDB: stores records (evidence: `back-end-server/models/Video.js`)
- User records → MongoDB: stores records (evidence: `back-end-server/models/User.js`)
- Comment records → MongoDB: stores records (evidence: `back-end-server/models/Comment.js`)
- Viewer → Video authoring: creates videos (evidence: `README.md`)
- Video authoring → Firebase Storage: stores media (evidence: `README.md`)
- App routing → API server: uses API
