# chanthornyoeun/portfolio architecture

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

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

## Overview

This repository is a static, prerendered personal portfolio. Its content workflow fetches and validates published Supabase content at build time, then prerenders route-specific HTML; visitors receive those pages and React hydrates them for interactive features. The map includes the documented SEO and analytics capabilities, plus the sampled portfolio sections and case studies. Prerender and fetch implementation details were not sampled, so those relationships rely on README statements rather than inspected implementation.

Main entry points: [`src/App.tsx`](https://github.com/chanthornyoeun/portfolio/blob/master/src/App.tsx) (Page composition), [`scripts/prerender.ts`](https://github.com/chanthornyoeun/portfolio/blob/master/scripts/prerender.ts) (HTML prerender), [`scripts/fetch-content.ts`](https://github.com/chanthornyoeun/portfolio/blob/master/scripts/fetch-content.ts) (Content fetch), [`src/components/Header.tsx`](https://github.com/chanthornyoeun/portfolio/blob/master/src/components/Header.tsx) (Navigation and theme)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_content["Content publishing"]
  node_supabase[("Supabase content")]
  node_fetch["Content fetch<br/>[fetch-content.ts]"]
  node_mapping["Map and validate<br/>[content.ts]"]
  node_client["Supabase client<br/>[supabase.ts]"]
  node_snapshot["Content snapshot<br/>[ContentContext.tsx]"]
  node_contentdata["Portfolio data models<br/>[projects.ts]"]
  node_profile["Profile content<br/>[profile.ts]"]
  node_experience_data["Experience content<br/>[experience.ts]"]
end

subgraph group_pages["Portfolio pages"]
  node_app["Page composition<br/>[App.tsx]"]
  node_header["Navigation and theme<br/>[Header.tsx]"]
  node_home["Homepage sections<br/>[Hero.tsx]"]
  node_projects["Project listings<br/>[Projects.tsx]"]
  node_case["Case studies<br/>[ProjectDetail.tsx]"]
  node_experience["Experience section<br/>[Experience.tsx]"]
  node_section["Section layout<br/>[Section.tsx]"]
  node_styles["Shared styles<br/>[styles.ts]"]
end

subgraph group_runtime["Interactive runtime"]
  node_theme["Theme state<br/>[ThemeContext.tsx]"]
  node_consent["Analytics consent<br/>[ConsentBanner.tsx]"]
  node_analytics["Analytics events<br/>[analytics.ts]"]
  node_analytics_service["Google Analytics"]
  node_reveal["Reveal animation<br/>[reveal.ts]"]
end

subgraph group_delivery["Static rendering"]
  node_routes["Route matching<br/>[routes.ts]"]
  node_prerender["HTML prerender<br/>[prerender.ts]"]
  node_server["Server render entry<br/>[entry-server.tsx]"]
  node_seo["SEO metadata<br/>[seo.ts]"]
  node_site["Static portfolio"]
end

node_editor(("Content editor"))
node_visitor(("Visitor"))

node_editor -->|"publishes content"| node_supabase
node_supabase -->|"provides rows"| node_fetch
node_fetch -->|"fetches and validates"| node_mapping
node_mapping -->|"resolves media"| node_client
node_fetch -->|"writes snapshot"| node_snapshot
node_snapshot -->|"supplies content"| node_app
node_prerender -->|"renders pages"| node_server
node_prerender -->|"uses route definitions"| node_routes
node_prerender -->|"generates metadata"| node_seo
node_prerender -->|"writes static HTML"| node_site
node_server -->|"renders app"| node_app
node_server -->|"selects route"| node_routes
node_visitor -->|"requests pages"| node_site
node_site -->|"hydrates"| node_app
node_app -->|"selects page"| node_routes
node_app -->|"renders"| node_header
node_app -->|"renders"| node_home
node_app -->|"renders"| node_projects
node_app -->|"renders"| node_case
node_app -->|"renders"| node_experience
node_header -->|"toggles theme"| node_theme
node_header -->|"tracks navigation"| node_analytics
node_app -->|"renders"| node_consent
node_app -->|"tracks page views"| node_analytics
node_analytics -->|"loads after consent"| node_analytics_service
node_app -->|"starts animation"| node_reveal
node_projects -->|"uses project data"| node_contentdata
node_case -->|"uses project data"| node_contentdata
node_home -->|"reads profile"| node_profile
node_experience -->|"reads experience"| node_experience_data
node_projects -->|"renders section"| node_section
node_experience -->|"renders section"| node_section
node_section -->|"uses layout styles"| node_styles

click node_fetch "https://github.com/chanthornyoeun/portfolio/blob/master/scripts/fetch-content.ts"
click node_mapping "https://github.com/chanthornyoeun/portfolio/blob/master/src/services/content.ts"
click node_client "https://github.com/chanthornyoeun/portfolio/blob/master/src/lib/supabase.ts"
click node_snapshot "https://github.com/chanthornyoeun/portfolio/blob/master/src/contexts/ContentContext.tsx"
click node_contentdata "https://github.com/chanthornyoeun/portfolio/blob/master/src/data/projects.ts"
click node_routes "https://github.com/chanthornyoeun/portfolio/blob/master/src/routes.ts"
click node_prerender "https://github.com/chanthornyoeun/portfolio/blob/master/scripts/prerender.ts"
click node_server "https://github.com/chanthornyoeun/portfolio/blob/master/src/entry-server.tsx"
click node_seo "https://github.com/chanthornyoeun/portfolio/blob/master/src/seo.ts"
click node_app "https://github.com/chanthornyoeun/portfolio/blob/master/src/App.tsx"
click node_header "https://github.com/chanthornyoeun/portfolio/blob/master/src/components/Header.tsx"
click node_home "https://github.com/chanthornyoeun/portfolio/blob/master/src/components/Hero.tsx"
click node_projects "https://github.com/chanthornyoeun/portfolio/blob/master/src/components/Projects.tsx"
click node_case "https://github.com/chanthornyoeun/portfolio/blob/master/src/components/ProjectDetail.tsx"
click node_experience "https://github.com/chanthornyoeun/portfolio/blob/master/src/components/Experience.tsx"
click node_profile "https://github.com/chanthornyoeun/portfolio/blob/master/src/data/profile.ts"
click node_experience_data "https://github.com/chanthornyoeun/portfolio/blob/master/src/data/experience.ts"
click node_section "https://github.com/chanthornyoeun/portfolio/blob/master/src/components/Section.tsx"
click node_styles "https://github.com/chanthornyoeun/portfolio/blob/master/src/components/styles.ts"
click node_theme "https://github.com/chanthornyoeun/portfolio/blob/master/src/contexts/ThemeContext.tsx"
click node_consent "https://github.com/chanthornyoeun/portfolio/blob/master/src/components/ConsentBanner.tsx"
click node_analytics "https://github.com/chanthornyoeun/portfolio/blob/master/src/lib/analytics.ts"
click node_reveal "https://github.com/chanthornyoeun/portfolio/blob/master/src/lib/reveal.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_supabase,node_fetch,node_mapping,node_client,node_snapshot,node_contentdata,node_profile,node_experience_data toneBlue
class node_app,node_header,node_home,node_projects,node_case,node_experience,node_section,node_styles toneAmber
class node_theme,node_consent,node_analytics,node_analytics_service,node_reveal toneMint
class node_routes,node_prerender,node_server,node_seo,node_site toneRose
class node_editor,node_visitor toneIndigo
```

## Components

### Content publishing

- **Supabase content**
- [Content fetch](https://github.com/chanthornyoeun/portfolio/blob/master/scripts/fetch-content.ts): `scripts/fetch-content.ts`
- [Map and validate](https://github.com/chanthornyoeun/portfolio/blob/master/src/services/content.ts): `src/services/content.ts`
- [Supabase client](https://github.com/chanthornyoeun/portfolio/blob/master/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Content snapshot](https://github.com/chanthornyoeun/portfolio/blob/master/src/contexts/ContentContext.tsx): `src/contexts/ContentContext.tsx`
- [Portfolio data models](https://github.com/chanthornyoeun/portfolio/blob/master/src/data/projects.ts): `src/data/projects.ts`
- [Profile content](https://github.com/chanthornyoeun/portfolio/blob/master/src/data/profile.ts): `src/data/profile.ts`
- [Experience content](https://github.com/chanthornyoeun/portfolio/blob/master/src/data/experience.ts): `src/data/experience.ts`

### Portfolio pages

- [Page composition](https://github.com/chanthornyoeun/portfolio/blob/master/src/App.tsx): `src/App.tsx`
- [Navigation and theme](https://github.com/chanthornyoeun/portfolio/blob/master/src/components/Header.tsx): `src/components/Header.tsx`
- [Homepage sections](https://github.com/chanthornyoeun/portfolio/blob/master/src/components/Hero.tsx): `src/components/Hero.tsx`
- [Project listings](https://github.com/chanthornyoeun/portfolio/blob/master/src/components/Projects.tsx): `src/components/Projects.tsx`
- [Case studies](https://github.com/chanthornyoeun/portfolio/blob/master/src/components/ProjectDetail.tsx): `src/components/ProjectDetail.tsx`
- [Experience section](https://github.com/chanthornyoeun/portfolio/blob/master/src/components/Experience.tsx): `src/components/Experience.tsx`
- [Section layout](https://github.com/chanthornyoeun/portfolio/blob/master/src/components/Section.tsx): `src/components/Section.tsx`
- [Shared styles](https://github.com/chanthornyoeun/portfolio/blob/master/src/components/styles.ts): `src/components/styles.ts`

### Interactive runtime

- [Theme state](https://github.com/chanthornyoeun/portfolio/blob/master/src/contexts/ThemeContext.tsx): `src/contexts/ThemeContext.tsx`
- [Analytics consent](https://github.com/chanthornyoeun/portfolio/blob/master/src/components/ConsentBanner.tsx): `src/components/ConsentBanner.tsx`
- [Analytics events](https://github.com/chanthornyoeun/portfolio/blob/master/src/lib/analytics.ts): `src/lib/analytics.ts`
- **Google Analytics**
- [Reveal animation](https://github.com/chanthornyoeun/portfolio/blob/master/src/lib/reveal.ts): `src/lib/reveal.ts`

### Static rendering

- [Route matching](https://github.com/chanthornyoeun/portfolio/blob/master/src/routes.ts): `src/routes.ts`
- [HTML prerender](https://github.com/chanthornyoeun/portfolio/blob/master/scripts/prerender.ts): `scripts/prerender.ts`
- [Server render entry](https://github.com/chanthornyoeun/portfolio/blob/master/src/entry-server.tsx): `src/entry-server.tsx`
- [SEO metadata](https://github.com/chanthornyoeun/portfolio/blob/master/src/seo.ts): `src/seo.ts`
- **Static portfolio**

### Other components

- **Content editor**
- **Visitor**

## Connections

- Content editor → Supabase content: publishes content (evidence: `README.md`)
- Supabase content → Content fetch: provides rows (evidence: `README.md`)
- Content fetch → Map and validate: fetches and validates (evidence: `README.md`)
- Map and validate → Supabase client: resolves media (evidence: `src/services/content.ts`)
- Content fetch → Content snapshot: writes snapshot (evidence: `README.md`)
- Content snapshot → Page composition: supplies content (evidence: `README.md`)
- HTML prerender → Server render entry: renders pages (evidence: `README.md`)
- HTML prerender → Route matching: uses route definitions (evidence: `scripts/prerender.ts`)
- HTML prerender → SEO metadata: generates metadata (evidence: `scripts/prerender.ts`)
- HTML prerender → Static portfolio: writes static HTML (evidence: `README.md`)
- Server render entry → Page composition: renders app (evidence: `src/entry-server.tsx`)
- Server render entry → Route matching: selects route (evidence: `src/entry-server.tsx`)
- Visitor → Static portfolio: requests pages (evidence: `README.md`)
- Static portfolio → Page composition: hydrates (evidence: `README.md`)
- Page composition → Route matching: selects page (evidence: `src/App.tsx`)
- Page composition → Navigation and theme: renders (evidence: `src/App.tsx`)
- Page composition → Homepage sections: renders (evidence: `src/App.tsx`)
- Page composition → Project listings: renders (evidence: `src/App.tsx`)
- Page composition → Case studies: renders (evidence: `src/App.tsx`)
- Page composition → Experience section: renders (evidence: `src/App.tsx`)
- Navigation and theme → Theme state: toggles theme (evidence: `src/components/Header.tsx`)
- Navigation and theme → Analytics events: tracks navigation (evidence: `src/components/Header.tsx`)
- Page composition → Analytics consent: renders (evidence: `src/App.tsx`)
- Page composition → Analytics events: tracks page views (evidence: `src/App.tsx`)
- Analytics events → Google Analytics: loads after consent (evidence: `src/lib/analytics.ts`)
- Page composition → Reveal animation: starts animation (evidence: `src/App.tsx`)
- Project listings → Portfolio data models: uses project data (evidence: `src/components/Projects.tsx`)
- Case studies → Portfolio data models: uses project data (evidence: `src/components/ProjectDetail.tsx`)
- Homepage sections → Profile content: reads profile (evidence: `src/components/Hero.tsx`)
- Experience section → Experience content: reads experience (evidence: `src/components/Experience.tsx`)
- Project listings → Section layout: renders section (evidence: `src/components/Projects.tsx`)
- Experience section → Section layout: renders section (evidence: `src/components/Experience.tsx`)
- Section layout → Shared styles: uses layout styles (evidence: `src/components/Section.tsx`)
