# saurav-pandit2005/the_blog_hub architecture

> Architecture diagram of the GitHub repository saurav-pandit2005/the_blog_hub, 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/saurav-pandit2005/the_blog_hub
- Repository: https://github.com/saurav-pandit2005/the_blog_hub

## Overview

The Blog Hub is a MERN publishing platform: visitors discover and engage with content, authors create and manage it, and administrators moderate users and platform media. The frontend routes role-specific experiences to a REST backend, whose controllers operate on MongoDB models and media/email integrations. The graph preserves documented AI and user-dashboard capabilities, but their detailed runtime wiring is not shown in the sampled source.

Main entry points: [`Frontend/src/App.jsx`](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/App.jsx) (Portal routing), [`Frontend/src/api.js`](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/api.js) (API client), [`Backend/server.js`](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/server.js) (REST API), [`Backend/controllers/blogController.js`](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/controllers/blogController.js) (Blog operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Portal routing<br/>[App.jsx]"]
  node_landing["Discovery portal<br/>[Landing.jsx]"]
  node_blogdetail["Blog reading<br/>[BlogDetailPage.jsx]"]
  node_authui["Login and register"]
  node_userstate["User session state<br/>[UserContext.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_creator["Creator and admin"]
  node_author_workspace["Author workspace"]
  node_author_writer["Article editor<br/>[WritePost.jsx]"]
  node_admin_console["Admin console"]
  node_admin_resources["Resource moderation"]
end

subgraph group_api["API services"]
  node_api_server["REST API<br/>[server.js]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_blog_routes["Blog routes<br/>[blogRoutes.js]"]
  node_blog_logic["Blog operations<br/>[blogController.js]"]
  node_resource_routes["Resource routes<br/>[resourceRoutes.js]"]
  node_resource_logic["Resource operations"]
  node_auth_logic["Account operations<br/>[authController.js]"]
  node_ai_logic["AI authoring<br/>[aiController.js]"]
end

subgraph group_data["Persistence and integrations"]
  node_blog_store[("Blog and comments<br/>[Blog.js]")]
  node_resource_store[("Resource records<br/>[Resource.js]")]
  node_user_store[("User records<br/>[User.js]")]
  node_media[("Cloudinary media<br/>[cloudinary.js]")]
  node_email["Email delivery<br/>[sendEmail.js]"]
  node_ai_services{{"Groq and Gemini"}}
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_webapp
node_webapp -->|"routes to"| node_landing
node_webapp -->|"routes to"| node_blogdetail
node_webapp -->|"routes to"| node_authui
node_landing -->|"requests content"| node_api_client
node_blogdetail -.->|"requests article"| node_api_client
node_authui -.->|"sends credentials"| node_api_client
node_webapp -->|"routes by role"| node_author_workspace
node_author_workspace -.->|"includes editor"| node_author_writer
node_webapp -->|"routes by role"| node_admin_console
node_admin_console -.->|"includes moderation"| node_admin_resources
node_userstate -->|"provides session"| node_webapp
node_api_client -->|"calls REST API"| node_api_server
node_api_server -->|"mounts routes"| node_auth_routes
node_api_server -->|"mounts routes"| node_blog_routes
node_api_server -->|"mounts routes"| node_resource_routes
node_auth_routes -->|"dispatches to"| node_auth_logic
node_blog_routes -->|"dispatches to"| node_blog_logic
node_resource_routes -->|"dispatches to"| node_resource_logic
node_blog_logic -->|"reads and writes"| node_blog_store
node_blog_logic -.-> node_resource_store
node_resource_logic -->|"reads and writes"| node_resource_store
node_auth_logic -->|"reads and writes"| node_user_store
node_auth_logic -->|"sends OTP"| node_email
node_blog_logic -->|"uploads images"| node_media
node_resource_logic -->|"uploads files"| node_media
node_author_workspace -.->|"manages content"| node_api_client
node_admin_resources -->|"fetches resources"| node_api_client
node_ai_logic -.->|"generates content"| node_ai_services

click node_webapp "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/App.jsx"
click node_landing "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/Visitor/Landing/Landing.jsx"
click node_blogdetail "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/Visitor/Blogs/BlogDetail/BlogDetailPage.jsx"
click node_authui "https://github.com/saurav-pandit2005/the_blog_hub/tree/main/Frontend/src/Visitor/Authentication"
click node_userstate "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/context/UserContext.jsx"
click node_api_client "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/api.js"
click node_author_workspace "https://github.com/saurav-pandit2005/the_blog_hub/tree/main/Frontend/src/Author/Dashboard"
click node_author_writer "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/Author/Dashboard/WritePost/WritePost.jsx"
click node_admin_console "https://github.com/saurav-pandit2005/the_blog_hub/tree/main/Frontend/src/Admin"
click node_admin_resources "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/Admin/ManageResources/ManageResources.jsx"
click node_api_server "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/server.js"
click node_auth_routes "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/routes/authRoutes.js"
click node_blog_routes "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/routes/blogRoutes.js"
click node_blog_logic "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/controllers/blogController.js"
click node_resource_routes "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/routes/resourceRoutes.js"
click node_resource_logic "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/controllers/resourceController.js"
click node_auth_logic "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/controllers/authController.js"
click node_ai_logic "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/controllers/aiController.js"
click node_blog_store "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/models/Blog.js"
click node_resource_store "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/models/Resource.js"
click node_user_store "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/models/User.js"
click node_media "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/config/cloudinary.js"
click node_email "https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/utils/sendEmail.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_landing,node_blogdetail,node_authui,node_userstate,node_api_client toneBlue
class node_author_workspace,node_author_writer,node_admin_console,node_admin_resources toneAmber
class node_api_server,node_auth_routes,node_blog_routes,node_blog_logic,node_resource_routes,node_resource_logic,node_auth_logic,node_ai_logic toneMint
class node_blog_store,node_resource_store,node_user_store,node_media,node_email,node_ai_services toneRose
class node_visitor toneIndigo
```

## Components

### Web experience

- [Portal routing](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [Discovery portal](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/Visitor/Landing/Landing.jsx): `Frontend/src/Visitor/Landing/Landing.jsx`
- [Blog reading](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/Visitor/Blogs/BlogDetail/BlogDetailPage.jsx): `Frontend/src/Visitor/Blogs/BlogDetail/BlogDetailPage.jsx`
- [Login and register](https://github.com/saurav-pandit2005/the_blog_hub/tree/main/Frontend/src/Visitor/Authentication): `Frontend/src/Visitor/Authentication`
- [User session state](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/context/UserContext.jsx): `Frontend/src/context/UserContext.jsx`
- [API client](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/api.js): `Frontend/src/api.js`

### Creator and admin

- [Author workspace](https://github.com/saurav-pandit2005/the_blog_hub/tree/main/Frontend/src/Author/Dashboard): `Frontend/src/Author/Dashboard`
- [Article editor](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/Author/Dashboard/WritePost/WritePost.jsx): `Frontend/src/Author/Dashboard/WritePost/WritePost.jsx`
- [Admin console](https://github.com/saurav-pandit2005/the_blog_hub/tree/main/Frontend/src/Admin): `Frontend/src/Admin`
- [Resource moderation](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Frontend/src/Admin/ManageResources/ManageResources.jsx): `Frontend/src/Admin/ManageResources/ManageResources.jsx`

### API services

- [REST API](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/server.js): `Backend/server.js`
- [Authentication routes](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/routes/authRoutes.js): `Backend/routes/authRoutes.js`
- [Blog routes](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/routes/blogRoutes.js): `Backend/routes/blogRoutes.js`
- [Blog operations](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/controllers/blogController.js): `Backend/controllers/blogController.js`
- [Resource routes](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/routes/resourceRoutes.js): `Backend/routes/resourceRoutes.js`
- [Resource operations](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/controllers/resourceController.js): `Backend/controllers/resourceController.js`
- [Account operations](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/controllers/authController.js): `Backend/controllers/authController.js`
- [AI authoring](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/controllers/aiController.js): `Backend/controllers/aiController.js`

### Persistence and integrations

- [Blog and comments](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/models/Blog.js): `Backend/models/Blog.js`
- [Resource records](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/models/Resource.js): `Backend/models/Resource.js`
- [User records](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/models/User.js): `Backend/models/User.js`
- [Cloudinary media](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/config/cloudinary.js): `Backend/config/cloudinary.js`
- [Email delivery](https://github.com/saurav-pandit2005/the_blog_hub/blob/main/Backend/utils/sendEmail.js): `Backend/utils/sendEmail.js`
- **Groq and Gemini**

### Other components

- **Visitor**

## Connections

- Visitor → Portal routing: opens (evidence: `Frontend/src/App.jsx`)
- Portal routing → Discovery portal: routes to (evidence: `Frontend/src/App.jsx`)
- Portal routing → Blog reading: routes to (evidence: `Frontend/src/App.jsx`)
- Portal routing → Login and register: routes to (evidence: `Frontend/src/App.jsx`)
- Discovery portal → API client: requests content (evidence: `Frontend/src/Visitor/Landing/Landing.jsx`)
- Blog reading → API client: requests article
- Login and register → API client: sends credentials
- Portal routing → Author workspace: routes by role (evidence: `Frontend/src/App.jsx`)
- Author workspace → Article editor: includes editor
- Portal routing → Admin console: routes by role (evidence: `Frontend/src/App.jsx`)
- Admin console → Resource moderation: includes moderation (evidence: `Frontend/src/Admin/ManageResources/ManageResources.jsx`)
- User session state → Portal routing: provides session (evidence: `Frontend/src/main.jsx`)
- API client → REST API: calls REST API (evidence: `README.md`)
- REST API → Authentication routes: mounts routes (evidence: `Backend/server.js`)
- REST API → Blog routes: mounts routes (evidence: `Backend/server.js`)
- REST API → Resource routes: mounts routes (evidence: `Backend/server.js`)
- Authentication routes → Account operations: dispatches to (evidence: `Backend/routes/authRoutes.js`)
- Blog routes → Blog operations: dispatches to (evidence: `Backend/routes/blogRoutes.js`)
- Resource routes → Resource operations: dispatches to (evidence: `Backend/routes/resourceRoutes.js`)
- Blog operations → Blog and comments: reads and writes (evidence: `Backend/controllers/blogController.js`)
- Blog operations → Resource records
- Resource operations → Resource records: reads and writes (evidence: `Backend/controllers/resourceController.js`)
- Account operations → User records: reads and writes (evidence: `Backend/controllers/authController.js`)
- Account operations → Email delivery: sends OTP (evidence: `Backend/controllers/authController.js`)
- Blog operations → Cloudinary media: uploads images (evidence: `Backend/controllers/blogController.js`)
- Resource operations → Cloudinary media: uploads files (evidence: `Backend/controllers/resourceController.js`)
- Author workspace → API client: manages content
- Resource moderation → API client: fetches resources (evidence: `Frontend/src/Admin/ManageResources/ManageResources.jsx`)
- AI authoring → Groq and Gemini: generates content (evidence: `README.md`)
