# hngwu/portfolio architecture

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

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

## Overview

This is a Next.js portfolio with two connected product surfaces: public-facing interactive career/project content and an authenticated admin for editing tiles and detailed records, switching database providers, and synchronizing data. A typical visitor opens the bento portfolio, whose content is assembled from database records and rendered as tiles, then visits project or career-detail pages. The repository also includes distinct CV, education-map, skills-astrolabe, and mechanical-deity experiences. Admin action and storage links are based on excerpts; unsampled feature wiring is not inferred.

Main entry points: [`lib/db/index.ts`](https://github.com/hngwu/portfolio/blob/master/lib/db/index.ts) (Database access), [`app/page.tsx`](https://github.com/hngwu/portfolio/blob/master/app/page.tsx) (Portfolio home), [`components/detail/DetailShell.tsx`](https://github.com/hngwu/portfolio/blob/master/components/detail/DetailShell.tsx) (Detail shell), [`app/projects/page.tsx`](https://github.com/hngwu/portfolio/blob/master/app/projects/page.tsx) (Project listings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public portfolio"]
  node_home["Portfolio home<br/>[page.tsx]"]
  node_bento["Bento grid"]
  node_tile_render["Tile renderer<br/>[TileRenderer.tsx]"]
  node_projects["Project listings<br/>[page.tsx]"]
  node_project_detail["Project detail"]
  node_detail_shell["Detail shell<br/>[DetailShell.tsx]"]
  node_career_pages["Career pages<br/>[page.tsx]"]
end

subgraph group_experiences["Interactive experiences"]
  node_cv["CV dossier"]
  node_education["Education map<br/>[EducationMap.tsx]"]
  node_skills["Skills astrolabe"]
  node_deity["Mechanical deity"]
end

subgraph group_admin["Admin and editing"]
  node_admin_editor["Tile editor<br/>[page.tsx]"]
  node_tile_actions["Tile actions<br/>[tiles.ts]"]
  node_admin_auth["Admin sessions<br/>[session.ts]"]
  node_db_actions["Provider controls<br/>[database.ts]"]
  node_sync_modal["Database sync UI"]
  node_sync_actions["Sync actions<br/>[database-sync.ts]"]
end

subgraph group_data["Content and storage"]
  node_portfolio_data["Portfolio assembly<br/>[portfolio.ts]"]
  node_cv_docs["CV documents<br/>[documents.ts]"]
  node_db["Database access<br/>[index.ts]"]
  node_sqlite[("SQLite store<br/>[index.ts]")]
  node_supabase[("Supabase<br/>[supabase.ts]")]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_home
node_home -->|"renders"| node_bento
node_bento -->|"uses"| node_tile_render
node_home -->|"loads tiles"| node_db
node_portfolio_data -->|"loads records"| node_db
node_projects -->|"wraps page"| node_detail_shell
node_projects -->|"renders carousel"| node_project_detail
node_project_detail -->|"uses"| node_detail_shell
node_career_pages -->|"reads content"| node_portfolio_data
node_career_pages -.->|"presents detail"| node_detail_shell
node_cv -.->|"loads documents"| node_cv_docs
node_admin_editor -->|"loads and saves"| node_tile_actions
node_tile_actions -->|"accesses records"| node_db
node_admin_editor -->|"previews tiles"| node_tile_render
node_db_actions -->|"validates session"| node_admin_auth
node_db_actions -->|"switches provider"| node_db
node_sync_modal -->|"requests status"| node_sync_actions
node_sync_actions -->|"checks session"| node_admin_auth
node_db -->|"reads and writes"| node_sqlite
node_db -->|"delegates queries"| node_supabase

click node_home "https://github.com/hngwu/portfolio/blob/master/app/page.tsx"
click node_bento "https://github.com/hngwu/portfolio/blob/master/components/bento/ClientBentoGrid.tsx"
click node_tile_render "https://github.com/hngwu/portfolio/blob/master/components/bento/TileRenderer.tsx"
click node_projects "https://github.com/hngwu/portfolio/blob/master/app/projects/page.tsx"
click node_project_detail "https://github.com/hngwu/portfolio/blob/master/components/projects/ProjectDetailClient.tsx"
click node_detail_shell "https://github.com/hngwu/portfolio/blob/master/components/detail/DetailShell.tsx"
click node_career_pages "https://github.com/hngwu/portfolio/blob/master/app/experience/page.tsx"
click node_cv "https://github.com/hngwu/portfolio/blob/master/components/cv/CvDossierViewer.tsx"
click node_education "https://github.com/hngwu/portfolio/blob/master/components/education/EducationMap.tsx"
click node_skills "https://github.com/hngwu/portfolio/blob/master/components/skills/CelestialAstrolabe.tsx"
click node_deity "https://github.com/hngwu/portfolio/blob/master/components/deity/MechanicalDeityCenterpiece.tsx"
click node_portfolio_data "https://github.com/hngwu/portfolio/blob/master/lib/content/portfolio.ts"
click node_cv_docs "https://github.com/hngwu/portfolio/blob/master/lib/cv/documents.ts"
click node_db "https://github.com/hngwu/portfolio/blob/master/lib/db/index.ts"
click node_sqlite "https://github.com/hngwu/portfolio/blob/master/lib/db/index.ts"
click node_supabase "https://github.com/hngwu/portfolio/blob/master/lib/db/supabase.ts"
click node_admin_editor "https://github.com/hngwu/portfolio/blob/master/app/admin/(dashboard)/tiles/page.tsx"
click node_tile_actions "https://github.com/hngwu/portfolio/blob/master/app/actions/tiles.ts"
click node_admin_auth "https://github.com/hngwu/portfolio/blob/master/lib/auth/session.ts"
click node_db_actions "https://github.com/hngwu/portfolio/blob/master/app/actions/database.ts"
click node_sync_modal "https://github.com/hngwu/portfolio/blob/master/components/admin/DatabaseSyncModal.tsx"
click node_sync_actions "https://github.com/hngwu/portfolio/blob/master/app/actions/database-sync.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_home,node_bento,node_tile_render,node_projects,node_project_detail,node_detail_shell,node_career_pages toneBlue
class node_cv,node_education,node_skills,node_deity toneAmber
class node_admin_editor,node_tile_actions,node_admin_auth,node_db_actions,node_sync_modal,node_sync_actions toneMint
class node_portfolio_data,node_cv_docs,node_db,node_sqlite,node_supabase toneRose
class node_visitor toneIndigo
```

## Components

### Public portfolio

- [Portfolio home](https://github.com/hngwu/portfolio/blob/master/app/page.tsx): `app/page.tsx`
- [Bento grid](https://github.com/hngwu/portfolio/blob/master/components/bento/ClientBentoGrid.tsx): `components/bento/ClientBentoGrid.tsx`
- [Tile renderer](https://github.com/hngwu/portfolio/blob/master/components/bento/TileRenderer.tsx): `components/bento/TileRenderer.tsx`
- [Project listings](https://github.com/hngwu/portfolio/blob/master/app/projects/page.tsx): `app/projects/page.tsx`
- [Project detail](https://github.com/hngwu/portfolio/blob/master/components/projects/ProjectDetailClient.tsx): `components/projects/ProjectDetailClient.tsx`
- [Detail shell](https://github.com/hngwu/portfolio/blob/master/components/detail/DetailShell.tsx): `components/detail/DetailShell.tsx`
- [Career pages](https://github.com/hngwu/portfolio/blob/master/app/experience/page.tsx): `app/experience/page.tsx`

### Interactive experiences

- [CV dossier](https://github.com/hngwu/portfolio/blob/master/components/cv/CvDossierViewer.tsx): `components/cv/CvDossierViewer.tsx`
- [Education map](https://github.com/hngwu/portfolio/blob/master/components/education/EducationMap.tsx): `components/education/EducationMap.tsx`
- [Skills astrolabe](https://github.com/hngwu/portfolio/blob/master/components/skills/CelestialAstrolabe.tsx): `components/skills/CelestialAstrolabe.tsx`
- [Mechanical deity](https://github.com/hngwu/portfolio/blob/master/components/deity/MechanicalDeityCenterpiece.tsx): `components/deity/MechanicalDeityCenterpiece.tsx`

### Admin and editing

- [Tile editor](https://github.com/hngwu/portfolio/blob/master/app/admin/(dashboard)/tiles/page.tsx): `app/admin/(dashboard)/tiles/page.tsx`
- [Tile actions](https://github.com/hngwu/portfolio/blob/master/app/actions/tiles.ts): `app/actions/tiles.ts`
- [Admin sessions](https://github.com/hngwu/portfolio/blob/master/lib/auth/session.ts): `lib/auth/session.ts`
- [Provider controls](https://github.com/hngwu/portfolio/blob/master/app/actions/database.ts): `app/actions/database.ts`
- [Database sync UI](https://github.com/hngwu/portfolio/blob/master/components/admin/DatabaseSyncModal.tsx): `components/admin/DatabaseSyncModal.tsx`
- [Sync actions](https://github.com/hngwu/portfolio/blob/master/app/actions/database-sync.ts): `app/actions/database-sync.ts`

### Content and storage

- [Portfolio assembly](https://github.com/hngwu/portfolio/blob/master/lib/content/portfolio.ts): `lib/content/portfolio.ts`
- [CV documents](https://github.com/hngwu/portfolio/blob/master/lib/cv/documents.ts): `lib/cv/documents.ts`
- [Database access](https://github.com/hngwu/portfolio/blob/master/lib/db/index.ts): `lib/db/index.ts`
- [SQLite store](https://github.com/hngwu/portfolio/blob/master/lib/db/index.ts): `lib/db/index.ts`
- [Supabase](https://github.com/hngwu/portfolio/blob/master/lib/db/supabase.ts): `lib/db/supabase.ts`

### Other components

- **Visitor**

## Connections

- Visitor → Portfolio home: opens (evidence: `app/page.tsx`)
- Portfolio home → Bento grid: renders (evidence: `app/page.tsx`)
- Bento grid → Tile renderer: uses (evidence: `components/bento/ClientBentoGrid.tsx`)
- Portfolio home → Database access: loads tiles (evidence: `app/page.tsx`)
- Portfolio assembly → Database access: loads records (evidence: `lib/content/portfolio.ts`)
- Project listings → Detail shell: wraps page (evidence: `app/projects/page.tsx`)
- Project listings → Project detail: renders carousel (evidence: `app/projects/page.tsx`)
- Project detail → Detail shell: uses (evidence: `components/projects/ProjectDetailClient.tsx`)
- Career pages → Portfolio assembly: reads content (evidence: `app/experience/page.tsx`)
- Career pages → Detail shell: presents detail
- CV dossier → CV documents: loads documents
- Tile editor → Tile actions: loads and saves (evidence: `app/admin/(dashboard)/tiles/page.tsx`)
- Tile actions → Database access: accesses records (evidence: `app/actions/tiles.ts`)
- Tile editor → Tile renderer: previews tiles (evidence: `app/admin/(dashboard)/tiles/page.tsx`)
- Provider controls → Admin sessions: validates session (evidence: `app/actions/database.ts`)
- Provider controls → Database access: switches provider (evidence: `app/actions/database.ts`)
- Database sync UI → Sync actions: requests status (evidence: `components/admin/DatabaseSyncModal.tsx`)
- Sync actions → Admin sessions: checks session (evidence: `app/actions/database-sync.ts`)
- Database access → SQLite store: reads and writes (evidence: `lib/db/index.ts`)
- Database access → Supabase: delegates queries (evidence: `lib/db/index.ts`)
