# mcklay/portfolio-website architecture

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

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

## Overview

##### Project Type and Purpose
- This is a **frontend-focused**, single-page portfolio website built with **React**, **Vite**, and **Tailwind CSS**.
- It showcases the author’s projects, skills, and includes an embedded AI chat assistant (“ClayBot”) that communicates with a separate **FastAPI** backend.

##### File Structure and Tech Stack
- Top-level:
- Configuration files (eslint, tailwind, postcss, vite)
- index.html (Vite entry)
- package.json & lock (npm dependencies)
- public/: Static assets (images, videos) served by the hosting platform.
- src/:
- **main.jsx** & **App.jsx** (React entry and root component with routing)
- **components/** for UI modules: GlobalStarfield, layout (Navbar/Footer), sections (Hero, Projects, Skills, Gallery), and ClayBot chat widget.
- **pages/** for route-specific views (the `/projects` page).
- **constants/** for data objects (featured projects, gallery data).
- **utils/** for motion helpers (Framer Motion).
- README highlights deployment on **Netlify** and the external chat backend stack (FastAPI + Supabase pgvector + OpenAI).

##### Main Components and Their Roles
A. User’s Browser (Client)
- Loads the React SPA from Netlify CDN/statically served assets.
- Renders interactive UI (starfield, hero video, project cards, skills section).
- Hosts the ClayBot widget, which opens a WebSocket or REST channel to the chat backend.
B. Static Hosting (Netlify)
- Serves index.html, JS bundle (Vite output), CSS (Tailwind), images & videos.
- Provides a CDN layer for fast global delivery.
C. React Application
- **Routing** via React Router: home (`/`) and projects (`/projects`).
- **Components**:
- Layout: Navbar, Footer
- Sections: Hero (with video+rotating titles), Skills (video bg), Projects (cards), Gallery
- Chatbot: ChatWidget, ActionProvider, MessageParser (configured via `config.js`)
- **State & Data**: constant JS modules supply project metadata.
D. ClayBot Chat Service (External Microservice)
- FastAPI backend (deployed separately on Render).
- Accepts user messages, performs RAG via Supabase pgvector + OpenAI GPT-3.5-turbo.
- Returns bot responses to the frontend widget.
E. External APIs & Databases
- **OpenAI API** for GPT-3.5 responses.
- **Supabase pgvector** for vector similarity search over embedded `.md` data.

##### Relationships & Data Flows
1. User → Browser loads React SPA from Netlify (GET index.html, JS, CSS, assets).
2. React App bootstraps, fetches local constants for project data, renders UI.
3. User interacts with ChatWidget → frontend sends message to FastAPI chat endpoint.
4. FastAPI service queries Supabase vector DB, may call OpenAI API → processes and returns chat response.
5. Frontend receives and displays response in ChatBubble.

##### Architectural Patterns & Principles
- **Single-Page Application (SPA)**: Fast client-side routing, minimal full-page reloads.
- **Modular Component Design**: Atomic and section components for reuse and testability.
- **Separation of Concerns**:
- Static hosting (Netlify) vs. dynamic AI service (FastAPI).
- UI vs. Data/Business logic (React components vs. chat backend).
- **RAG-Style Chatbot**: Decoupled microservice for AI assistant.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client & Hosting
    Browser(["User's Browser"]):::frontend
    Netlify(["Static Hosting (Netlify CDN)"]):::frontend
    Assets(["public/assets/images & videos"]):::external
    indexHTML["index.html"]:::code

    Browser -->|"GET assets"| Netlify
    Netlify -->|"Serves index.html, JS, CSS, assets"| Browser
    Netlify --> Assets
    Netlify --> indexHTML

    %% React Application
    Browser --> ReactApp["React Application"]:::frontend

    subgraph "React Application"
        Main["main.jsx"]:::code
        App["App.jsx (Routing Layer)"]:::code
        ProjectsPage["Projects.jsx (Page Route)"]:::code

        subgraph "Layout Components"
            Navbar["Navbar.jsx"]:::code
            Footer["Footer.jsx"]:::code
        end

        GlobalStar["GlobalStarfield.jsx"]:::code

        subgraph "Sections Components"
            Hero["Hero.jsx"]:::code
            RotTitles["RotatingTitles.jsx"]:::code
            Skills["Skills.jsx"]:::code
            ProjectsSection["Projects.jsx"]:::code
            ProjectCard["ProjectCard.jsx"]:::code
            GallerySection["ProjectGallery.jsx"]:::code
            ProjectCardGal["ProjectCardGallery.jsx"]:::code
            Encryption["Encryption.jsx"]:::code
        end

        subgraph "Chatbot Widget"
            ChatWidget["ChatWidget.jsx"]:::code
            ChatBubbleCSS["ChatBubble.css"]:::code
            ActionProv["ActionProvider.jsx"]:::code
            MessageParser["MessageParser.js"]:::code
            Config["config.js"]:::code
        end

        subgraph "Constants & Utils"
            Const1["PROJECT_DATA.js"]:::code
            Const2["PROJECT_GALLERY_DATA.js"]:::code
            Motion["motion.js"]:::code
        end
    end

    ReactApp --> Main
    ReactApp --> App
    ReactApp --> ProjectsPage
    ReactApp --> Navbar
    ReactApp --> Footer
    ReactApp --> GlobalStar
    ReactApp --> Hero
    ReactApp --> RotTitles
    ReactApp --> Skills
    ReactApp --> ProjectsSection
    ReactApp --> ProjectCard
    ReactApp --> GallerySection
    ReactApp --> ProjectCardGal
    ReactApp --> Encryption
    ReactApp --> ChatWidget
    ReactApp --> ActionProv
    ReactApp --> MessageParser
    ReactApp --> Config
    ReactApp --> Const1
    ReactApp --> Const2
    ReactApp --> Motion

    %% Chat Service
    ChatWidget -->|"REST/JSON"| ChatAPI["Chatbot Backend Service\n(FastAPI / Render)"]:::backend
    ChatAPI -->|"vector query"| Supabase["Supabase pgvector"]:::external
    ChatAPI -->|"completion request"| OpenAI["OpenAI API"]:::external
    Supabase -->|"results"| ChatAPI
    OpenAI -->|"response"| ChatAPI
    ChatAPI -->|"response JSON"| ChatWidget

    %% Build & Config Files
    subgraph "Build & Config"
        PKG["package.json"]:::code
        VITE["vite.config.js"]:::code
        TAILWIND["tailwind.config.js"]:::code
        POSTCSS["postcss.config.js"]:::code
        ESLINT["eslint.config.js"]:::code
    end
    Netlify --> PKG
    Netlify --> VITE
    Netlify --> TAILWIND
    Netlify --> POSTCSS
    Netlify --> ESLINT

    %% Click Events
    click Main "https://github.com/mcklay/portfolio-website/blob/main/src/main.jsx"
    click App "https://github.com/mcklay/portfolio-website/blob/main/src/App.jsx"
    click ProjectsPage "https://github.com/mcklay/portfolio-website/blob/main/src/pages/Projects.jsx"
    click Navbar "https://github.com/mcklay/portfolio-website/blob/main/src/components/layout/Navbar.jsx"
    click Footer "https://github.com/mcklay/portfolio-website/blob/main/src/components/layout/Footer.jsx"
    click GlobalStar "https://github.com/mcklay/portfolio-website/blob/main/src/components/GlobalStarfield.jsx"
    click Hero "https://github.com/mcklay/portfolio-website/blob/main/src/components/sections/Hero.jsx"
    click RotTitles "https://github.com/mcklay/portfolio-website/blob/main/src/components/sub/RotatingTitles.jsx"
    click Skills "https://github.com/mcklay/portfolio-website/blob/main/src/components/sections/Skills.jsx"
    click ProjectsSection "https://github.com/mcklay/portfolio-website/blob/main/src/components/sections/Projects.jsx"
    click ProjectCard "https://github.com/mcklay/portfolio-website/blob/main/src/components/sections/ProjectCard.jsx"
    click GallerySection "https://github.com/mcklay/portfolio-website/blob/main/src/components/sections/ProjectGallery.jsx"
    click ProjectCardGal "https://github.com/mcklay/portfolio-website/blob/main/src/components/sub/ProjectCardGallery.jsx"
    click Encryption "https://github.com/mcklay/portfolio-website/blob/main/src/components/sections/Encryption.jsx"
    click ChatWidget "https://github.com/mcklay/portfolio-website/blob/main/src/components/chatbot/ChatWidget.jsx"
    click ChatBubbleCSS "https://github.com/mcklay/portfolio-website/blob/main/src/components/chatbot/ChatBubble.css"
    click ActionProv "https://github.com/mcklay/portfolio-website/blob/main/src/components/chatbot/ActionProvider.jsx"
    click MessageParser "https://github.com/mcklay/portfolio-website/blob/main/src/components/chatbot/MessageParser.js"
    click Config "https://github.com/mcklay/portfolio-website/blob/main/src/components/chatbot/config.js"
    click Const1 "https://github.com/mcklay/portfolio-website/blob/main/src/constants/PROJECT_DATA.js"
    click Const2 "https://github.com/mcklay/portfolio-website/blob/main/src/constants/PROJECT_GALLERY_DATA.js"
    click Motion "https://github.com/mcklay/portfolio-website/blob/main/src/utils/motion.js"
    click Assets "https://github.com/mcklay/portfolio-website/tree/main/public/assets/images/**"
    click indexHTML "https://github.com/mcklay/portfolio-website/blob/main/index.html"
    click PKG "https://github.com/mcklay/portfolio-website/blob/main/package.json"
    click VITE "https://github.com/mcklay/portfolio-website/blob/main/vite.config.js"
    click TAILWIND "https://github.com/mcklay/portfolio-website/blob/main/tailwind.config.js"
    click POSTCSS "https://github.com/mcklay/portfolio-website/blob/main/postcss.config.js"
    click ESLINT "https://github.com/mcklay/portfolio-website/blob/main/eslint.config.js"

    %% Styles
    classDef frontend fill:#D6EFFF,stroke:#0366d6,stroke-width:1px
    classDef backend fill:#FFDDDD,stroke:#D61C4E,stroke-width:1px
    classDef external fill:#DDFFDD,stroke:#28A745,stroke-width:1px
    classDef code fill:#F8F0FF,stroke:#926AA6,stroke-width:1px
```
