# kemdeth/portfolio-website architecture

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

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

## Overview

This repository is a portfolio website with a public-facing showcase, contact and AI-chat experiences, plus an authenticated content-management area. Visitors browse the portfolio or submit a message; administrators sign in and manage site content and messages. Shared site data is loaded through a provider backed by local storage or Supabase. The graph reflects the routed application and source-index references; contact-function wiring and several unsampled implementation details are not asserted.

Main entry points: [`src/App.tsx`](https://github.com/kemdeth/portfolio-website/blob/main/src/App.tsx) (App Router), [`src/components/ChatWidget.tsx`](https://github.com/kemdeth/portfolio-website/blob/main/src/components/ChatWidget.tsx) (AI Chat Widget), [`src/context/DataContext.tsx`](https://github.com/kemdeth/portfolio-website/blob/main/src/context/DataContext.tsx) (Data Provider), [`src/pages/Home.tsx`](https://github.com/kemdeth/portfolio-website/blob/main/src/pages/Home.tsx) (Portfolio Page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public Portfolio"]
  node_app["App Router<br/>[App.tsx]"]
  node_home["Portfolio Page<br/>[Home.tsx]"]
  node_portfolio["Portfolio Sections"]
  node_contact["Contact Form<br/>[Contact.tsx]"]
  node_contactlib["Contact Client<br/>[contact.ts]"]
  node_botcheck["Bot Check<br/>[BotCheck.tsx]"]
  node_chat["AI Chat Widget<br/>[ChatWidget.tsx]"]
  node_chatmd["Chat Markdown<br/>[ChatMarkdown.tsx]"]
  node_ai["AI Client<br/>[ai.ts]"]
end

subgraph group_admin["Admin Console"]
  node_login["Admin Login<br/>[AdminLogin.tsx]"]
  node_guard["Route Guard<br/>[RequireAuth.tsx]"]
  node_dashboard["Dashboard Layout"]
  node_adminpages["Admin Pages"]
end

subgraph group_shared["Shared Data and State"]
  node_auth["Auth Context<br/>[AuthContext.tsx]"]
  node_authhook["Auth Hook<br/>[useAuth.ts]"]
  node_datacontext["Data Provider<br/>[DataContext.tsx]"]
  node_datahook["Data Hook<br/>[useData.ts]"]
  node_storage["Storage Adapter<br/>[storage.ts]"]
  node_adminapi["Admin API Client<br/>[adminApi.ts]"]
  node_toast["Toast State<br/>[ToastContext.tsx]"]
  node_botgate["Bot Gate State<br/>[BotGateContext.tsx]"]
end

subgraph group_server["Server Functions"]
  node_authfn["Auth Function<br/>[auth.ts]"]
  node_adminfn["Admin Function<br/>[admin.ts]"]
  node_session["Session Utilities<br/>[session.ts]"]
  node_contactfn["Contact Function<br/>[contact.ts]"]
end

node_visitor(("Visitor"))
node_adminactor(("Administrator"))
node_supabase[("Supabase")]
node_localstore[("Browser Storage")]

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_home -->|"renders"| node_portfolio
node_home -->|"renders"| node_contact
node_contact -->|"sends via"| node_contactlib
node_contact -->|"uses"| node_botcheck
node_app -->|"renders"| node_chat
node_chat -->|"loads"| node_chatmd
node_chat -->|"calls"| node_ai
node_chat -->|"checks"| node_botgate
node_chat -->|"uses"| node_toast
node_adminactor -->|"opens"| node_app
node_app -->|"routes to"| node_login
node_app -->|"protects route"| node_guard
node_guard -->|"checks"| node_authhook
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_adminpages
node_app -->|"provides"| node_auth
node_authhook -->|"reads"| node_auth
node_app -->|"provides"| node_datacontext
node_datahook -->|"reads"| node_datacontext
node_datacontext -->|"loads and persists"| node_storage
node_datacontext -->|"uses"| node_adminapi
node_storage -->|"reads"| node_supabase
node_storage -->|"reads and writes"| node_localstore
node_authfn -->|"uses"| node_session
node_adminfn -->|"uses"| node_session
node_contactlib -.->|"may call"| node_contactfn

click node_app "https://github.com/kemdeth/portfolio-website/blob/main/src/App.tsx"
click node_home "https://github.com/kemdeth/portfolio-website/blob/main/src/pages/Home.tsx"
click node_portfolio "https://github.com/kemdeth/portfolio-website/tree/main/src/sections"
click node_contact "https://github.com/kemdeth/portfolio-website/blob/main/src/sections/Contact.tsx"
click node_contactlib "https://github.com/kemdeth/portfolio-website/blob/main/src/lib/contact.ts"
click node_botcheck "https://github.com/kemdeth/portfolio-website/blob/main/src/components/BotCheck.tsx"
click node_chat "https://github.com/kemdeth/portfolio-website/blob/main/src/components/ChatWidget.tsx"
click node_chatmd "https://github.com/kemdeth/portfolio-website/blob/main/src/components/ChatMarkdown.tsx"
click node_ai "https://github.com/kemdeth/portfolio-website/blob/main/src/lib/ai.ts"
click node_login "https://github.com/kemdeth/portfolio-website/blob/main/src/pages/admin/AdminLogin.tsx"
click node_guard "https://github.com/kemdeth/portfolio-website/blob/main/src/components/RequireAuth.tsx"
click node_dashboard "https://github.com/kemdeth/portfolio-website/blob/main/src/pages/DashboardLayout.tsx"
click node_adminpages "https://github.com/kemdeth/portfolio-website/tree/main/src/pages/admin"
click node_auth "https://github.com/kemdeth/portfolio-website/blob/main/src/context/AuthContext.tsx"
click node_authhook "https://github.com/kemdeth/portfolio-website/blob/main/src/context/useAuth.ts"
click node_datacontext "https://github.com/kemdeth/portfolio-website/blob/main/src/context/DataContext.tsx"
click node_datahook "https://github.com/kemdeth/portfolio-website/blob/main/src/context/useData.ts"
click node_storage "https://github.com/kemdeth/portfolio-website/blob/main/src/lib/storage.ts"
click node_adminapi "https://github.com/kemdeth/portfolio-website/blob/main/src/lib/adminApi.ts"
click node_toast "https://github.com/kemdeth/portfolio-website/blob/main/src/context/ToastContext.tsx"
click node_botgate "https://github.com/kemdeth/portfolio-website/blob/main/src/context/BotGateContext.tsx"
click node_authfn "https://github.com/kemdeth/portfolio-website/blob/main/netlify/functions/auth.ts"
click node_adminfn "https://github.com/kemdeth/portfolio-website/blob/main/netlify/functions/admin.ts"
click node_session "https://github.com/kemdeth/portfolio-website/blob/main/netlify/functions/_shared/session.ts"
click node_contactfn "https://github.com/kemdeth/portfolio-website/blob/main/netlify/functions/contact.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_home,node_portfolio,node_contact,node_contactlib,node_botcheck,node_chat,node_chatmd,node_ai toneBlue
class node_login,node_guard,node_dashboard,node_adminpages,node_supabase,node_localstore toneAmber
class node_auth,node_authhook,node_datacontext,node_datahook,node_storage,node_adminapi,node_toast,node_botgate toneMint
class node_authfn,node_adminfn,node_session,node_contactfn toneRose
class node_visitor,node_adminactor toneIndigo
```

## Components

### Public Portfolio

- [App Router](https://github.com/kemdeth/portfolio-website/blob/main/src/App.tsx): `src/App.tsx`
- [Portfolio Page](https://github.com/kemdeth/portfolio-website/blob/main/src/pages/Home.tsx): `src/pages/Home.tsx`
- [Portfolio Sections](https://github.com/kemdeth/portfolio-website/tree/main/src/sections): `src/sections`
- [Contact Form](https://github.com/kemdeth/portfolio-website/blob/main/src/sections/Contact.tsx): `src/sections/Contact.tsx`
- [Contact Client](https://github.com/kemdeth/portfolio-website/blob/main/src/lib/contact.ts): `src/lib/contact.ts`
- [Bot Check](https://github.com/kemdeth/portfolio-website/blob/main/src/components/BotCheck.tsx): `src/components/BotCheck.tsx`
- [AI Chat Widget](https://github.com/kemdeth/portfolio-website/blob/main/src/components/ChatWidget.tsx): `src/components/ChatWidget.tsx`
- [Chat Markdown](https://github.com/kemdeth/portfolio-website/blob/main/src/components/ChatMarkdown.tsx): `src/components/ChatMarkdown.tsx`
- [AI Client](https://github.com/kemdeth/portfolio-website/blob/main/src/lib/ai.ts): `src/lib/ai.ts`

### Admin Console

- [Admin Login](https://github.com/kemdeth/portfolio-website/blob/main/src/pages/admin/AdminLogin.tsx): `src/pages/admin/AdminLogin.tsx`
- [Route Guard](https://github.com/kemdeth/portfolio-website/blob/main/src/components/RequireAuth.tsx): `src/components/RequireAuth.tsx`
- [Dashboard Layout](https://github.com/kemdeth/portfolio-website/blob/main/src/pages/DashboardLayout.tsx): `src/pages/DashboardLayout.tsx`
- [Admin Pages](https://github.com/kemdeth/portfolio-website/tree/main/src/pages/admin): `src/pages/admin`

### Shared Data and State

- [Auth Context](https://github.com/kemdeth/portfolio-website/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Auth Hook](https://github.com/kemdeth/portfolio-website/blob/main/src/context/useAuth.ts): `src/context/useAuth.ts`
- [Data Provider](https://github.com/kemdeth/portfolio-website/blob/main/src/context/DataContext.tsx): `src/context/DataContext.tsx`
- [Data Hook](https://github.com/kemdeth/portfolio-website/blob/main/src/context/useData.ts): `src/context/useData.ts`
- [Storage Adapter](https://github.com/kemdeth/portfolio-website/blob/main/src/lib/storage.ts): `src/lib/storage.ts`
- [Admin API Client](https://github.com/kemdeth/portfolio-website/blob/main/src/lib/adminApi.ts): `src/lib/adminApi.ts`
- [Toast State](https://github.com/kemdeth/portfolio-website/blob/main/src/context/ToastContext.tsx): `src/context/ToastContext.tsx`
- [Bot Gate State](https://github.com/kemdeth/portfolio-website/blob/main/src/context/BotGateContext.tsx): `src/context/BotGateContext.tsx`

### Server Functions

- [Auth Function](https://github.com/kemdeth/portfolio-website/blob/main/netlify/functions/auth.ts): `netlify/functions/auth.ts`
- [Admin Function](https://github.com/kemdeth/portfolio-website/blob/main/netlify/functions/admin.ts): `netlify/functions/admin.ts`
- [Session Utilities](https://github.com/kemdeth/portfolio-website/blob/main/netlify/functions/_shared/session.ts): `netlify/functions/_shared/session.ts`
- [Contact Function](https://github.com/kemdeth/portfolio-website/blob/main/netlify/functions/contact.ts): `netlify/functions/contact.ts`

### Other components

- **Visitor**
- **Administrator**
- **Supabase**
- **Browser Storage**

## Connections

- Visitor → App Router: opens (evidence: `src/App.tsx`)
- App Router → Portfolio Page: routes to (evidence: `src/App.tsx`)
- Portfolio Page → Portfolio Sections: renders (evidence: `src/pages/Home.tsx`)
- Portfolio Page → Contact Form: renders (evidence: `src/pages/Home.tsx`)
- Contact Form → Contact Client: sends via (evidence: `src/sections/Contact.tsx`)
- Contact Form → Bot Check: uses (evidence: `src/sections/Contact.tsx`)
- App Router → AI Chat Widget: renders (evidence: `src/App.tsx`)
- AI Chat Widget → Chat Markdown: loads (evidence: `src/components/ChatWidget.tsx`)
- AI Chat Widget → AI Client: calls (evidence: `src/components/ChatWidget.tsx`)
- AI Chat Widget → Bot Gate State: checks (evidence: `src/components/ChatWidget.tsx`)
- AI Chat Widget → Toast State: uses (evidence: `src/components/ChatWidget.tsx`)
- Administrator → App Router: opens (evidence: `src/App.tsx`)
- App Router → Admin Login: routes to (evidence: `src/App.tsx`)
- App Router → Route Guard: protects route (evidence: `src/App.tsx`)
- Route Guard → Auth Hook: checks (evidence: `src/components/RequireAuth.tsx`)
- App Router → Dashboard Layout: routes to (evidence: `src/App.tsx`)
- App Router → Admin Pages: routes to (evidence: `src/App.tsx`)
- App Router → Auth Context: provides (evidence: `src/App.tsx`)
- Auth Hook → Auth Context: reads (evidence: `src/context/useAuth.ts`)
- App Router → Data Provider: provides (evidence: `src/App.tsx`)
- Data Hook → Data Provider: reads (evidence: `src/context/useData.ts`)
- Data Provider → Storage Adapter: loads and persists (evidence: `src/context/DataContext.tsx`)
- Data Provider → Admin API Client: uses (evidence: `src/context/DataContext.tsx`)
- Storage Adapter → Supabase: reads (evidence: `src/lib/storage.ts`)
- Storage Adapter → Browser Storage: reads and writes (evidence: `src/lib/storage.ts`)
- Auth Function → Session Utilities: uses (evidence: `netlify/functions/auth.ts`)
- Admin Function → Session Utilities: uses (evidence: `netlify/functions/admin.ts`)
- Contact Client → Contact Function: may call
