# mesaaransh/portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/mesaaransh/portfolio
- Repository: https://github.com/mesaaransh/portfolio

## Overview

##### Project type and purpose
- This is a **front-end React SPA** built with **Vite**.
- Purpose: a personal/portfolio website comprised of sections (About, Banner, Projects, etc.) and reusable UI components.

##### File structure
- Top-level folders:
- `public/` holds static assets & redirect rules.
- `src/` contains React “pages” (About, Contact, etc.), shared `Components/`, assets, and the entry point (`main.jsx`).
- `dist/` is the production output after running `vite build`.
- `vite.config.js` + `package.json` + `eslint.config.js` configure the build toolchain.
- Patterns:
- **Component-based** architecture (each UI slice in its own directory).
- **Asset segregation** (per-component and shared).
- **Build pipeline** driven by Vite and React plugins.

##### Extract insights from the README
- Uses `@vitejs/plugin-react` (Babel) or `@vitejs/plugin-react-swc` (SWC) for Fast Refresh / HMR.
- Minimal template—no backend or routing library is explicitly included.

##### Main components
a. **Developer Workstation**
– Node.js & npm/yarn
– Source code (`src/`, `public/`)
– ESLint config
b. **Vite Dev Server** (npm script: `vite`)
– Reads `vite.config.js`
– Applies React plugin (Babel or SWC)
– Provides HMR via WebSocket
c. **Browser (Dev Mode)**
– Loads `http://localhost:3000`
– Receives JS/CSS modules over HMR
– Renders React component tree
d. **Vite Build Pipeline** (npm script: `vite build`)
– Bundles modules
– Generates hashed assets in `dist/assets/`
– Outputs `dist/index.html` + static files
e. **Static Hosting / CDN**
– Serves `dist/` contents
– Applies `_redirects` if deployed on Netlify or similar

##### Relationships & interactions
- **Developer → Vite Dev Server**: edits code → Vite watches files → triggers HMR over WebSocket
- **Vite Dev Server → Browser**: pushes updates (JS/CSS), browser reload patch
- **Build Pipeline → dist/**: transforms code → bundles → outputs static files
- **Static Host → End-User**: delivers HTML/CSS/JS + assets

##### Architectural patterns & design principles
- **Component-based UI** (each section is a standalone React component)
- **Modular asset management** (component-scoped CSS, per-component assets)
- **Fast Refresh / HMR** for rapid development
- **Static site deployment** (no server-side rendering, purely client-side)

##### Key technologies/frameworks
- **React** (JSX, component tree)
- **Vite** (dev server + bundler)
- **@vitejs/plugin-react** or **@vitejs/plugin-react-swc**
- **Babel** or **SWC** for transpilation
- **ESLint** for code quality
- **Node.js/npm** as the runtime & package manager

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Workstation
    subgraph "Developer Workstation"
        direction TB
        SC["Source Code (src/)"]:::devTool
        PA["Static Assets (public/)"]:::devTool
        ESL["ESLint Config (eslint.config.js)"]:::devTool
        PM["Package Manifest (package.json & package-lock.json)"]:::devTool
    end

    %% Vite Dev Server
    subgraph "Vite Dev Server" 
        direction TB
        VC["Config (vite.config.js)"]:::devTool
        IE["Dev Entrypoint (index.html)"]:::devTool
        RP["React Plugin (@vitejs/plugin-react)"]:::devTool
    end

    %% Browser Dev Mode
    subgraph "Browser (Dev Mode)" 
        direction TB
        MX["Module Loader (src/main.jsx)"]:::runtime
        subgraph "React Component Tree"
            direction TB
            APP["App.jsx"]:::component
            NAV["Navbar"]:::component
            BAN["Banner"]:::component
            ABT["About"]:::component
            PRJ["Projects"]:::component
            SKL["Skills"]:::component
            EDU["Education"]:::component
            CNT["Contact"]:::component
            HERO["Hero"]:::component
            HBTN["Hbutton"]:::component
            SBTN["SigButton"]:::component
        end
    end

    %% Vite Build Pipeline
    BP["Vite Build Pipeline"]:::devTool
    D["dist/ (Build Output)"]:::artifact

    %% Static Hosting
    SH["Static Hosting / CDN"]:::infra
    EU["End User"]:::runtime

    %% Connections
    SC -->|"edits code (watch)"| VC
    PA -->|serves static| VC
    ESL -->|lint rules| SC
    PM -->|scripts & deps| VC

    VC -->|"serves modules via HMR"| IE
    IE -->|"loads entry"| MX
    RP -->|transpile JSX| VC

    IE -->|"WebSocket HMR"| MX
    MX -->|renders component tree| APP
    APP --> NAV
    APP --> BAN
    APP --> ABT
    APP --> PRJ
    APP --> SKL
    APP --> EDU
    APP --> CNT
    APP --> HERO
    APP --> HBTN
    APP --> SBTN

    VC -->|"npm run build"| BP
    BP -->|"bundles assets"| D
    D -->|"deploy contents"| SH
    SH -->|"HTTP GET"| EU

    %% Click Events
    click SC "https://github.com/mesaaransh/portfolio/tree/main/src/"
    click PA "https://github.com/mesaaransh/portfolio/tree/main/public/"
    click ESL "https://github.com/mesaaransh/portfolio/blob/main/eslint.config.js"
    click PM "https://github.com/mesaaransh/portfolio/blob/main/package.json"
    click PM "https://github.com/mesaaransh/portfolio/blob/main/package-lock.json"
    click VC "https://github.com/mesaaransh/portfolio/blob/main/vite.config.js"
    click IE "https://github.com/mesaaransh/portfolio/blob/main/index.html"
    click MX "https://github.com/mesaaransh/portfolio/blob/main/src/main.jsx"
    click APP "https://github.com/mesaaransh/portfolio/blob/main/src/App.jsx"
    click NAV "https://github.com/mesaaransh/portfolio/blob/main/src/Navbar/Navbar.jsx"
    click BAN "https://github.com/mesaaransh/portfolio/blob/main/src/Banner/Banner.jsx"
    click ABT "https://github.com/mesaaransh/portfolio/blob/main/src/About/About.jsx"
    click PRJ "https://github.com/mesaaransh/portfolio/blob/main/src/Projects/Projects.jsx"
    click SKL "https://github.com/mesaaransh/portfolio/blob/main/src/Skills/Skills.jsx"
    click EDU "https://github.com/mesaaransh/portfolio/blob/main/src/Education/Education.jsx"
    click CNT "https://github.com/mesaaransh/portfolio/blob/main/src/Contact/Contact.jsx"
    click HERO "https://github.com/mesaaransh/portfolio/blob/main/src/Hero/Hero.jsx"
    click HBTN "https://github.com/mesaaransh/portfolio/blob/main/src/Components/Hbutton/Hbutton.jsx"
    click SBTN "https://github.com/mesaaransh/portfolio/blob/main/src/Components/SigButton/Sigbutton.jsx"
    click D "https://github.com/mesaaransh/portfolio/tree/main/dist/"
    click D "https://github.com/mesaaransh/portfolio/blob/main/dist/assets/index-*.js"
    click D "https://github.com/mesaaransh/portfolio/blob/main/dist/assets/index-*.css"
    click D "https://github.com/mesaaransh/portfolio/tree/main/dist/_redirects"
    click D "https://github.com/mesaaransh/portfolio/blob/main/dist/index.html"

    %% Styles
    classDef devTool fill:#cce5ff,stroke:#004085,color:#004085
    classDef runtime fill:#d4edda,stroke:#155724,color:#155724
    classDef artifact fill:#fff3cd,stroke:#856404,color:#856404
    classDef infra fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef component fill:#f8d7da,stroke:#721c24,color:#721c24
```
