# aman83verma/youtube-clone architecture

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

- Interactive diagram: https://gitdiagram.com/aman83verma/youtube-clone
- Repository: https://github.com/aman83verma/youtube-clone

## Overview

This React application lets viewers browse trending or category-filtered videos, search, open a video, and explore its channel. Home browsing uses a paginated fetch hook; search and detail pages use the YouTube API service, then render video cards, player details, related videos, or channel information. Shared context manages UI preferences and recent searches. The README documents additional responsive UI and sharing capabilities. Some page and API source was only sampled, so links for those documented or indexed features are limited to the evidence available.

Main entry points: [`src/pages/Home.jsx`](https://github.com/aman83verma/youtube-clone/blob/main/src/pages/Home.jsx) (Home browse), [`src/pages/VideoPlayer.jsx`](https://github.com/aman83verma/youtube-clone/blob/main/src/pages/VideoPlayer.jsx) (Video page), [`src/services/youtubeApi.js`](https://github.com/aman83verma/youtube-clone/blob/main/src/services/youtubeApi.js) (YouTube API service), [`src/App.jsx`](https://github.com/aman83verma/youtube-clone/blob/main/src/App.jsx) (App router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App navigation"]
  node_app["App router<br/>[App.jsx]"]
  node_navbar["Navbar and search<br/>[Navbar.jsx]"]
end

subgraph group_discovery["Video discovery"]
  node_searchbar["Search input<br/>[SearchBar.jsx]"]
  node_home["Home browse<br/>[Home.jsx]"]
  node_categories["Category filters<br/>[CategoryList.jsx]"]
  node_videohook["Paginated video hook<br/>[useFetchVideos.js]"]
  node_searchresults["Search results<br/>[SearchResults.jsx]"]
  node_videocard["Video card<br/>[VideoCard.jsx]"]
  node_shortscard["Shorts card<br/>[ShortsCard.jsx]"]
end

subgraph group_viewing["Video and channel"]
  node_player["Video page<br/>[VideoPlayer.jsx]"]
  node_related["Related videos<br/>[RelatedVideos.jsx]"]
  node_share["Share modal<br/>[ShareModal.jsx]"]
  node_channel["Channel page<br/>[ChannelPage.jsx]"]
end

subgraph group_state["Shared state and API"]
  node_context["App context<br/>[AppContext.jsx]"]
  node_api["YouTube API service<br/>[youtubeApi.js]"]
  node_helpers["Formatting and UI helpers<br/>[helpers.js]"]
end

node_viewer(("Viewer"))
node_youtube{{"YouTube Data API"}}
node_browserstorage[("Browser local storage")]

node_viewer -->|"opens app"| node_app
node_app -->|"routes home"| node_home
node_app -->|"routes video"| node_player
node_app -->|"routes search"| node_searchresults
node_app -->|"routes channel"| node_channel
node_viewer -->|"uses navigation"| node_navbar
node_navbar -->|"renders"| node_searchbar
node_searchbar -->|"fetches suggestions"| node_api
node_searchbar -->|"navigates to"| node_searchresults
node_home -->|"renders"| node_categories
node_home -->|"loads videos"| node_videohook
node_videohook -->|"requests pages"| node_api
node_home -->|"renders videos"| node_videocard
node_home -->|"renders shorts"| node_shortscard
node_searchresults -->|"searches videos"| node_api
node_searchresults -->|"renders results"| node_videocard
node_videocard -->|"links to video"| node_player
node_player -->|"fetches details"| node_api
node_player -->|"renders recommendations"| node_related
node_player -->|"opens sharing"| node_share
node_player -->|"links to channel"| node_channel
node_channel -->|"loads channel data"| node_api
node_channel -->|"renders uploads"| node_videocard
node_api -->|"sends API requests"| node_youtube
node_home -->|"reads category"| node_context
node_searchresults -->|"records searches"| node_context
node_context -->|"persists preferences"| node_browserstorage
node_videocard -->|"formats metadata"| node_helpers

click node_app "https://github.com/aman83verma/youtube-clone/blob/main/src/App.jsx"
click node_navbar "https://github.com/aman83verma/youtube-clone/blob/main/src/components/Navbar.jsx"
click node_searchbar "https://github.com/aman83verma/youtube-clone/blob/main/src/components/SearchBar.jsx"
click node_home "https://github.com/aman83verma/youtube-clone/blob/main/src/pages/Home.jsx"
click node_categories "https://github.com/aman83verma/youtube-clone/blob/main/src/components/CategoryList.jsx"
click node_videohook "https://github.com/aman83verma/youtube-clone/blob/main/src/hooks/useFetchVideos.js"
click node_searchresults "https://github.com/aman83verma/youtube-clone/blob/main/src/pages/SearchResults.jsx"
click node_videocard "https://github.com/aman83verma/youtube-clone/blob/main/src/components/VideoCard.jsx"
click node_shortscard "https://github.com/aman83verma/youtube-clone/blob/main/src/components/ShortsCard.jsx"
click node_player "https://github.com/aman83verma/youtube-clone/blob/main/src/pages/VideoPlayer.jsx"
click node_related "https://github.com/aman83verma/youtube-clone/blob/main/src/components/RelatedVideos.jsx"
click node_share "https://github.com/aman83verma/youtube-clone/blob/main/src/components/ShareModal.jsx"
click node_channel "https://github.com/aman83verma/youtube-clone/blob/main/src/pages/ChannelPage.jsx"
click node_context "https://github.com/aman83verma/youtube-clone/blob/main/src/context/AppContext.jsx"
click node_api "https://github.com/aman83verma/youtube-clone/blob/main/src/services/youtubeApi.js"
click node_helpers "https://github.com/aman83verma/youtube-clone/blob/main/src/utils/helpers.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_app,node_navbar,node_viewer toneBlue
class node_searchbar,node_home,node_categories,node_videohook,node_searchresults,node_videocard,node_shortscard,node_browserstorage toneAmber
class node_player,node_related,node_share,node_channel,node_youtube toneMint
class node_context,node_api,node_helpers toneRose
```

## Components

### App navigation

- [App router](https://github.com/aman83verma/youtube-clone/blob/main/src/App.jsx): `src/App.jsx`
- [Navbar and search](https://github.com/aman83verma/youtube-clone/blob/main/src/components/Navbar.jsx): `src/components/Navbar.jsx`

### Video discovery

- [Search input](https://github.com/aman83verma/youtube-clone/blob/main/src/components/SearchBar.jsx): `src/components/SearchBar.jsx`
- [Home browse](https://github.com/aman83verma/youtube-clone/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Category filters](https://github.com/aman83verma/youtube-clone/blob/main/src/components/CategoryList.jsx): `src/components/CategoryList.jsx`
- [Paginated video hook](https://github.com/aman83verma/youtube-clone/blob/main/src/hooks/useFetchVideos.js): `src/hooks/useFetchVideos.js`
- [Search results](https://github.com/aman83verma/youtube-clone/blob/main/src/pages/SearchResults.jsx): `src/pages/SearchResults.jsx`
- [Video card](https://github.com/aman83verma/youtube-clone/blob/main/src/components/VideoCard.jsx): `src/components/VideoCard.jsx`
- [Shorts card](https://github.com/aman83verma/youtube-clone/blob/main/src/components/ShortsCard.jsx): `src/components/ShortsCard.jsx`

### Video and channel

- [Video page](https://github.com/aman83verma/youtube-clone/blob/main/src/pages/VideoPlayer.jsx): `src/pages/VideoPlayer.jsx`
- [Related videos](https://github.com/aman83verma/youtube-clone/blob/main/src/components/RelatedVideos.jsx): `src/components/RelatedVideos.jsx`
- [Share modal](https://github.com/aman83verma/youtube-clone/blob/main/src/components/ShareModal.jsx): `src/components/ShareModal.jsx`
- [Channel page](https://github.com/aman83verma/youtube-clone/blob/main/src/pages/ChannelPage.jsx): `src/pages/ChannelPage.jsx`

### Shared state and API

- [App context](https://github.com/aman83verma/youtube-clone/blob/main/src/context/AppContext.jsx): `src/context/AppContext.jsx`
- [YouTube API service](https://github.com/aman83verma/youtube-clone/blob/main/src/services/youtubeApi.js): `src/services/youtubeApi.js`
- [Formatting and UI helpers](https://github.com/aman83verma/youtube-clone/blob/main/src/utils/helpers.js): `src/utils/helpers.js`

### Other components

- **Viewer**
- **YouTube Data API**
- **Browser local storage**

## Connections

- Viewer → App router: opens app (evidence: `README.md`)
- App router → Home browse: routes home (evidence: `src/App.jsx`)
- App router → Video page: routes video (evidence: `src/App.jsx`)
- App router → Search results: routes search (evidence: `src/App.jsx`)
- App router → Channel page: routes channel (evidence: `src/App.jsx`)
- Viewer → Navbar and search: uses navigation (evidence: `README.md`)
- Navbar and search → Search input: renders (evidence: `src/components/Navbar.jsx`)
- Search input → YouTube API service: fetches suggestions (evidence: `src/components/SearchBar.jsx`)
- Search input → Search results: navigates to (evidence: `README.md`)
- Home browse → Category filters: renders (evidence: `src/pages/Home.jsx`)
- Home browse → Paginated video hook: loads videos (evidence: `src/pages/Home.jsx`)
- Paginated video hook → YouTube API service: requests pages (evidence: `src/hooks/useFetchVideos.js`)
- Home browse → Video card: renders videos (evidence: `src/pages/Home.jsx`)
- Home browse → Shorts card: renders shorts (evidence: `src/pages/Home.jsx`)
- Search results → YouTube API service: searches videos (evidence: `src/pages/SearchResults.jsx`)
- Search results → Video card: renders results (evidence: `src/pages/SearchResults.jsx`)
- Video card → Video page: links to video (evidence: `src/components/VideoCard.jsx`)
- Video page → YouTube API service: fetches details (evidence: `src/pages/VideoPlayer.jsx`)
- Video page → Related videos: renders recommendations (evidence: `src/pages/VideoPlayer.jsx`)
- Video page → Share modal: opens sharing (evidence: `README.md`)
- Video page → Channel page: links to channel (evidence: `src/pages/VideoPlayer.jsx`)
- Channel page → YouTube API service: loads channel data (evidence: `src/pages/ChannelPage.jsx`)
- Channel page → Video card: renders uploads (evidence: `src/pages/ChannelPage.jsx`)
- YouTube API service → YouTube Data API: sends API requests (evidence: `src/services/youtubeApi.js`)
- Home browse → App context: reads category (evidence: `src/pages/Home.jsx`)
- Search results → App context: records searches (evidence: `src/pages/SearchResults.jsx`)
- App context → Browser local storage: persists preferences (evidence: `src/context/AppContext.jsx`)
- Video card → Formatting and UI helpers: formats metadata (evidence: `src/components/VideoCard.jsx`)
