# tarun-suthar-04/portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/tarun-suthar-04/portfolio
- Repository: https://github.com/tarun-suthar-04/portfolio

## Overview

Tarun / Visual Works is a Next.js portfolio with a public, filterable work gallery and shareable work viewers, plus an authenticated admin workflow for creating and managing portfolio content. Public pages fetch published works and categories through a data layer, which can use Supabase or development-only mock data. Admins authenticate, edit work and categories, publish entries, and upload media to Cloudinary with metadata managed through server actions. The README documents SEO routes and admin registration; those branches are shown where supported, while unsampled implementations and their internal connections are not inferred.

Main entry points: [`app/admin/actions.ts`](https://github.com/tarun-suthar-04/portfolio/blob/main/app/admin/actions.ts) (Server actions), [`lib/data/works.ts`](https://github.com/tarun-suthar-04/portfolio/blob/main/lib/data/works.ts) (Published work data), [`lib/supabase/server.ts`](https://github.com/tarun-suthar-04/portfolio/blob/main/lib/supabase/server.ts) (Supabase database), [`app/(public)/page.tsx`](https://github.com/tarun-suthar-04/portfolio/blob/main/app/(public)/page.tsx) (Gallery route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public portfolio"]
  node_gallery["Gallery route<br/>[page.tsx]"]
  node_viewer_page["Work detail route<br/>[page.tsx]"]
  node_modal_route["Modal work route<br/>[page.tsx]"]
  node_seo_routes["SEO routes<br/>[sitemap.ts]"]
end

subgraph group_admin["Admin management"]
  node_auth["Admin authentication<br/>[auth.ts]"]
  node_admin_login["Admin sign-in<br/>[page.tsx]"]
  node_admin_register["Admin registration<br/>[RegisterForm.tsx]"]
  node_work_admin["Work management<br/>[WorkForm.tsx]"]
  node_work_list["Work list<br/>[WorkList.tsx]"]
  node_category_admin["Category management"]
  node_admin_actions["Server actions<br/>[actions.ts]"]
  node_media_upload["Media uploader<br/>[MediaUploader.tsx]"]
end

subgraph group_data["Data and services"]
  node_work_data["Published work data<br/>[works.ts]"]
  node_category_data["Category data<br/>[categories.ts]"]
  node_mock_data["Development sample data<br/>[mockWorks.ts]"]
  node_supabase[("Supabase database<br/>[server.ts]")]
  node_admin_works_data["Admin work data<br/>[adminWorks.ts]"]
  node_cloudinary_sign["Upload signing<br/>[sign.ts]"]
  node_cloudinary[("Cloudinary media")]
  node_domain_types["Work and media types<br/>[work.ts]"]
end

subgraph group_shared["Shared presentation"]
  node_gallery_ui["Gallery controls<br/>[CategoryFilter.tsx]"]
  node_masonry["Masonry gallery<br/>[MasonryGrid.tsx]"]
  node_gallery_card["Work card<br/>[GalleryCard.tsx]"]
  node_video_preview["Video preview<br/>[GalleryVideo.tsx]"]
  node_viewer_modal["Viewer modal<br/>[ViewerModal.tsx]"]
  node_work_content["Work viewer<br/>[WorkContent.tsx]"]
  node_related_work["Related works<br/>[RelatedWork.tsx]"]
  node_media_frame["Media renderer<br/>[MediaFrame.tsx]"]
  node_keyboard_nav["Keyboard navigation"]
end

node_visitor(("Visitor"))
node_admin_actor(("Administrator"))

node_visitor -->|"opens"| node_gallery
node_gallery -->|"loads works"| node_work_data
node_gallery -->|"loads categories"| node_category_data
node_gallery -->|"renders"| node_gallery_ui
node_gallery -->|"renders"| node_masonry
node_masonry -->|"renders cards"| node_gallery_card
node_gallery_card -.->|"previews video"| node_video_preview
node_visitor -->|"opens link"| node_viewer_page
node_visitor -->|"opens from gallery"| node_modal_route
node_viewer_page -->|"loads work"| node_work_data
node_viewer_page -->|"renders"| node_work_content
node_viewer_page -->|"renders"| node_related_work
node_modal_route -->|"loads work"| node_work_data
node_modal_route -->|"renders"| node_viewer_modal
node_modal_route -->|"renders"| node_work_content
node_modal_route -->|"renders"| node_related_work
node_work_content -->|"renders media"| node_media_frame
node_work_content -->|"renders"| node_keyboard_nav
node_work_data -->|"queries"| node_supabase
node_work_data -->|"uses in development"| node_mock_data
node_category_data -.->|"queries"| node_supabase
node_category_data -.->|"uses fallback"| node_mock_data
node_admin_actor -->|"signs in"| node_admin_login
node_admin_actor -->|"registers"| node_admin_register
node_admin_login -->|"invokes"| node_admin_actions
node_admin_register -->|"invokes"| node_admin_actions
node_admin_actor -.->|"manages works"| node_work_admin
node_work_admin -->|"submits changes"| node_admin_actions
node_work_list -->|"changes status"| node_admin_actions
node_work_list -.->|"receives entries"| node_admin_works_data
node_admin_works_data -->|"queries"| node_supabase
node_category_admin -->|"invokes category actions"| node_admin_actions
node_media_upload -->|"requests signature"| node_cloudinary_sign
node_media_upload -.->|"uploads files"| node_cloudinary
node_media_upload -->|"saves metadata"| node_admin_actions
node_admin_actions -->|"authenticates and writes"| node_supabase
node_cloudinary_sign -.->|"checks admin session"| node_supabase
node_seo_routes -.->|"accesses client"| node_supabase
node_work_data -->|"maps domain records"| node_domain_types
node_work_content -->|"renders typed work"| node_domain_types

click node_gallery "https://github.com/tarun-suthar-04/portfolio/blob/main/app/(public)/page.tsx"
click node_gallery_ui "https://github.com/tarun-suthar-04/portfolio/blob/main/components/gallery/CategoryFilter.tsx"
click node_masonry "https://github.com/tarun-suthar-04/portfolio/blob/main/components/gallery/MasonryGrid.tsx"
click node_gallery_card "https://github.com/tarun-suthar-04/portfolio/blob/main/components/gallery/GalleryCard.tsx"
click node_video_preview "https://github.com/tarun-suthar-04/portfolio/blob/main/components/gallery/GalleryVideo.tsx"
click node_viewer_page "https://github.com/tarun-suthar-04/portfolio/blob/main/app/(public)/work/%5Bslug%5D/page.tsx"
click node_modal_route "https://github.com/tarun-suthar-04/portfolio/blob/main/app/(public)/%40modal/(.)work/%5Bslug%5D/page.tsx"
click node_viewer_modal "https://github.com/tarun-suthar-04/portfolio/blob/main/components/viewer/ViewerModal.tsx"
click node_work_content "https://github.com/tarun-suthar-04/portfolio/blob/main/components/viewer/WorkContent.tsx"
click node_related_work "https://github.com/tarun-suthar-04/portfolio/blob/main/components/viewer/RelatedWork.tsx"
click node_media_frame "https://github.com/tarun-suthar-04/portfolio/blob/main/components/gallery/MediaFrame.tsx"
click node_keyboard_nav "https://github.com/tarun-suthar-04/portfolio/blob/main/components/viewer/WorkKeyboardNav.tsx"
click node_work_data "https://github.com/tarun-suthar-04/portfolio/blob/main/lib/data/works.ts"
click node_category_data "https://github.com/tarun-suthar-04/portfolio/blob/main/lib/data/categories.ts"
click node_mock_data "https://github.com/tarun-suthar-04/portfolio/blob/main/lib/data/mockWorks.ts"
click node_supabase "https://github.com/tarun-suthar-04/portfolio/blob/main/lib/supabase/server.ts"
click node_auth "https://github.com/tarun-suthar-04/portfolio/blob/main/lib/auth.ts"
click node_admin_login "https://github.com/tarun-suthar-04/portfolio/blob/main/app/admin/login/page.tsx"
click node_admin_register "https://github.com/tarun-suthar-04/portfolio/blob/main/app/admin/register/RegisterForm.tsx"
click node_work_admin "https://github.com/tarun-suthar-04/portfolio/blob/main/app/admin/(protected)/works/WorkForm.tsx"
click node_work_list "https://github.com/tarun-suthar-04/portfolio/blob/main/components/admin/WorkList.tsx"
click node_admin_works_data "https://github.com/tarun-suthar-04/portfolio/blob/main/lib/data/adminWorks.ts"
click node_category_admin "https://github.com/tarun-suthar-04/portfolio/blob/main/app/admin/(protected)/categories/CategoryManager.tsx"
click node_admin_actions "https://github.com/tarun-suthar-04/portfolio/blob/main/app/admin/actions.ts"
click node_media_upload "https://github.com/tarun-suthar-04/portfolio/blob/main/components/admin/MediaUploader.tsx"
click node_cloudinary_sign "https://github.com/tarun-suthar-04/portfolio/blob/main/lib/cloudinary/sign.ts"
click node_seo_routes "https://github.com/tarun-suthar-04/portfolio/blob/main/app/sitemap.ts"
click node_domain_types "https://github.com/tarun-suthar-04/portfolio/blob/main/types/work.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_gallery,node_viewer_page,node_modal_route,node_seo_routes toneBlue
class node_auth,node_admin_login,node_admin_register,node_work_admin,node_work_list,node_category_admin,node_admin_actions,node_media_upload toneAmber
class node_work_data,node_category_data,node_mock_data,node_supabase,node_admin_works_data,node_cloudinary_sign,node_cloudinary,node_domain_types toneMint
class node_gallery_ui,node_masonry,node_gallery_card,node_video_preview,node_viewer_modal,node_work_content,node_related_work,node_media_frame,node_keyboard_nav toneRose
class node_visitor,node_admin_actor toneIndigo
```

## Components

### Public portfolio

- [Gallery route](https://github.com/tarun-suthar-04/portfolio/blob/main/app/(public)/page.tsx): `app/(public)/page.tsx`
- [Work detail route](https://github.com/tarun-suthar-04/portfolio/blob/main/app/(public)/work/%5Bslug%5D/page.tsx): `app/(public)/work/[slug]/page.tsx`
- [Modal work route](https://github.com/tarun-suthar-04/portfolio/blob/main/app/(public)/%40modal/(.)work/%5Bslug%5D/page.tsx): `app/(public)/@modal/(.)work/[slug]/page.tsx`
- [SEO routes](https://github.com/tarun-suthar-04/portfolio/blob/main/app/sitemap.ts): `app/sitemap.ts`

### Admin management

- [Admin authentication](https://github.com/tarun-suthar-04/portfolio/blob/main/lib/auth.ts): `lib/auth.ts`
- [Admin sign-in](https://github.com/tarun-suthar-04/portfolio/blob/main/app/admin/login/page.tsx): `app/admin/login/page.tsx`
- [Admin registration](https://github.com/tarun-suthar-04/portfolio/blob/main/app/admin/register/RegisterForm.tsx): `app/admin/register/RegisterForm.tsx`
- [Work management](https://github.com/tarun-suthar-04/portfolio/blob/main/app/admin/(protected)/works/WorkForm.tsx): `app/admin/(protected)/works/WorkForm.tsx`
- [Work list](https://github.com/tarun-suthar-04/portfolio/blob/main/components/admin/WorkList.tsx): `components/admin/WorkList.tsx`
- [Category management](https://github.com/tarun-suthar-04/portfolio/blob/main/app/admin/(protected)/categories/CategoryManager.tsx): `app/admin/(protected)/categories/CategoryManager.tsx`
- [Server actions](https://github.com/tarun-suthar-04/portfolio/blob/main/app/admin/actions.ts): `app/admin/actions.ts`
- [Media uploader](https://github.com/tarun-suthar-04/portfolio/blob/main/components/admin/MediaUploader.tsx): `components/admin/MediaUploader.tsx`

### Data and services

- [Published work data](https://github.com/tarun-suthar-04/portfolio/blob/main/lib/data/works.ts): `lib/data/works.ts`
- [Category data](https://github.com/tarun-suthar-04/portfolio/blob/main/lib/data/categories.ts): `lib/data/categories.ts`
- [Development sample data](https://github.com/tarun-suthar-04/portfolio/blob/main/lib/data/mockWorks.ts): `lib/data/mockWorks.ts`
- [Supabase database](https://github.com/tarun-suthar-04/portfolio/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`
- [Admin work data](https://github.com/tarun-suthar-04/portfolio/blob/main/lib/data/adminWorks.ts): `lib/data/adminWorks.ts`
- [Upload signing](https://github.com/tarun-suthar-04/portfolio/blob/main/lib/cloudinary/sign.ts): `lib/cloudinary/sign.ts`
- **Cloudinary media**
- [Work and media types](https://github.com/tarun-suthar-04/portfolio/blob/main/types/work.ts): `types/work.ts`

### Shared presentation

- [Gallery controls](https://github.com/tarun-suthar-04/portfolio/blob/main/components/gallery/CategoryFilter.tsx): `components/gallery/CategoryFilter.tsx`
- [Masonry gallery](https://github.com/tarun-suthar-04/portfolio/blob/main/components/gallery/MasonryGrid.tsx): `components/gallery/MasonryGrid.tsx`
- [Work card](https://github.com/tarun-suthar-04/portfolio/blob/main/components/gallery/GalleryCard.tsx): `components/gallery/GalleryCard.tsx`
- [Video preview](https://github.com/tarun-suthar-04/portfolio/blob/main/components/gallery/GalleryVideo.tsx): `components/gallery/GalleryVideo.tsx`
- [Viewer modal](https://github.com/tarun-suthar-04/portfolio/blob/main/components/viewer/ViewerModal.tsx): `components/viewer/ViewerModal.tsx`
- [Work viewer](https://github.com/tarun-suthar-04/portfolio/blob/main/components/viewer/WorkContent.tsx): `components/viewer/WorkContent.tsx`
- [Related works](https://github.com/tarun-suthar-04/portfolio/blob/main/components/viewer/RelatedWork.tsx): `components/viewer/RelatedWork.tsx`
- [Media renderer](https://github.com/tarun-suthar-04/portfolio/blob/main/components/gallery/MediaFrame.tsx): `components/gallery/MediaFrame.tsx`
- [Keyboard navigation](https://github.com/tarun-suthar-04/portfolio/blob/main/components/viewer/WorkKeyboardNav.tsx): `components/viewer/WorkKeyboardNav.tsx`

### Other components

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

## Connections

- Visitor → Gallery route: opens (evidence: `app/(public)/page.tsx`)
- Gallery route → Published work data: loads works (evidence: `app/(public)/page.tsx`)
- Gallery route → Category data: loads categories (evidence: `app/(public)/page.tsx`)
- Gallery route → Gallery controls: renders (evidence: `app/(public)/page.tsx`)
- Gallery route → Masonry gallery: renders (evidence: `app/(public)/page.tsx`)
- Masonry gallery → Work card: renders cards (evidence: `components/gallery/MasonryGrid.tsx`)
- Work card → Video preview: previews video
- Visitor → Work detail route: opens link (evidence: `app/(public)/work/[slug]/page.tsx`)
- Visitor → Modal work route: opens from gallery (evidence: `app/(public)/@modal/(.)work/[slug]/page.tsx`)
- Work detail route → Published work data: loads work (evidence: `app/(public)/work/[slug]/page.tsx`)
- Work detail route → Work viewer: renders (evidence: `app/(public)/work/[slug]/page.tsx`)
- Work detail route → Related works: renders (evidence: `app/(public)/work/[slug]/page.tsx`)
- Modal work route → Published work data: loads work (evidence: `app/(public)/@modal/(.)work/[slug]/page.tsx`)
- Modal work route → Viewer modal: renders (evidence: `app/(public)/@modal/(.)work/[slug]/page.tsx`)
- Modal work route → Work viewer: renders (evidence: `app/(public)/@modal/(.)work/[slug]/page.tsx`)
- Modal work route → Related works: renders (evidence: `app/(public)/@modal/(.)work/[slug]/page.tsx`)
- Work viewer → Media renderer: renders media (evidence: `components/viewer/WorkContent.tsx`)
- Work viewer → Keyboard navigation: renders (evidence: `components/viewer/WorkContent.tsx`)
- Published work data → Supabase database: queries (evidence: `lib/data/works.ts`)
- Published work data → Development sample data: uses in development (evidence: `lib/data/works.ts`)
- Category data → Supabase database: queries (evidence: `lib/data/categories.ts`)
- Category data → Development sample data: uses fallback (evidence: `lib/data/categories.ts`)
- Administrator → Admin sign-in: signs in (evidence: `app/admin/login/page.tsx`)
- Administrator → Admin registration: registers (evidence: `app/admin/register/RegisterForm.tsx`)
- Admin sign-in → Server actions: invokes (evidence: `app/admin/login/page.tsx`)
- Admin registration → Server actions: invokes (evidence: `app/admin/register/RegisterForm.tsx`)
- Administrator → Work management: manages works
- Work management → Server actions: submits changes (evidence: `app/admin/(protected)/works/WorkForm.tsx`)
- Work list → Server actions: changes status (evidence: `components/admin/WorkList.tsx`)
- Work list → Admin work data: receives entries
- Admin work data → Supabase database: queries (evidence: `lib/data/adminWorks.ts`)
- Category management → Server actions: invokes category actions (evidence: `app/admin/(protected)/categories/CategoryManager.tsx`)
- Media uploader → Upload signing: requests signature (evidence: `components/admin/MediaUploader.tsx`)
- Media uploader → Cloudinary media: uploads files
- Media uploader → Server actions: saves metadata (evidence: `components/admin/MediaUploader.tsx`)
- Server actions → Supabase database: authenticates and writes (evidence: `app/admin/actions.ts`)
- Upload signing → Supabase database: checks admin session (evidence: `lib/cloudinary/sign.ts`)
- SEO routes → Supabase database: accesses client (evidence: `app/sitemap.ts`)
- Published work data → Work and media types: maps domain records (evidence: `lib/data/works.ts`)
- Work viewer → Work and media types: renders typed work (evidence: `components/viewer/WorkContent.tsx`)
