# kartikmanral092006/weblog-production architecture

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

- Interactive diagram: https://gitdiagram.com/kartikmanral092006/weblog-production
- Repository: https://github.com/kartikmanral092006/weblog-production

## Overview

WeBlog lets readers discover and engage with posts and lets writers create, schedule, and manage them. The Next.js client presents these workflows and calls the Express API; route modules dispatch requests to controllers, which apply domain logic and use Prisma-backed PostgreSQL. Authentication uses JWT cookies, with Google OAuth as an external sign-in option. The map includes README-documented capabilities whose individual handlers were not excerpted; their internal call relationships are therefore omitted. The supplied tree does not expose a Prisma schema path.

Main entry points: [`backend/src/index.js`](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/index.js) (Express API), [`backend/src/lib/prisma.js`](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/lib/prisma.js) (Prisma client), [`frontend/app/page.tsx`](https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/app/page.tsx) (Next.js experience), [`frontend/lib/api.ts`](https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/lib/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_webapp["Next.js experience<br/>[page.tsx]"]
  node_authui["Sign-in UI<br/>[auth-modal.tsx]"]
  node_writer["Post editor<br/>[page.tsx]"]
  node_discovery["Feeds and browsing<br/>[page.tsx]"]
  node_engagementui["Community views<br/>[page.tsx]"]
  node_apiclient["API client<br/>[api.ts]"]
end

subgraph group_api["API and identity"]
  node_server["Express API<br/>[index.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_authcontroller["Authentication<br/>[auth.controller.js]"]
  node_authmiddleware["Session middleware<br/>[auth.middleware.js]"]
end

subgraph group_content["Publishing and discovery"]
  node_blogroutes["Blog routes<br/>[blogRoutes.js]"]
  node_blogcontroller["Post workflows<br/>[blog.controller.js]"]
  node_categorization["Topic categorization"]
end

subgraph group_community["Reader community"]
  node_communityroutes["Community routes<br/>[commentRoutes.js]"]
  node_communitycontrollers["Community actions"]
  node_bookmarkroutes["Bookmark routes<br/>[bookmarkRoutes.js]"]
  node_bookmarkcontroller["Bookmark management"]
  node_notifications["Notification service"]
  node_notificationroutes["Notification routes"]
  node_profilecontroller["Profiles and follows<br/>[user.controller.js]"]
  node_historycontroller["Reading history"]
end

subgraph group_data["Persistence"]
  node_prisma["Prisma client<br/>[prisma.js]"]
  node_postgres[("PostgreSQL")]
end

node_reader(("Reader or writer"))
node_google(("Google OAuth"))

node_reader -->|"uses"| node_webapp
node_webapp -.->|"opens sign-in"| node_authui
node_webapp -.->|"creates posts"| node_writer
node_webapp -.->|"browses feeds"| node_discovery
node_webapp -.->|"views community"| node_engagementui
node_authui -.->|"requests auth"| node_apiclient
node_writer -.->|"submits posts"| node_apiclient
node_discovery -.->|"requests feeds"| node_apiclient
node_engagementui -.->|"requests community"| node_apiclient
node_apiclient -->|"calls API"| node_server
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_blogroutes
node_server -->|"mounts routes"| node_communityroutes
node_server -->|"mounts routes"| node_bookmarkroutes
node_server -->|"mounts routes"| node_notificationroutes
node_server -->|"mounts user routes"| node_profilecontroller
node_server -->|"mounts history routes"| node_historycontroller
node_authroutes -->|"dispatches to"| node_authcontroller
node_authroutes -->|"guards session"| node_authmiddleware
node_blogroutes -->|"dispatches to"| node_blogcontroller
node_blogroutes -->|"guards requests"| node_authmiddleware
node_communityroutes -->|"dispatches to"| node_communitycontrollers
node_bookmarkroutes -->|"dispatches to"| node_bookmarkcontroller
node_bookmarkroutes -->|"guards requests"| node_authmiddleware
node_notificationroutes -->|"guards requests"| node_authmiddleware
node_authcontroller -->|"reads and writes users"| node_prisma
node_authmiddleware -->|"loads session user"| node_prisma
node_blogcontroller -->|"reads and writes posts"| node_prisma
node_blogcontroller -->|"detects topics"| node_categorization
node_blogcontroller -->|"notifies followers"| node_notifications
node_bookmarkcontroller -->|"stores bookmarks"| node_prisma
node_profilecontroller -->|"reads and updates profiles"| node_prisma
node_notifications -->|"stores notifications"| node_prisma
node_prisma -->|"persists data"| node_postgres
node_google -->|"OAuth exchange"| node_authcontroller

click node_webapp "https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/app/page.tsx"
click node_authui "https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/components/auth-modal.tsx"
click node_writer "https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/app/blog/new/page.tsx"
click node_discovery "https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/app/explore/page.tsx"
click node_engagementui "https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/app/profile/%5Bid%5D/page.tsx"
click node_apiclient "https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/lib/api.ts"
click node_server "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/index.js"
click node_authroutes "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/routes/authRoutes.js"
click node_authcontroller "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/controllers/auth.controller.js"
click node_authmiddleware "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/middlewares/auth.middleware.js"
click node_blogroutes "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/routes/blogRoutes.js"
click node_blogcontroller "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/controllers/blog.controller.js"
click node_categorization "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/services/blogCategorizationService.js"
click node_communityroutes "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/routes/commentRoutes.js"
click node_communitycontrollers "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/controllers/comment.controller.js"
click node_bookmarkroutes "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/routes/bookmarkRoutes.js"
click node_bookmarkcontroller "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/controllers/bookmark.controller.js"
click node_notifications "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/services/notificationService.js"
click node_notificationroutes "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/routes/notificationRoutes.js"
click node_profilecontroller "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/controllers/user.controller.js"
click node_historycontroller "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/controllers/history.controller.js"
click node_prisma "https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/lib/prisma.js"

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_webapp,node_authui,node_writer,node_discovery,node_engagementui,node_apiclient toneBlue
class node_server,node_authroutes,node_authcontroller,node_authmiddleware toneAmber
class node_blogroutes,node_blogcontroller,node_categorization toneMint
class node_communityroutes,node_communitycontrollers,node_bookmarkroutes,node_bookmarkcontroller,node_notifications,node_notificationroutes,node_profilecontroller,node_historycontroller toneRose
class node_prisma,node_postgres,node_reader,node_google toneIndigo
```

## Components

### Web client

- [Next.js experience](https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Sign-in UI](https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/components/auth-modal.tsx): `frontend/components/auth-modal.tsx`
- [Post editor](https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/app/blog/new/page.tsx): `frontend/app/blog/new/page.tsx`
- [Feeds and browsing](https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/app/explore/page.tsx): `frontend/app/explore/page.tsx`
- [Community views](https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/app/profile/%5Bid%5D/page.tsx): `frontend/app/profile/[id]/page.tsx`
- [API client](https://github.com/kartikmanral092006/weblog-production/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`

### API and identity

- [Express API](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/index.js): `backend/src/index.js`
- [Auth routes](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/routes/authRoutes.js): `backend/src/routes/authRoutes.js`
- [Authentication](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [Session middleware](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/middlewares/auth.middleware.js): `backend/src/middlewares/auth.middleware.js`

### Publishing and discovery

- [Blog routes](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/routes/blogRoutes.js): `backend/src/routes/blogRoutes.js`
- [Post workflows](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/controllers/blog.controller.js): `backend/src/controllers/blog.controller.js`
- [Topic categorization](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/services/blogCategorizationService.js): `backend/src/services/blogCategorizationService.js`

### Reader community

- [Community routes](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/routes/commentRoutes.js): `backend/src/routes/commentRoutes.js`
- [Community actions](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/controllers/comment.controller.js): `backend/src/controllers/comment.controller.js`
- [Bookmark routes](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/routes/bookmarkRoutes.js): `backend/src/routes/bookmarkRoutes.js`
- [Bookmark management](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/controllers/bookmark.controller.js): `backend/src/controllers/bookmark.controller.js`
- [Notification service](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/services/notificationService.js): `backend/src/services/notificationService.js`
- [Notification routes](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/routes/notificationRoutes.js): `backend/src/routes/notificationRoutes.js`
- [Profiles and follows](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/controllers/user.controller.js): `backend/src/controllers/user.controller.js`
- [Reading history](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/controllers/history.controller.js): `backend/src/controllers/history.controller.js`

### Persistence

- [Prisma client](https://github.com/kartikmanral092006/weblog-production/blob/main/backend/src/lib/prisma.js): `backend/src/lib/prisma.js`
- **PostgreSQL**

### Other components

- **Reader or writer**
- **Google OAuth**

## Connections

- Reader or writer → Next.js experience: uses
- Next.js experience → Sign-in UI: opens sign-in
- Next.js experience → Post editor: creates posts
- Next.js experience → Feeds and browsing: browses feeds
- Next.js experience → Community views: views community
- Sign-in UI → API client: requests auth
- Post editor → API client: submits posts
- Feeds and browsing → API client: requests feeds
- Community views → API client: requests community
- API client → Express API: calls API
- Express API → Auth routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Blog routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Community routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Bookmark routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Notification routes: mounts routes (evidence: `backend/src/index.js`)
- Express API → Profiles and follows: mounts user routes (evidence: `backend/src/index.js`)
- Express API → Reading history: mounts history routes (evidence: `backend/src/index.js`)
- Auth routes → Authentication: dispatches to (evidence: `backend/src/routes/authRoutes.js`)
- Auth routes → Session middleware: guards session (evidence: `backend/src/routes/authRoutes.js`)
- Blog routes → Post workflows: dispatches to (evidence: `backend/src/routes/blogRoutes.js`)
- Blog routes → Session middleware: guards requests (evidence: `backend/src/routes/blogRoutes.js`)
- Community routes → Community actions: dispatches to (evidence: `backend/src/routes/commentRoutes.js`)
- Bookmark routes → Bookmark management: dispatches to (evidence: `backend/src/routes/bookmarkRoutes.js`)
- Bookmark routes → Session middleware: guards requests (evidence: `backend/src/routes/bookmarkRoutes.js`)
- Notification routes → Session middleware: guards requests (evidence: `backend/src/routes/notificationRoutes.js`)
- Authentication → Prisma client: reads and writes users (evidence: `backend/src/controllers/auth.controller.js`)
- Session middleware → Prisma client: loads session user (evidence: `backend/src/middlewares/auth.middleware.js`)
- Post workflows → Prisma client: reads and writes posts (evidence: `backend/src/controllers/blog.controller.js`)
- Post workflows → Topic categorization: detects topics (evidence: `backend/src/controllers/blog.controller.js`)
- Post workflows → Notification service: notifies followers (evidence: `backend/src/controllers/blog.controller.js`)
- Bookmark management → Prisma client: stores bookmarks (evidence: `backend/src/controllers/bookmark.controller.js`)
- Profiles and follows → Prisma client: reads and updates profiles (evidence: `backend/src/controllers/user.controller.js`)
- Notification service → Prisma client: stores notifications (evidence: `backend/src/services/notificationService.js`)
- Prisma client → PostgreSQL: persists data (evidence: `backend/src/lib/prisma.js`)
- Google OAuth → Authentication: OAuth exchange (evidence: `backend/src/controllers/auth.controller.js`)
