# heng148/portfolio-v2 architecture

> Architecture diagram of the GitHub repository heng148/portfolio-v2, 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/heng148/portfolio-v2
- Repository: https://github.com/heng148/portfolio-v2

## Overview

This repository implements a personal portfolio with a private content-management dashboard. Visitors browse a composed portfolio, project details, and contact/footer content; an administrator signs in and edits portfolio sections, while image uploads go through Cloudinary and are recorded in Postgres. The README documents these product capabilities, but many dashboard pages and feature actions were not excerpted, so their internal calls are shown only as unverified dashed links. The graph omits unrelated projects described in the README because they are not present in this tree.

Main entry points: [`src/app/(home)/page.tsx`](https://github.com/heng148/portfolio-v2/blob/main/src/app/(home)/page.tsx) (Portfolio home), [`src/app/api/upload/route.ts`](https://github.com/heng148/portfolio-v2/blob/main/src/app/api/upload/route.ts) (Upload endpoint), [`src/lib/auth/auth.ts`](https://github.com/heng148/portfolio-v2/blob/main/src/lib/auth/auth.ts) (Better Auth setup), [`src/app/api/upload/[publicId]/route.ts`](https://github.com/heng148/portfolio-v2/blob/main/src/app/api/upload/%5BpublicId%5D/route.ts) (Delete upload endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public portfolio"]
  node_home["Portfolio home<br/>[page.tsx]"]
  node_hero["Hero<br/>[hero-section.tsx]"]
  node_about["About section"]
  node_experience["Experience section"]
  node_education["Education section"]
  node_projects["Project listing<br/>[projectSection.tsx]"]
  node_skills["Skills section<br/>[skills-section.tsx]"]
  node_projectdetail["Project detail<br/>[page.tsx]"]
  node_markdown["Markdown renderer"]
  node_footer["Contact footer<br/>[footer.tsx]"]
  node_sidebar["File-tree sidebar"]
  node_metadata["Metadata builder<br/>[metadata.ts]"]
  node_carousel["Image carousel<br/>[Image-Carousel.tsx]"]
  node_taglist["Tag list<br/>[tag-list.tsx]"]
end

subgraph group_admin["Admin content"]
  node_login["Sign-in page<br/>[page.tsx]"]
  node_dashboard["Admin dashboard<br/>[page.tsx]"]
  node_contentadmin["Content management"]
  node_aboutclient["About presentation"]
  node_experienceaction["Experience actions<br/>[experience.ts]"]
  node_experiencecard["Experience card<br/>[ExperienceCard.tsx]"]
  node_projectaction["Project actions<br/>[projects.ts]"]
  node_deleteui["Delete control<br/>[delete.tsx]"]
end

subgraph group_media["Auth and media"]
  node_authapi["Auth API route<br/>[route.ts]"]
  node_auth["Better Auth setup<br/>[auth.ts]"]
  node_authguard["Action auth guard<br/>[auth.middleware.ts]"]
  node_uploadapi["Upload endpoint<br/>[route.ts]"]
  node_deleteupload["Delete upload endpoint<br/>[route.ts]"]
  node_cloudinary["Cloudinary client<br/>[cloudinary.ts]"]
  node_uploader["Media upload UI<br/>[media-upload.tsx]"]
end

subgraph group_data["Persistence"]
  node_database[("Neon Postgres access<br/>[index.ts]")]
  node_schema["Drizzle schema<br/>[schema.ts]"]
  node_uploadtable["Media table<br/>[upload.table.ts]"]
end

node_visitor(("Visitor"))
node_admin(("Administrator"))

node_visitor -->|"browses"| node_home
node_home -->|"renders"| node_hero
node_home -->|"renders"| node_about
node_home -->|"renders"| node_experience
node_home -->|"renders"| node_education
node_home -->|"renders"| node_projects
node_home -->|"renders"| node_skills
node_home -->|"builds metadata"| node_metadata
node_about -->|"uses"| node_aboutclient
node_aboutclient -->|"renders"| node_carousel
node_aboutclient -->|"renders"| node_taglist
node_visitor -->|"opens project"| node_projectdetail
node_projectdetail -->|"renders write-up"| node_markdown
node_visitor -->|"views contact"| node_footer
node_home -->|"includes sidebar"| node_sidebar
node_admin -->|"signs in"| node_login
node_admin -->|"manages content"| node_dashboard
node_dashboard -.->|"opens sections"| node_contentadmin
node_contentadmin -.->|"updates experience"| node_experienceaction
node_experience -->|"renders cards"| node_experiencecard
node_contentadmin -.->|"updates projects"| node_projectaction
node_contentadmin -.->|"offers deletion"| node_deleteui
node_login -.->|"authenticates via"| node_authapi
node_authapi -.->|"dispatches to"| node_auth
node_authguard -->|"checks session"| node_auth
node_uploader -.->|"uploads media"| node_uploadapi
node_uploadapi -->|"checks session"| node_auth
node_uploadapi -->|"uploads image"| node_cloudinary
node_uploadapi -->|"inserts media"| node_database
node_uploadapi -->|"writes row"| node_uploadtable
node_deleteupload -->|"checks session"| node_auth
node_deleteupload -->|"deletes image"| node_cloudinary
node_deleteupload -->|"deletes row"| node_database
node_deleteupload -->|"deletes media"| node_uploadtable
node_database -->|"configures ORM"| node_schema
node_schema -->|"includes table"| node_uploadtable
node_auth -->|"uses database"| node_database

click node_home "https://github.com/heng148/portfolio-v2/blob/main/src/app/(home)/page.tsx"
click node_hero "https://github.com/heng148/portfolio-v2/blob/main/src/features/hero/components/hero-section.tsx"
click node_about "https://github.com/heng148/portfolio-v2/blob/main/src/features/about/components/about-section-client.tsx"
click node_experience "https://github.com/heng148/portfolio-v2/blob/main/src/features/experience/components/Experience-client.tsx"
click node_education "https://github.com/heng148/portfolio-v2/blob/main/src/features/education/components/education-section.tsx"
click node_projects "https://github.com/heng148/portfolio-v2/blob/main/src/features/projects/components/projectSection.tsx"
click node_skills "https://github.com/heng148/portfolio-v2/blob/main/src/features/skills/components/skills-section.tsx"
click node_projectdetail "https://github.com/heng148/portfolio-v2/blob/main/src/app/projects/%5BprojectId%5D/page.tsx"
click node_markdown "https://github.com/heng148/portfolio-v2/blob/main/src/components/markdown-content.tsx"
click node_footer "https://github.com/heng148/portfolio-v2/blob/main/src/components/footer.tsx"
click node_sidebar "https://github.com/heng148/portfolio-v2/blob/main/src/features/sidebar/components/sidebar-components.tsx"
click node_login "https://github.com/heng148/portfolio-v2/blob/main/src/app/login/page.tsx"
click node_dashboard "https://github.com/heng148/portfolio-v2/blob/main/src/app/dashboard/page.tsx"
click node_contentadmin "https://github.com/heng148/portfolio-v2/tree/main/src/app/dashboard"
click node_aboutclient "https://github.com/heng148/portfolio-v2/blob/main/src/features/about/components/about-section-client.tsx"
click node_experienceaction "https://github.com/heng148/portfolio-v2/blob/main/src/features/experience/action/experience.ts"
click node_experiencecard "https://github.com/heng148/portfolio-v2/blob/main/src/features/experience/components/ExperienceCard.tsx"
click node_projectaction "https://github.com/heng148/portfolio-v2/blob/main/src/features/projects/action/projects.ts"
click node_deleteui "https://github.com/heng148/portfolio-v2/blob/main/src/components/ui/delete.tsx"
click node_authapi "https://github.com/heng148/portfolio-v2/blob/main/src/app/api/auth/%5B...all%5D/route.ts"
click node_auth "https://github.com/heng148/portfolio-v2/blob/main/src/lib/auth/auth.ts"
click node_authguard "https://github.com/heng148/portfolio-v2/blob/main/src/middleware/auth.middleware.ts"
click node_uploadapi "https://github.com/heng148/portfolio-v2/blob/main/src/app/api/upload/route.ts"
click node_deleteupload "https://github.com/heng148/portfolio-v2/blob/main/src/app/api/upload/%5BpublicId%5D/route.ts"
click node_cloudinary "https://github.com/heng148/portfolio-v2/blob/main/src/lib/cloudinary.ts"
click node_uploader "https://github.com/heng148/portfolio-v2/blob/main/src/components/upload/media-upload.tsx"
click node_database "https://github.com/heng148/portfolio-v2/blob/main/src/db/index.ts"
click node_schema "https://github.com/heng148/portfolio-v2/blob/main/src/db/schema.ts"
click node_uploadtable "https://github.com/heng148/portfolio-v2/blob/main/src/db/table/upload.table.ts"
click node_metadata "https://github.com/heng148/portfolio-v2/blob/main/src/lib/metadata.ts"
click node_carousel "https://github.com/heng148/portfolio-v2/blob/main/src/components/Image-Carousel.tsx"
click node_taglist "https://github.com/heng148/portfolio-v2/blob/main/src/components/tag-list.tsx"

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_hero,node_about,node_experience,node_education,node_projects,node_skills,node_projectdetail,node_markdown,node_footer,node_sidebar,node_metadata,node_carousel,node_taglist toneBlue
class node_login,node_dashboard,node_contentadmin,node_aboutclient,node_experienceaction,node_experiencecard,node_projectaction,node_deleteui toneAmber
class node_authapi,node_auth,node_authguard,node_uploadapi,node_deleteupload,node_cloudinary,node_uploader toneMint
class node_database,node_schema,node_uploadtable toneRose
class node_visitor,node_admin toneIndigo
```

## Components

### Public portfolio

- [Portfolio home](https://github.com/heng148/portfolio-v2/blob/main/src/app/(home)/page.tsx): `src/app/(home)/page.tsx`
- [Hero](https://github.com/heng148/portfolio-v2/blob/main/src/features/hero/components/hero-section.tsx): `src/features/hero/components/hero-section.tsx`
- [About section](https://github.com/heng148/portfolio-v2/blob/main/src/features/about/components/about-section-client.tsx): `src/features/about/components/about-section-client.tsx`
- [Experience section](https://github.com/heng148/portfolio-v2/blob/main/src/features/experience/components/Experience-client.tsx): `src/features/experience/components/Experience-client.tsx`
- [Education section](https://github.com/heng148/portfolio-v2/blob/main/src/features/education/components/education-section.tsx): `src/features/education/components/education-section.tsx`
- [Project listing](https://github.com/heng148/portfolio-v2/blob/main/src/features/projects/components/projectSection.tsx): `src/features/projects/components/projectSection.tsx`
- [Skills section](https://github.com/heng148/portfolio-v2/blob/main/src/features/skills/components/skills-section.tsx): `src/features/skills/components/skills-section.tsx`
- [Project detail](https://github.com/heng148/portfolio-v2/blob/main/src/app/projects/%5BprojectId%5D/page.tsx): `src/app/projects/[projectId]/page.tsx`
- [Markdown renderer](https://github.com/heng148/portfolio-v2/blob/main/src/components/markdown-content.tsx): `src/components/markdown-content.tsx`
- [Contact footer](https://github.com/heng148/portfolio-v2/blob/main/src/components/footer.tsx): `src/components/footer.tsx`
- [File-tree sidebar](https://github.com/heng148/portfolio-v2/blob/main/src/features/sidebar/components/sidebar-components.tsx): `src/features/sidebar/components/sidebar-components.tsx`
- [Metadata builder](https://github.com/heng148/portfolio-v2/blob/main/src/lib/metadata.ts): `src/lib/metadata.ts`
- [Image carousel](https://github.com/heng148/portfolio-v2/blob/main/src/components/Image-Carousel.tsx): `src/components/Image-Carousel.tsx`
- [Tag list](https://github.com/heng148/portfolio-v2/blob/main/src/components/tag-list.tsx): `src/components/tag-list.tsx`

### Admin content

- [Sign-in page](https://github.com/heng148/portfolio-v2/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Admin dashboard](https://github.com/heng148/portfolio-v2/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Content management](https://github.com/heng148/portfolio-v2/tree/main/src/app/dashboard): `src/app/dashboard`
- [About presentation](https://github.com/heng148/portfolio-v2/blob/main/src/features/about/components/about-section-client.tsx): `src/features/about/components/about-section-client.tsx`
- [Experience actions](https://github.com/heng148/portfolio-v2/blob/main/src/features/experience/action/experience.ts): `src/features/experience/action/experience.ts`
- [Experience card](https://github.com/heng148/portfolio-v2/blob/main/src/features/experience/components/ExperienceCard.tsx): `src/features/experience/components/ExperienceCard.tsx`
- [Project actions](https://github.com/heng148/portfolio-v2/blob/main/src/features/projects/action/projects.ts): `src/features/projects/action/projects.ts`
- [Delete control](https://github.com/heng148/portfolio-v2/blob/main/src/components/ui/delete.tsx): `src/components/ui/delete.tsx`

### Auth and media

- [Auth API route](https://github.com/heng148/portfolio-v2/blob/main/src/app/api/auth/%5B...all%5D/route.ts): `src/app/api/auth/[...all]/route.ts`
- [Better Auth setup](https://github.com/heng148/portfolio-v2/blob/main/src/lib/auth/auth.ts): `src/lib/auth/auth.ts`
- [Action auth guard](https://github.com/heng148/portfolio-v2/blob/main/src/middleware/auth.middleware.ts): `src/middleware/auth.middleware.ts`
- [Upload endpoint](https://github.com/heng148/portfolio-v2/blob/main/src/app/api/upload/route.ts): `src/app/api/upload/route.ts`
- [Delete upload endpoint](https://github.com/heng148/portfolio-v2/blob/main/src/app/api/upload/%5BpublicId%5D/route.ts): `src/app/api/upload/[publicId]/route.ts`
- [Cloudinary client](https://github.com/heng148/portfolio-v2/blob/main/src/lib/cloudinary.ts): `src/lib/cloudinary.ts`
- [Media upload UI](https://github.com/heng148/portfolio-v2/blob/main/src/components/upload/media-upload.tsx): `src/components/upload/media-upload.tsx`

### Persistence

- [Neon Postgres access](https://github.com/heng148/portfolio-v2/blob/main/src/db/index.ts): `src/db/index.ts`
- [Drizzle schema](https://github.com/heng148/portfolio-v2/blob/main/src/db/schema.ts): `src/db/schema.ts`
- [Media table](https://github.com/heng148/portfolio-v2/blob/main/src/db/table/upload.table.ts): `src/db/table/upload.table.ts`

### Other components

- **Visitor**
- **Administrator**

## Connections

- Visitor → Portfolio home: browses
- Portfolio home → Hero: renders (evidence: `src/app/(home)/page.tsx`)
- Portfolio home → About section: renders (evidence: `src/app/(home)/page.tsx`)
- Portfolio home → Experience section: renders (evidence: `src/app/(home)/page.tsx`)
- Portfolio home → Education section: renders (evidence: `src/app/(home)/page.tsx`)
- Portfolio home → Project listing: renders (evidence: `src/app/(home)/page.tsx`)
- Portfolio home → Skills section: renders (evidence: `src/app/(home)/page.tsx`)
- Portfolio home → Metadata builder: builds metadata (evidence: `src/app/(home)/page.tsx`)
- About section → About presentation: uses (evidence: `src/features/about/components/about-section-client.tsx`)
- About presentation → Image carousel: renders (evidence: `src/features/about/components/about-section-client.tsx`)
- About presentation → Tag list: renders (evidence: `src/features/about/components/about-section-client.tsx`)
- Visitor → Project detail: opens project
- Project detail → Markdown renderer: renders write-up (evidence: `src/app/projects/[projectId]/page.tsx`)
- Visitor → Contact footer: views contact
- Portfolio home → File-tree sidebar: includes sidebar (evidence: `src/app/(home)/page.tsx`)
- Administrator → Sign-in page: signs in
- Administrator → Admin dashboard: manages content
- Admin dashboard → Content management: opens sections
- Content management → Experience actions: updates experience (evidence: `src/app/dashboard/experience/page.tsx`)
- Experience section → Experience card: renders cards (evidence: `src/features/experience/components/Experience-client.tsx`)
- Content management → Project actions: updates projects
- Content management → Delete control: offers deletion (evidence: `src/app/dashboard/experience/page.tsx`)
- Sign-in page → Auth API route: authenticates via
- Auth API route → Better Auth setup: dispatches to
- Action auth guard → Better Auth setup: checks session (evidence: `src/middleware/auth.middleware.ts`)
- Media upload UI → Upload endpoint: uploads media
- Upload endpoint → Better Auth setup: checks session (evidence: `src/app/api/upload/route.ts`)
- Upload endpoint → Cloudinary client: uploads image (evidence: `src/app/api/upload/route.ts`)
- Upload endpoint → Neon Postgres access: inserts media (evidence: `src/app/api/upload/route.ts`)
- Upload endpoint → Media table: writes row (evidence: `src/app/api/upload/route.ts`)
- Delete upload endpoint → Better Auth setup: checks session (evidence: `src/app/api/upload/[publicId]/route.ts`)
- Delete upload endpoint → Cloudinary client: deletes image (evidence: `src/app/api/upload/[publicId]/route.ts`)
- Delete upload endpoint → Neon Postgres access: deletes row (evidence: `src/app/api/upload/[publicId]/route.ts`)
- Delete upload endpoint → Media table: deletes media (evidence: `src/app/api/upload/[publicId]/route.ts`)
- Neon Postgres access → Drizzle schema: configures ORM (evidence: `src/db/index.ts`)
- Drizzle schema → Media table: includes table (evidence: `src/db/schema.ts`)
- Better Auth setup → Neon Postgres access: uses database (evidence: `src/lib/auth/auth.ts`)
