How mcklay/portfolio-website works
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.