# nipuntaneja05/threejs_portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/nipuntaneja05/threejs_portfolio
- Repository: https://github.com/nipuntaneja05/threejs_portfolio

## Overview

##### Project type and purpose
- This is a front-end-only Single Page Application (SPA) built with React and Vite.
- Its primary purpose is to render a 3D-rich portfolio/landing page in the browser, loading interactive models and sections (About, Projects, Experience, etc.) on the client side.

##### File structure
- Top-level files:
- package.json, vite.config.js, postcss.config.js, tailwind.config.js → build & configuration layer
- index.html → SPA entry point
- README.md, .gitignore, .env → meta & environment
- public/ → all static assets served at runtime:
- models/ → .glb/.fbx 3D scenes & animations
- textures/ → video and image textures for projects, desk, etc.
- src/ → application source code:
- main.jsx, App.jsx → React entry & layout
- components/ → reusable UI & 3D components (Cube, Rings, CanvasLoader, Developer, etc.)
- sections/ → page sections (Hero, About, Clients, Experience, Project, Contact, Footer)
- hooks/, constants/ → code organization & utilities
- index.css → Tailwind utilities + global styles

##### README
- Confirms technologies: React + Vite, HMR via @vitejs/plugin-react (Babel) or plugin-react-swc (SWC)

##### Main components
a. Developer environment
– Code editor / IDE
– Local Node.js & NPM/Yarn
– ESLint, Prettier (enforced via eslint.config.js)
b. Build pipeline
– Vite development server (HMR)
– Vite production build (rollup under the hood)
– Plugins: @vitejs/plugin-react or plugin-react-swc, PostCSS, Tailwind CSS
c. Static hosting layer
– CDN or Static file server (Netlify, Vercel, GitHub Pages, S3 + CloudFront)
d. Runtime in the browser
– index.html loads bundled JS + CSS
– React runtime renders App.jsx and sections
– Three.js / react-three-fiber (implicit) loads public/models & public/textures
e. Third-party services (optional)
– Analytics, form-submission endpoint (Contact section), if used

##### Relationships & interactions
- Developer → (npm run dev) → Vite Dev Server → HMR → Browser
- Developer → (npm run build) → Vite Build → Static assets → Deploy → CDN
- Browser → fetch index.html, bundle.js, styles.css → React mounts →
- App.jsx → orchestrates components & sections
- CanvasLoader → loads 3D scene using public/models & textures
- Components respond to user input, scroll, interactions
- (Optional) Browser → API endpoint (Contact form or analytics)

##### Architectural patterns & design principles
- SPA architecture with component-based design (React)
- Separation of concerns:
- src/components for UI, 3D abstractions
- src/sections for page structure
- public/ for static assets
- config files for build, linting, styling
- Build-time tooling isolates development vs. production concerns
- Static hosting ensures CDN delivery of unmodified assets

##### Detail
- Every folder as a component or resource: config files, src folders, public subdirectories
- Do not over-simplify—represent each major piece so stakeholders can see exactly how code flows from developer machines to end-users.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Development Environment
    subgraph "Development Environment"
        IDE["IDE (Code Editor)"]:::devtools
        NODE["Node.js & NPM"]:::devtools
        ESLINT["ESLint & Prettier"]:::devtools
        PKGDEV["package.json"]:::devtools
        CONFIG_ESLINT["eslint.config.js"]:::devtools
    end

    %% Build Pipeline
    subgraph "Build Pipeline"
        VITE_DEV["Vite Dev Server\n(HMR)"]:::pipeline
        VITE_BUILD["Vite Production Build"]:::pipeline
        PLUGIN_REACT["@vitejs/plugin-react / plugin-react-swc"]:::pipeline
        PLUGIN_POSTCSS["PostCSS"]:::pipeline
        PLUGIN_TAILWIND["Tailwind CSS"]:::pipeline
        CONFIG_VITE["vite.config.js"]:::pipeline
        CONFIG_POSTCSS["postcss.config.js"]:::pipeline
        CONFIG_TAILWIND["tailwind.config.js"]:::pipeline
        PKGBUILD["package.json"]:::pipeline
    end

    %% Static Hosting Layer
    subgraph "Static Hosting (CDN / Static Server)"
        CDN["CDN / Static File Server"]:::assets
        PUBLIC_ROOT["public/"]:::assets
        MODELS["public/models/"]:::assets
        TEXTURES["public/textures/"]:::assets
    end

    %% Browser Runtime
    subgraph "Browser Runtime"
        BROWSER["Browser"]:::runtime
        INDEX_HTML["index.html"]:::runtime
        REACT_APP["React App"]:::runtime
        MAIN["src/main.jsx"]:::runtime
        APP["src/App.jsx"]:::runtime
        subgraph "Components (src/components)"
            CanvasLoader["CanvasLoader.jsx"]:::runtime
            Cube["Cube.jsx"]:::runtime
            Rings["Rings.jsx"]:::runtime
            DeveloperComp["Developer.jsx"]:::runtime
            HackerRoom["HackerRoom.jsx"]:::runtime
            DemoComputer["DemoComputer.jsx"]:::runtime
            HeroCamera["HeroCamera.jsx"]:::runtime
            ReactLogo["ReactLogo.jsx"]:::runtime
            Loading["Loading.jsx"]:::runtime
            Alert["Alert.jsx"]:::runtime
            Button["Button.jsx"]:::runtime
            Target["Target.jsx"]:::runtime
        end
        subgraph "Sections (src/sections)"
            HeroSec["Hero.jsx"]:::runtime
            AboutSec["About.jsx"]:::runtime
            ClientsSec["Clients.jsx"]:::runtime
            ExperienceSec["Experience.jsx"]:::runtime
            ProjectSec["Project.jsx"]:::runtime
            ContactSec["Contact.jsx"]:::runtime
            FooterSec["Footer.jsx"]:::runtime
            NavbarSec["Navbar.jsx"]:::runtime
        end
        subgraph "Utilities & Styles"
            Hooks["useAlert.js"]:::runtime
            Constants["index.js"]:::runtime
            GlobalCSS["src/index.css"]:::runtime
        end
    end

    %% Connections
    IDE -->|writes code| NODE
    NODE -->|runs npm scripts| VITE_DEV
    NODE -->|runs npm scripts| VITE_BUILD
    PKGDEV -->|defines scripts & deps| VITE_DEV
    PKGBUILD -->|defines scripts & deps| VITE_BUILD
    CONFIG_ESLINT -->|lint config| ESLINT

    VITE_DEV -->|serves ESM modules\nHMR| BROWSER
    VITE_BUILD -->|bundles JS & CSS| PUBLIC_ROOT
    CONFIG_VITE -->|config| VITE_DEV
    CONFIG_VITE -->|config| VITE_BUILD
    CONFIG_POSTCSS -->|plugin| VITE_BUILD
    CONFIG_TAILWIND -->|plugin| VITE_BUILD
    PLUGIN_REACT -->|JSX & SWC/Babel| VITE_DEV
    PLUGIN_REACT -->|JSX & SWC/Babel| VITE_BUILD
    PLUGIN_POSTCSS -->|CSS processing| VITE_BUILD
    PLUGIN_TAILWIND -->|utility CSS| VITE_BUILD

    PUBLIC_ROOT --> MODELS
    PUBLIC_ROOT --> TEXTURES
    PUBLIC_ROOT --> INDEX_HTML
    PUBLIC_ROOT -->|deploy| CDN
    CDN -->|delivers| BROWSER

    BROWSER -->|fetch| INDEX_HTML
    INDEX_HTML -->|loads| REACT_APP
    REACT_APP -->|entry| MAIN
    REACT_APP -->|layout| APP

    REACT_APP --> CanvasLoader
    CanvasLoader --> MODELS
    CanvasLoader --> TEXTURES

    APP --> CanvasLoader
    APP --> Cube
    APP --> Rings
    APP --> DeveloperComp
    APP --> HackerRoom
    APP --> DemoComputer
    APP --> HeroCamera
    APP --> ReactLogo
    APP --> Loading
    APP --> Alert
    APP --> Button
    APP --> Target

    APP --> HeroSec
    APP --> AboutSec
    APP --> ClientsSec
    APP --> ExperienceSec
    APP --> ProjectSec
    APP --> ContactSec
    APP --> FooterSec
    APP --> NavbarSec

    REACT_APP --> Hooks
    REACT_APP --> Constants
    REACT_APP --> GlobalCSS

    %% Click events
    click CONFIG_ESLINT "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/eslint.config.js"
    click PKGDEV "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/package.json"
    click CONFIG_VITE "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/vite.config.js"
    click CONFIG_POSTCSS "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/postcss.config.js"
    click CONFIG_TAILWIND "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/tailwind.config.js"
    click PKGBUILD "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/package.json"
    click PUBLIC_ROOT "https://github.com/nipuntaneja05/threejs_portfolio/tree/main/public/"
    click MODELS "https://github.com/nipuntaneja05/threejs_portfolio/tree/main/public/models/"
    click TEXTURES "https://github.com/nipuntaneja05/threejs_portfolio/tree/main/public/textures/"
    click INDEX_HTML "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/index.html"
    click MAIN "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/main.jsx"
    click APP "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/App.jsx"
    click CanvasLoader "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/components/CanvasLoader.jsx"
    click Cube "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/components/Cube.jsx"
    click Rings "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/components/Rings.jsx"
    click DeveloperComp "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/components/Developer.jsx"
    click HackerRoom "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/components/HackerRoom.jsx"
    click DemoComputer "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/components/DemoComputer.jsx"
    click HeroCamera "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/components/HeroCamera.jsx"
    click ReactLogo "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/components/ReactLogo.jsx"
    click Loading "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/components/Loading.jsx"
    click Alert "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/components/Alert.jsx"
    click Button "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/components/Button.jsx"
    click Target "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/components/Target.jsx"
    click HeroSec "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/sections/Hero.jsx"
    click AboutSec "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/sections/About.jsx"
    click ClientsSec "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/sections/Clients.jsx"
    click ExperienceSec "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/sections/Experience.jsx"
    click ProjectSec "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/sections/Project.jsx"
    click ContactSec "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/sections/Contact.jsx"
    click FooterSec "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/sections/Footer.jsx"
    click NavbarSec "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/sections/Navbar.jsx"
    click Hooks "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/hooks/useAlert.js"
    click Constants "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/constants/index.js"
    click GlobalCSS "https://github.com/nipuntaneja05/threejs_portfolio/blob/main/src/index.css"

    %% Styles
    classDef devtools fill:#cce5ff,stroke:#004085,color:#004085
    classDef pipeline fill:#d4edda,stroke:#155724,color:#155724
    classDef assets fill:#fff3cd,stroke:#856404,color:#856404
    classDef runtime fill:#ffe5b4,stroke:#8a3800,color:#8a3800
```
