# karunakarthurlu/githubprofiletracker architecture

> Architecture diagram of the GitHub repository karunakarthurlu/githubprofiletracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/karunakarthurlu/githubprofiletracker
- Repository: https://github.com/karunakarthurlu/githubprofiletracker

## Overview

##### Project type and purpose
- This is a single-page, front-end React application (“GitHub Profile Tracker”) that consumes the public GitHub REST API to display user profiles, repositories, followers, and language analytics.
- It’s built with React.js, styled with Material-UI, bundled with Vite, and deployed (via GitHub Actions) as a static site (GitHub Pages).

##### File structure
- Top-level config/build/deploy:
- vite.config.js (Vite build config)
- .github/workflows/deploy.yml (CI/CD to publish to GitHub Pages)
- package.json / package-lock.json
- Public assets: /public, index.html, 404.html
- Source code under /src:
- /components: reusable UI components (AppHeader, SideMenu, SearchField, ReposTable, UserCard, UserProfile)
- /pages: route-level views (Dashboard, CustomDashboard, Profile, Followers, Following, Repositories)
- /context: global state via React Context & Reducer (UserContext, UserReducer, UserActions, UserState)
- /services: API wrapper (GitHubAPI.js)
- /utils: helper utilities (ChartUtil, Notifier, Spinner, ThemeContext, NotFound, ContextStateUtils)
- entry point main.jsx + root App.jsx + styling (App.css, index.css)

##### README for additional insights
- Confirms key features: profile dashboard, followers page, language breakdown, user-friendly UI.
- Tech stack: React.js front end + GitHub REST API + Material-UI.

##### Key components
a. Browser/Client
– The user’s browser loads the static React SPA from GitHub Pages (CDN).
b. Static Host & CI/CD
– GitHub Actions workflow builds via Vite → publishes files to GitHub Pages.
c. React Application
– Entry Point (index.html → main.jsx → App.jsx)
– Routing layer (pages under /pages)
– UI Components (/components)
– Global State (React Context: UserContext + Reducer + Actions)
– Services Layer (GitHubAPI service for HTTP requests)
– Utilities (ChartUtil for graphs, Spinner/Notifier for UX, ThemeContext)
d. External Service
– GitHub REST API (OAuth or public endpoints)

##### Relationships & data flow
- On load, AppHeader and SideMenu render and the Router selects a page under /pages.
- Pages dispatch actions (via UserActions) to fetch data through GitHubAPI (services).
- GitHubAPI calls → REST API → returns JSON → passes to UserReducer to update UserContext.
- Components (e.g., ReposTable, UserCard, ChartUtil) subscribe to UserContext to render UI.
- Utilities (Spinner, Notifier) show loading or error states.
- ThemeContext wraps the whole tree to provide theming.

##### Architectural patterns & design principles
- Separation of concerns: UI ↔ State ↔ API
- Container/Presentational pattern: pages act as containers, components as presentational units.
- Flux-style state management via Context + Reducer.
- Layered architecture: presentation (components/pages) → service (API) → external API.

## Diagram (Mermaid)

```mermaid
flowchart TB
  %% CI/CD & Build
  subgraph "CI/CD & Build"
    GHActions["GitHub Actions (CI/CD)"]:::ci
    ViteConfig["Vite Config"]:::ci
  end

  %% Static Host
  subgraph "Static Host (GitHub Pages)"
    Index["index.html"]:::ci
    NotFoundPage["404.html"]:::ci
    PublicAssets["public/"]:::ci
  end

  Browser["User's Browser"]:::react

  %% React Application
  subgraph "React Application"
    subgraph "Entry"
      Main["main.jsx"]:::react
      AppComp["App.jsx"]:::react
    end
    subgraph "Routing & Pages"
      Dashboard["Dashboard.jsx"]:::react
      CustomDashboard["CustomDashBoard.jsx"]:::react
      Profile["Profile.jsx"]:::react
      Followers["Followers.jsx"]:::react
      Following["Following.jsx"]:::react
      Repositories["Repositories.jsx"]:::react
    end
    subgraph "Components"
      AppHeader["AppHeader.jsx"]:::react
      SideMenu["SideMenu.jsx"]:::react
      SearchField["SearchField.jsx"]:::react
      UserCard["UserCard.jsx"]:::react
      UserProfile["UserProfile.jsx"]:::react
      ReposTable["ReposTable.jsx"]:::react
    end
    subgraph "Global State"
      UserContext["UserContext.js"]:::react
      UserReducer["UserReducer.js"]:::react
      UserActions["UserActions.js"]:::react
      UserState["UserState.jsx"]:::react
    end
    subgraph "Services"
      GitHubAPI["GitHubAPI.js"]:::react
    end
    subgraph "Utilities"
      ChartUtil["ChartUtil.jsx"]:::react
      ContextUtils["ContextStateUtils.js"]:::react
      ThemeContext["ThemeContext.jsx"]:::react
      Spinner["Spinner.jsx"]:::react
      Notifier["Notifier.jsx"]:::react
      NotFoundUtil["NotFound.jsx"]:::react
    end
  end

  ExternalAPI["GitHub REST API"]:::external

  %% Connections
  GHActions -->|"build & deploy"| Index
  GHActions --> PublicAssets
  ViteConfig --> Index
  ViteConfig --> PublicAssets
  Browser -->|"fetches"| Index
  Browser -->|"fetches"| NotFoundPage
  Browser -->|"fetches"| PublicAssets
  Browser -->|"loads SPA"| Main
  Main -->|"renders"| AppComp
  AppComp -->|"wraps with"| ThemeContext
  AppComp -->|"routes to"| Dashboard
  AppComp -->|"routes to"| CustomDashboard
  AppComp -->|"routes to"| Profile
  AppComp -->|"routes to"| Followers
  AppComp -->|"routes to"| Following
  AppComp -->|"routes to"| Repositories
  Dashboard -->|"dispatches"| UserActions
  CustomDashboard -->|"dispatches"| UserActions
  Profile -->|"dispatches"| UserActions
  Followers -->|"dispatches"| UserActions
  Following -->|"dispatches"| UserActions
  Repositories -->|"dispatches"| UserActions
  UserActions -->|"calls"| GitHubAPI
  GitHubAPI -->|"HTTP request"| ExternalAPI
  ExternalAPI -->|"response"| GitHubAPI
  GitHubAPI -->|"sends data to"| UserReducer
  UserReducer -->|"updates"| UserContext
  UserContext -->|"provides data to"| Dashboard
  UserContext -->|"provides data to"| AppHeader
  UserContext -->|"provides data to"| SideMenu
  UserContext -->|"provides data to"| SearchField
  UserContext -->|"provides data to"| UserCard
  UserContext -->|"provides data to"| UserProfile
  UserContext -->|"provides data to"| ReposTable
  ReposTable -->|"uses"| ChartUtil
  Dashboard -->|"uses"| Spinner
  Dashboard -->|"uses"| Notifier
  AppComp -->|"uses"| NotFoundUtil

  %% Click Events
  click GHActions "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/.github/workflows/deploy.yml"
  click ViteConfig "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/vite.config.js"
  click Index "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/index.html"
  click NotFoundPage "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/404.html"
  click PublicAssets "https://github.com/karunakarthurlu/githubprofiletracker/tree/main/public/"
  click Main "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/main.jsx"
  click AppComp "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/App.jsx"
  click Dashboard "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/pages/Dashboard.jsx"
  click CustomDashboard "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/pages/CustomDashBoard.jsx"
  click Profile "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/pages/Profile.jsx"
  click Followers "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/pages/Followers.jsx"
  click Following "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/pages/Following.jsx"
  click Repositories "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/pages/Repositories.jsx"
  click AppHeader "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/components/AppHeader.jsx"
  click SideMenu "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/components/SideMenu.jsx"
  click SearchField "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/components/SearchField.jsx"
  click UserCard "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/components/UserCard.jsx"
  click UserProfile "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/components/UserProfile.jsx"
  click ReposTable "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/components/ReposTable.jsx"
  click UserContext "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/context/UserContext.js"
  click UserReducer "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/context/UserReducer.js"
  click UserActions "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/context/UserActions.js"
  click UserState "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/context/UserState.jsx"
  click GitHubAPI "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/services/GitHubAPi.js"
  click ChartUtil "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/utils/ChartUtil.jsx"
  click ContextUtils "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/utils/ContextStateUtils.js"
  click ThemeContext "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/utils/ThemeContext.jsx"
  click Spinner "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/utils/Spinner.jsx"
  click Notifier "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/utils/Notifier.jsx"
  click NotFoundUtil "https://github.com/karunakarthurlu/githubprofiletracker/blob/main/src/utils/NotFound.jsx"

  %% Styles
  classDef ci fill:#cce5ff,stroke:#4d90fe,color:#000;
  classDef react fill:#d4edda,stroke:#28a745,color:#000;
  classDef external fill:#fff3cd,stroke:#ffcd3c,color:#000;
```
