# debarun23/my-portfolio architecture

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

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

## Overview

##### Project type and purpose
- This is a front-end React SPA boilerplate built with Vite and TypeScript.
- It includes a custom UI component library under src/components/ui, demo pages in src/components (e.g., IDCard.tsx, TerminalInterface.tsx, PortfolioContent.tsx), utility functions (src/lib/utils.ts), and Storybook-style “stories” (src/stories) for interactive component previews.
- It is intended as a starting point for a production React application or component library, with hot-module reloading (HMR), TailwindCSS styling, and optional Supabase integration (via types in src/types).

##### File structure
- Top-level:
- package.json / package-lock.json – dependencies, scripts (dev/build).
- vite.config.ts – Vite build/dev server config with plugin-react or plugin-react-swc.
- postcss.config.js & tailwind.config.js – CSS pipeline.
- README.md – usage, ESLint recommendations.
- Public assets: public/index.html
- Source: src/
- main.tsx – app entry point referenced by index.html.
- App.tsx – root React component.
- components/… – page-level components and UI library subfolder.
- lib/utils.ts – shared helpers.
- stories/… – Storybook-style files demonstrating each UI component.
- types/ – custom TypeScript definitions (e.g. Supabase).
- Config: tsconfig.json / tsconfig.node.json (TypeScript setup), tempo.config.json (if used for CI/CD), components.json (custom metadata).

##### Insights from README
- Primary stack: React + TypeScript + Vite.
- ESLint enhancements suggested for production.
- Two Vite plugins for React Fast Refresh (Babel vs. SWC).

a. Main components
- Developer Machine – runs:
– Node.js + npm/yarn
– Vite Dev Server (with plugin-react or plugin-react-swc)
– ESLint/PostCSS Tailwind pipeline
- Client Browser – loads index.html → downloads bundled JS/CSS → renders React SPA
- React SPA Layers:
– Root (App.tsx)
– Page Components (IDCard, PortfolioContent, TerminalInterface)
– UI Library (accordion, alert-dialog, button, etc.)
– Utility Module (utils.ts)
- Build Output – Vite bundles into dist/ for production hosting
- External Services (optional) – Supabase (authentication, database)
- Storybook-like Preview – runs on Vite using src/stories for isolated component testing

b. Relationships and data flows
1. Developer Machine triggers “npm run dev” → Vite Dev Server
2. Vite serves index.html and on-the-fly bundles TSX files
3. Browser ↔ Dev Server (HMR WebSocket) for live updates
4. Browser loads React app → components import UI library and utils → render UI
5. React components call external APIs (e.g. Supabase) via fetch/sdk
6. Build pipeline (npm run build) → Vite outputs optimized static assets
7. Storybook runs via Vite config, serves stories for each UI component

c. Architectural patterns / design principles
- Component-based architecture (React functional components)
- Modular UI library (single purpose, reusable UI primitives under src/components/ui)
- Separation of concerns:
– Presentation (UI components)
– Container/page components (compose UI primitives)
– Utilities (common logic in src/lib)
– Environment configuration (Vite, Tailwind, ESLint)

d. Key technologies / frameworks / libraries
- React (17+) with JSX/TSX
- Vite (fast bundler with dev server)
- TypeScript for type safety
- TailwindCSS + PostCSS for styling
- ESLint + optional type-aware linting
- Storybook-style previews via Vite
- Supabase SDK types

## Diagram (Mermaid)

```mermaid
graph TD
    %% Development Environment
    subgraph "Developer Machine" 
        DevMachine["Developer Machine"]:::tool
    end

    %% Development Toolchain
    subgraph "Dev Toolchain"
        NodeNpm["Node.js & npm/yarn"]:::tool
        ViteConfig["Vite Dev Server\n(plugin-react/plugin-react-swc)"]:::tool
        ESLint["ESLint"]:::tool
        Tailwind["PostCSS & TailwindCSS"]:::tool
    end

    DevMachine -->|runs| NodeNpm
    NodeNpm -->|uses| ViteConfig
    NodeNpm -->|uses| ESLint
    NodeNpm -->|uses| Tailwind

    %% Development Flow to Browser
    ViteConfig -->|serves index.html & bundles| Browser
    ViteConfig -.->|HMR WebSocket| Browser

    %% Browser and React App
    Browser["Client Browser"]:::external

    subgraph "React SPA"
        MainEntry["main.tsx"]:::code
        AppComponent["App.tsx"]:::code

        subgraph "Page Components"
            HomePage["home.tsx"]:::code
            IDCardPage["IDCard.tsx"]:::code
            TerminalPage["TerminalInterface.tsx"]:::code
            PortfolioPage["PortfolioContent.tsx"]:::code
        end

        subgraph "UI Library"
            UILib["UI Component Primitives"]:::code
        end

        Utils["utils.ts"]:::code
    end

    Browser -->|loads bundle| MainEntry
    MainEntry -->|renders| AppComponent
    AppComponent -->|uses| HomePage
    AppComponent -->|uses| IDCardPage
    AppComponent -->|uses| TerminalPage
    AppComponent -->|uses| PortfolioPage
    AppComponent -->|imports| UILib
    AppComponent -->|imports| Utils
    AppComponent -->|calls| Supabase

    %% Storybook Preview
    subgraph "Storybook-style Preview"
        Stories["src/stories"]:::code
    end
    NodeNpm -->|runs| Stories
    Stories -->|serves component previews| Browser

    %% External Services
    Supabase["Supabase"]:::external
    AppComponent -->|SDK/fetch| Supabase

    %% Production Build
    NodeNpm -->|npm run build| Build
    subgraph "Build Output"
        Build["dist/"]:::code
        Hosting["Hosting / CDN"]:::external
    end
    Build -->|deploy| Hosting
    Hosting -->|serves static assets| Browser

    %% Configuration Files
    subgraph "Configuration Files"
        PackageJSON["package.json\npackage-lock.json"]:::config
        PostCSSConfig["postcss.config.js"]:::config
        TailwindConfig["tailwind.config.js"]:::config
        TSConfig["tsconfig.json\ntsconfig.node.json"]:::config
        TempoConfig["tempo.config.json"]:::config
        ComponentsMeta["components.json"]:::config
        PublicHTML["public/index.html"]:::code
        ViteEnv["src/vite-env.d.ts"]:::code
        SupaTypes["src/types/supabase.ts"]:::code
        GlobalCSS["src/index.css"]:::code
    end

    DevMachine -->|edits| PackageJSON
    DevMachine -->|edits| PostCSSConfig
    DevMachine -->|edits| TailwindConfig
    DevMachine -->|edits| TSConfig
    DevMachine -->|edits| TempoConfig
    DevMachine -->|edits| ComponentsMeta
    DevMachine -->|edits| PublicHTML
    DevMachine -->|edits| ViteEnv
    DevMachine -->|edits| SupaTypes
    DevMachine -->|edits| GlobalCSS

    PublicHTML -->|references| MainEntry

    %% Click Events
    click ViteConfig "https://github.com/debarun23/my-portfolio/blob/main/vite.config.ts"
    click PackageJSON "https://github.com/debarun23/my-portfolio/blob/main/package.json"
    click PackageJSON "https://github.com/debarun23/my-portfolio/blob/main/package-lock.json"
    click PostCSSConfig "https://github.com/debarun23/my-portfolio/blob/main/postcss.config.js"
    click TailwindConfig "https://github.com/debarun23/my-portfolio/blob/main/tailwind.config.js"
    click TSConfig "https://github.com/debarun23/my-portfolio/blob/main/tsconfig.json"
    click TSConfig "https://github.com/debarun23/my-portfolio/blob/main/tsconfig.node.json"
    click TempoConfig "https://github.com/debarun23/my-portfolio/blob/main/tempo.config.json"
    click ComponentsMeta "https://github.com/debarun23/my-portfolio/blob/main/components.json"
    click PublicHTML "https://github.com/debarun23/my-portfolio/blob/main/public/index.html"
    click MainEntry "https://github.com/debarun23/my-portfolio/blob/main/src/main.tsx"
    click AppComponent "https://github.com/debarun23/my-portfolio/blob/main/src/App.tsx"
    click HomePage "https://github.com/debarun23/my-portfolio/blob/main/src/components/home.tsx"
    click IDCardPage "https://github.com/debarun23/my-portfolio/blob/main/src/components/IDCard.tsx"
    click TerminalPage "https://github.com/debarun23/my-portfolio/blob/main/src/components/TerminalInterface.tsx"
    click PortfolioPage "https://github.com/debarun23/my-portfolio/blob/main/src/components/PortfolioContent.tsx"
    click UILib "https://github.com/debarun23/my-portfolio/tree/main/src/components/ui/"
    click Utils "https://github.com/debarun23/my-portfolio/blob/main/src/lib/utils.ts"
    click Stories "https://github.com/debarun23/my-portfolio/tree/main/src/stories/"
    click SupaTypes "https://github.com/debarun23/my-portfolio/blob/main/src/types/supabase.ts"
    click ViteEnv "https://github.com/debarun23/my-portfolio/blob/main/src/vite-env.d.ts"
    click GlobalCSS "https://github.com/debarun23/my-portfolio/blob/main/src/index.css"

    %% Styles
    classDef tool fill:#e0e0e0,stroke:#888,stroke-width:1px
    classDef code fill:#d0e6ff,stroke:#0366d6,stroke-width:1px
    classDef config fill:#f0f0f0,stroke:#999,stroke-width:1px
    classDef external fill:#ffe0b3,stroke:#d46000,stroke-width:1px
```
