# pranavreja/harmonize architecture

> Architecture diagram of the GitHub repository pranavreja/harmonize, 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/pranavreja/harmonize
- Repository: https://github.com/pranavreja/harmonize

## Overview

##### Project type and purpose
- This is a front-end single-page React application scaffolded with Vite.
- Its primary goal is to provide a minimal dev setup with HMR (Hot Module Replacement) and ESLint support.

##### File structure
- Top-level:
- package.json / package-lock.json (dependencies and scripts)
- index.html (app shell)
- vite.config.js (Vite configuration)
- eslint.config.js (lint rules)
- public/: static assets (favicon, manifest, etc.)
- src/: application source
- main.jsx (React entry point that mounts <App />)
- App.jsx / App.css (root component + styles)
- components/: reusable UI pieces (TopBar.jsx)
- assets/ and styles.css (images, fonts, global CSS)

##### README
- Confirms use of @vitejs/plugin-react or plugin-react-swc for fast refresh
- Recommends optional TypeScript/TS-ESLint setup for production

##### Main components
a. Developer workstation
– VS Code (or IDE) editing files in src/, public/, config files
– ESLint plug-in performing on-the-fly lint checks
b. Vite Dev Server
– Serves index.html and bundles modules on demand
– Runs plugin-react (Babel) or plugin-react-swc (SWC) for HMR
c. Browser (Client)
– Fetches index.html → loads the bundled React app
– Receives HMR updates via WebSocket
d. React Application
– main.jsx bootstraps ReactDOM into the DOM
– App.jsx orchestrates child components (e.g., TopBar)
– CSS modules and global styles applied
e. Build Pipeline (Production)
– Vite’s rollup under the hood
– Transpile & bundle JS/JSX
– Minify CSS, optimize assets from public/
– Outputs to dist/ for deployment

##### Relationships & interactions
- Developer edits code → Vite watches files → on change:
- ESLint lint check → Vite recompiles only changed modules → HMR socket pushes updates → Browser replaces modules in real time
- On “npm run build”: Vite runs production bundling → deployable artifacts written to dist/ → served by any static host or CDN

##### Architectural patterns & principles
- Modular component hierarchy (React)
- Dev/Prod pipeline separation (fast dev feedback vs. optimized bundles)
- Plugin architecture (Vite plugins for React, optional SWC/Babel)
- Zero-config approach, convention over configuration

##### Technologies & frameworks
- Vite (dev server + build tool)
- React (UI library)
- @vitejs/plugin-react or plugin-react-swc (HMR support)
- ESLint (static code analysis)
- PostCSS (via Vite for CSS processing)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Workstation
    subgraph "Developer Workstation"
        IDE["VS Code / IDE"]:::dev
        ESLINT["ESLint Plugin"]:::dev
    end

    %% Vite Dev Server & HMR
    subgraph "Vite Dev Server & HMR"
        VITE["Vite Dev Server"]:::dev
        PLUGINS["plugin-react<br/>plugin-react-swc"]:::dev
    end

    %% Browser (Client)
    subgraph "Browser (Client)"
        HTML["index.html"]:::runtime
        BUNDLE["Bundled JS/CSS"]:::runtime
        HMRWS["HMR WebSocket"]:::runtime
        ReactApp["React App"]:::runtime
    end

    %% Build Pipeline (Production)
    subgraph "Build Pipeline (Production)"
        ROLLUP["Rollup Bundler"]:::build
        DIST["dist/"]:::build
        HOST["Static Host / CDN"]:::external
    end

    %% Project Files & Assets
    subgraph "Project Files & Assets"
        PKG["package.json<br/>package-lock.json"]:::dev
        VITECFG["vite.config.js"]:::dev
        ESLINTCFG["eslint.config.js"]:::dev
        INDEX["index.html"]:::dev
        PUBLIC["public/"]:::dev
        MAIN["src/main.jsx"]:::dev
        APP["src/App.jsx"]:::dev
        APPCSS["src/App.css"]:::dev
        INDEXCSS["src/index.css"]:::dev
        STYLES["src/styles.css"]:::dev
        TB["src/components/TopBar.jsx"]:::dev
        ASSETS["src/assets"]:::dev
    end

    %% Relationships
    IDE -->|edits code| PKG
    IDE -->|edits code| VITECFG
    IDE -->|edits code| ESLINTCFG
    IDE -->|edits code| INDEX
    IDE -->|edits code| PUBLIC
    IDE -->|edits code| MAIN
    IDE -->|edits code| APP
    IDE -->|edits code| APPCSS
    IDE -->|edits code| INDEXCSS
    IDE -->|edits code| STYLES
    IDE -->|edits code| TB
    IDE -->|edits code| ASSETS

    IDE --> ESLINT
    ESLINTCFG --> ESLINT

    PKG -->|configures| VITE
    VITECFG --> VITE
    PUBLIC --> VITE
    INDEX --> VITE
    MAIN --> VITE
    ASSETS --> VITE

    VITE --> PLUGINS
    PLUGINS --> VITE

    VITE -->|serves| HTML
    HTML -->|loads| BUNDLE
    BUNDLE --> ReactApp
    VITE -->|pushes updates| HMRWS
    HMRWS --> ReactApp

    PKG -->|npm run build| ROLLUP
    VITECFG --> ROLLUP
    PUBLIC --> ROLLUP
    ASSETS --> ROLLUP
    ROLLUP --> DIST
    DIST --> HOST

    %% Click Events
    click VITECFG "https://github.com/pranavreja/harmonize/blob/main/vite.config.js"
    click ESLINTCFG "https://github.com/pranavreja/harmonize/blob/main/eslint.config.js"
    click INDEX "https://github.com/pranavreja/harmonize/blob/main/index.html"
    click PKG "https://github.com/pranavreja/harmonize/blob/main/package.json"
    click PKG "https://github.com/pranavreja/harmonize/blob/main/package-lock.json"
    click PUBLIC "https://github.com/pranavreja/harmonize/tree/main/public/"
    click MAIN "https://github.com/pranavreja/harmonize/blob/main/src/main.jsx"
    click APP "https://github.com/pranavreja/harmonize/blob/main/src/App.jsx"
    click APPCSS "https://github.com/pranavreja/harmonize/blob/main/src/App.css"
    click INDEXCSS "https://github.com/pranavreja/harmonize/blob/main/src/index.css"
    click STYLES "https://github.com/pranavreja/harmonize/blob/main/src/styles.css"
    click TB "https://github.com/pranavreja/harmonize/blob/main/src/components/TopBar.jsx"
    click ASSETS "https://github.com/pranavreja/harmonize/tree/main/src/assets"

    %% Styles
    classDef dev fill:#cce5ff,stroke:#2a6f97,color:#000
    classDef build fill:#d4edda,stroke:#2a7f2a,color:#000
    classDef runtime fill:#ffe5b4,stroke:#a65e00,color:#000
    classDef external fill:#f0f0f0,stroke:#999,color:#000
```
