# radha756/nova-ai architecture

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

- Interactive diagram: https://gitdiagram.com/radha756/nova-ai
- Repository: https://github.com/radha756/nova-ai

## Overview

##### Project type and purpose
- This is a front-end single-page application (SPA) built with React and bundled via Vite.
- Its purpose is to provide a minimal React setup with HMR (Hot Module Replacement) and ESLint rules, ready for extension into a production app.

##### File structure
- Top-level “public” folder: static assets (e.g., index.html, favicon) served as-is.
- “src” folder: all application code
- src/main.jsx – React entry point that mounts the App component
- src/App.jsx – top-level React component
- src/components/Main – feature component with its own CSS
- src/context – React Context provider for global state
- src/config/gemini.js – external-service or API configuration
- src/assets – JS module exporting static asset references
- src/index.css – global CSS
- Config and tooling at root:
- vite.config.js – Vite bundler settings and plugin setup
- eslint.config.js – linting rules
- package.json / package-lock.json – dependencies and scripts
- .env – environment variables

##### README
- Confirms use of @vitejs/plugin-react (Babel) or plugin-react-swc (SWC) for fast refresh.
- Recommends TypeScript as an extension, not used here.

##### Main components and interactions
a. Components:
- Developer Environment (VS Code, terminal)
- Vite Dev Server (with HMR plugin)
- Browser / User’s Client
- React Application Code (src/) subdivided into
– Entry Point (main.jsx)
– App Component (App.jsx)
– Feature Components (components/Main)
– Global State (context/context.jsx)
– Configuration Module (config/gemini.js)
– Asset Module (assets/assets.js)
- Public Static Assets (public/index.html, images, etc.)
b. Relationships and Data Flows:
1. Developer triggers “npm run dev” → Vite Dev Server reads vite.config.js
2. Vite watches src/, applies React plugin (Babel or SWC), bundles modules in memory
3. Browser requests index.html → Vite serves it, injects HMR client script
4. Browser loads bundled JS:
– main.jsx mounts App into the DOM
– App uses Context to provide/consume global state
– Components import config/gemini for API endpoints
– Components import assets from assets.js
5. Any code change → Vite recompiles affected modules & pushes HMR update to Browser
c. Architectural patterns and design principles:
– SPA pattern
– Module-based component hierarchy
– Separation of concerns: UI (components), state (context), config (gemini), assets
– Pluggable build pipeline (Vite + React plugin)
d. Key technologies and libraries:
– React (JSX, hooks, context)
– Vite (bundler, dev server, HMR)
– @vitejs/plugin-react or @vitejs/plugin-react-swc
– ESLint (via eslint.config.js)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer Environment
    subgraph "Developer Environment"
        DEV["VS Code / Terminal"]:::dev
    end

    %% Build & Dev Server
    subgraph "Build & Dev Server"
        VITE["Vite Dev Server\n(vite.config.js)"]:::tool
        ESLINT["ESLint\n(eslint.config.js)"]:::tool
        ENV[".env"]:::config
        PKG1["package.json"]:::config
        PKG2["package-lock.json"]:::config
        PUBLIC["public/"]:::static
    end

    %% Browser Runtime
    subgraph "Browser"
        HTML["index.html"]:::static
        HMR["HMR Client Script"]:::tool
        subgraph "Application Bundle"
            MAIN_ENTRY["src/main.jsx"]:::front
            APP["src/App.jsx"]:::front
            subgraph "Feature Component"
                MAINCOMP["src/components/Main/Main.jsx"]:::front
                MAINCSS["src/components/Main/Main.css"]:::front
            end
            CONTEXT["src/context/context.jsx"]:::config
            GEMINI["src/config/gemini.js"]:::config
            ASSETS["src/assets/assets.js"]:::static
            GLOBALCSS["src/index.css"]:::static
        end
    end

    %% Flows
    DEV -->|"1. npm run dev"| VITE
    VITE -->|"2. serves index.html + inject HMR"| HTML
    HTML --> HMR
    HMR -->|"4. HMR update requests"| VITE
    HTML -->|"3. load bundle"| MAIN_ENTRY
    MAIN_ENTRY -->|"mounts"| APP
    APP -->|"renders"| MAINCOMP
    MAINCOMP -->|"uses styles"| MAINCSS
    APP -->|"provides/consumes"| CONTEXT
    MAINCOMP -->|"imports config"| GEMINI
    MAINCOMP -->|"imports assets"| ASSETS
    MAIN_ENTRY -->|"loads global styles"| GLOBALCSS
    VITE --> PUBLIC

    %% Click Events
    click MAIN_ENTRY "https://github.com/radha756/nova-ai/blob/main/src/main.jsx"
    click APP "https://github.com/radha756/nova-ai/blob/main/src/App.jsx"
    click MAINCOMP "https://github.com/radha756/nova-ai/blob/main/src/components/Main/Main.jsx"
    click MAINCSS "https://github.com/radha756/nova-ai/blob/main/src/components/Main/Main.css"
    click CONTEXT "https://github.com/radha756/nova-ai/blob/main/src/context/context.jsx"
    click GEMINI "https://github.com/radha756/nova-ai/blob/main/src/config/gemini.js"
    click ASSETS "https://github.com/radha756/nova-ai/blob/main/src/assets/assets.js"
    click GLOBALCSS "https://github.com/radha756/nova-ai/blob/main/src/index.css"
    click HTML "https://github.com/radha756/nova-ai/blob/main/index.html"
    click PUBLIC "https://github.com/radha756/nova-ai/tree/main/public/"
    click VITE "https://github.com/radha756/nova-ai/blob/main/vite.config.js"
    click ESLINT "https://github.com/radha756/nova-ai/blob/main/eslint.config.js"
    click ENV "https://github.com/radha756/nova-ai/blob/main/.env"
    click PKG1 "https://github.com/radha756/nova-ai/blob/main/package.json"
    click PKG2 "https://github.com/radha756/nova-ai/blob/main/package-lock.json"

    %% Styles
    classDef front fill:#cce5ff,stroke:#004085,color:#004085
    classDef config fill:#d4edda,stroke:#155724,color:#155724
    classDef static fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef tool fill:#fff3cd,stroke:#856404,color:#856404
    classDef dev   fill:#f8d7da,stroke:#721c24,color:#721c24
```
