# naufaladityaakbar/ghbc_web_app architecture

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

- Interactive diagram: https://gitdiagram.com/naufaladityaakbar/ghbc_web_app
- Repository: https://github.com/naufaladityaakbar/ghbc_web_app

## Overview

This is a Next.js social/community app with authentication, a post feed, comments, profiles, saved posts, notifications, search, events, and messaging. Its principal workflow is session-aware use of the feed and related social features through API routes and server-side domain helpers. The graph includes the main visible domain branches and the shared database layer. Several page and API implementations were not sampled, so some UI-to-API links are omitted rather than inferred.

Main entry points: [`src/lib/prisma.ts`](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/prisma.ts) (Prisma client), [`src/lib/auth.ts`](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/auth.ts) (Token and passwords), [`src/app/api/comment`](https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/api/comment) (Comment endpoints), [`src/app/api/notification`](https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/api/notification) (Notification endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web experience"]
  node_mainpages["Main pages"]
  node_authpages["Auth pages"]
  node_authstate["Session state<br/>[AuthContext.tsx]"]
  node_postcard["Post card<br/>[PostCard.tsx]"]
  node_author["Author display<br/>[AuthorAndDate.tsx]"]
  node_share["External sharing<br/>[ShareExternal.tsx]"]
end

subgraph group_api["API routes"]
  node_postapi["Post endpoints"]
  node_commentapi["Comment endpoints"]
  node_profileapi["Profile endpoint<br/>[route.ts]"]
  node_savedapi["Saved endpoint<br/>[route.ts]"]
  node_notifapi["Notification endpoints"]
  node_messageapi["Messaging endpoints"]
  node_searchapi["Search endpoint<br/>[route.ts]"]
  node_authapi["Authentication endpoints"]
end

subgraph group_domain["Domain services"]
  node_postdomain["Post operations<br/>[post.ts]"]
  node_commentdomain["Comment operations<br/>[comment.ts]"]
  node_userdomain["User operations<br/>[user.ts]"]
  node_saveddomain["Saved posts<br/>[savedPosts.ts]"]
  node_notifdomain["Notifications<br/>[notification.ts]"]
  node_messagedomain["Messaging<br/>[pesan.ts]"]
  node_searchdomain["Search<br/>[search.ts]"]
  node_authdomain["Token and passwords<br/>[auth.ts]"]
end

subgraph group_storage["Persistence"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
  node_database[("Database")]
end

node_visitor(("Visitor"))

node_authstate -->|"checks session"| node_authapi
node_authstate -->|"fetches alerts"| node_notifapi
node_postcard -->|"renders"| node_author
node_postcard -->|"uses"| node_share
node_authpages -.->|"uses session"| node_authstate
node_postapi -->|"calls"| node_postdomain
node_postapi -->|"verifies request"| node_authdomain
node_commentapi -->|"calls"| node_commentdomain
node_commentapi -->|"loads post"| node_postdomain
node_commentapi -->|"creates alert"| node_notifdomain
node_commentapi -->|"verifies request"| node_authdomain
node_profileapi -->|"calls"| node_userdomain
node_profileapi -->|"verifies request"| node_authdomain
node_savedapi -->|"calls"| node_saveddomain
node_savedapi -->|"verifies request"| node_authdomain
node_notifapi -->|"calls"| node_notifdomain
node_notifapi -->|"verifies request"| node_authdomain
node_messageapi -->|"calls"| node_messagedomain
node_messageapi -->|"verifies request"| node_authdomain
node_searchapi -->|"calls"| node_searchdomain
node_authapi -->|"uses"| node_authdomain
node_postdomain -->|"queries"| node_prisma
node_commentdomain -->|"queries"| node_prisma
node_userdomain -->|"queries"| node_prisma
node_saveddomain -->|"queries"| node_prisma
node_notifdomain -->|"queries"| node_prisma
node_messagedomain -->|"queries"| node_prisma
node_searchdomain -->|"queries"| node_prisma
node_prisma -.->|"persists data"| node_database

click node_mainpages "https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/(main)"
click node_authpages "https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/(auth)"
click node_authstate "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/context/AuthContext.tsx"
click node_postcard "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/components/Posts/PostCard.tsx"
click node_author "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/components/UI/AuthorAndDate.tsx"
click node_share "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/components/UI/ShareExternal.tsx"
click node_postapi "https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/api/post"
click node_commentapi "https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/api/comment"
click node_profileapi "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/app/api/profile/route.ts"
click node_savedapi "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/app/api/saved/route.ts"
click node_notifapi "https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/api/notification"
click node_messageapi "https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/api/pesan"
click node_searchapi "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/app/api/search/route.ts"
click node_authapi "https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/api/auth"
click node_postdomain "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/post.ts"
click node_commentdomain "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/comment.ts"
click node_userdomain "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/user.ts"
click node_saveddomain "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/savedPosts.ts"
click node_notifdomain "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/notification.ts"
click node_messagedomain "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/pesan.ts"
click node_searchdomain "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/search.ts"
click node_authdomain "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/auth.ts"
click node_prisma "https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/prisma.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_mainpages,node_authpages,node_authstate,node_postcard,node_author,node_share toneBlue
class node_postapi,node_commentapi,node_profileapi,node_savedapi,node_notifapi,node_messageapi,node_searchapi,node_authapi toneAmber
class node_postdomain,node_commentdomain,node_userdomain,node_saveddomain,node_notifdomain,node_messagedomain,node_searchdomain,node_authdomain toneMint
class node_prisma,node_database toneRose
class node_visitor toneIndigo
```

## Components

### Web experience

- [Main pages](https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/(main)): `src/app/(main)`
- [Auth pages](https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/(auth)): `src/app/(auth)`
- [Session state](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Post card](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/components/Posts/PostCard.tsx): `src/components/Posts/PostCard.tsx`
- [Author display](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/components/UI/AuthorAndDate.tsx): `src/components/UI/AuthorAndDate.tsx`
- [External sharing](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/components/UI/ShareExternal.tsx): `src/components/UI/ShareExternal.tsx`

### API routes

- [Post endpoints](https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/api/post): `src/app/api/post`
- [Comment endpoints](https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/api/comment): `src/app/api/comment`
- [Profile endpoint](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/app/api/profile/route.ts): `src/app/api/profile/route.ts`
- [Saved endpoint](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/app/api/saved/route.ts): `src/app/api/saved/route.ts`
- [Notification endpoints](https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/api/notification): `src/app/api/notification`
- [Messaging endpoints](https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/api/pesan): `src/app/api/pesan`
- [Search endpoint](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/app/api/search/route.ts): `src/app/api/search/route.ts`
- [Authentication endpoints](https://github.com/naufaladityaakbar/ghbc_web_app/tree/main/src/app/api/auth): `src/app/api/auth`

### Domain services

- [Post operations](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/post.ts): `src/lib/post.ts`
- [Comment operations](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/comment.ts): `src/lib/comment.ts`
- [User operations](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/user.ts): `src/lib/user.ts`
- [Saved posts](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/savedPosts.ts): `src/lib/savedPosts.ts`
- [Notifications](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/notification.ts): `src/lib/notification.ts`
- [Messaging](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/pesan.ts): `src/lib/pesan.ts`
- [Search](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/search.ts): `src/lib/search.ts`
- [Token and passwords](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/auth.ts): `src/lib/auth.ts`

### Persistence

- [Prisma client](https://github.com/naufaladityaakbar/ghbc_web_app/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- **Database**

### Other components

- **Visitor**

## Connections

- Session state → Authentication endpoints: checks session (evidence: `src/context/AuthContext.tsx`)
- Session state → Notification endpoints: fetches alerts (evidence: `src/context/AuthContext.tsx`)
- Post card → Author display: renders (evidence: `src/components/Posts/PostCard.tsx`)
- Post card → External sharing: uses (evidence: `src/components/Posts/PostCard.tsx`)
- Auth pages → Session state: uses session
- Post endpoints → Post operations: calls (evidence: `src/app/api/post/route.ts`)
- Post endpoints → Token and passwords: verifies request (evidence: `src/app/api/post/route.ts`)
- Comment endpoints → Comment operations: calls (evidence: `src/app/api/comment/route.ts`)
- Comment endpoints → Post operations: loads post (evidence: `src/app/api/comment/route.ts`)
- Comment endpoints → Notifications: creates alert (evidence: `src/app/api/comment/route.ts`)
- Comment endpoints → Token and passwords: verifies request (evidence: `src/app/api/comment/route.ts`)
- Profile endpoint → User operations: calls (evidence: `src/app/api/profile/route.ts`)
- Profile endpoint → Token and passwords: verifies request (evidence: `src/app/api/profile/route.ts`)
- Saved endpoint → Saved posts: calls (evidence: `src/app/api/saved/route.ts`)
- Saved endpoint → Token and passwords: verifies request (evidence: `src/app/api/saved/route.ts`)
- Notification endpoints → Notifications: calls (evidence: `src/app/api/notification/route.ts`)
- Notification endpoints → Token and passwords: verifies request (evidence: `src/app/api/notification/route.ts`)
- Messaging endpoints → Messaging: calls (evidence: `src/app/api/pesan/conversations/route.ts`)
- Messaging endpoints → Token and passwords: verifies request (evidence: `src/app/api/pesan/conversations/route.ts`)
- Search endpoint → Search: calls (evidence: `src/app/api/search/route.ts`)
- Authentication endpoints → Token and passwords: uses (evidence: `src/app/api/auth/login/route.ts`)
- Post operations → Prisma client: queries (evidence: `src/lib/post.ts`)
- Comment operations → Prisma client: queries (evidence: `src/lib/comment.ts`)
- User operations → Prisma client: queries (evidence: `src/lib/user.ts`)
- Saved posts → Prisma client: queries (evidence: `src/lib/savedPosts.ts`)
- Notifications → Prisma client: queries (evidence: `src/lib/notification.ts`)
- Messaging → Prisma client: queries (evidence: `src/lib/pesan.ts`)
- Search → Prisma client: queries (evidence: `src/lib/search.ts`)
- Prisma client → Database: persists data
