# jack8084/blogs architecture

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

- Interactive diagram: https://gitdiagram.com/jack8084/blogs
- Repository: https://github.com/jack8084/blogs

## Overview

This is a blog publishing platform: readers browse published posts, view and comment on articles; administrators authenticate, manage posts and comments, and can request AI-generated draft content. The backend handles publishing, moderation, and public reads, while MongoDB-backed models hold blog and comment state. Blog images are uploaded to ImageKit, and content generation uses Gemini. Frontend page and admin-component wiring beyond the sampled files is not fully established, so uncertain UI-to-admin API links are omitted.

Main entry points: [`Frontend/src/App.jsx`](https://github.com/jack8084/blogs/blob/main/Frontend/src/App.jsx) (Route selection), [`Backend/controllers/blogcontroller.js`](https://github.com/jack8084/blogs/blob/main/Backend/controllers/blogcontroller.js) (Blog workflows), [`Backend/server.js`](https://github.com/jack8084/blogs/blob/main/Backend/server.js) (API server), [`Frontend/src/pages/Blog.jsx`](https://github.com/jack8084/blogs/blob/main/Frontend/src/pages/Blog.jsx) (Article page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public reading"]
  node_home["Blog home<br/>[Home.jsx]"]
  node_blogpage["Article page<br/>[Blog.jsx]"]
  node_appcontext["App context<br/>[Appcontext.jsx]"]
  node_frontendapp["Route selection<br/>[App.jsx]"]
end

subgraph group_admin["Admin console"]
  node_adminui["Admin screens"]
  node_loginui["Admin login<br/>[Login.jsx]"]
end

subgraph group_api["Backend API"]
  node_server["API server<br/>[server.js]"]
  node_blogroutes["Blog routes<br/>[blogroutes.js]"]
  node_adminroutes["Admin routes<br/>[adminroutes.js]"]
  node_blogcontroller["Blog workflows<br/>[blogcontroller.js]"]
  node_admincontroller["Admin workflows<br/>[admincontroller.js]"]
  node_auth["JWT validation<br/>[auth.js]"]
end

subgraph group_services["Data and integrations"]
  node_blogmodel["Blog records<br/>[blog.js]"]
  node_commentmodel["Comment records<br/>[comments.js]"]
  node_mongodb[("MongoDB<br/>[db.js]")]
  node_imagekit["ImageKit<br/>[iamgekit.js]"]
  node_gemini["Gemini<br/>[gemini.js]"]
end

node_reader(("Reader"))
node_administrator(("Administrator"))

node_reader -->|"uses"| node_frontendapp
node_administrator -->|"uses"| node_frontendapp
node_frontendapp -->|"routes to"| node_home
node_frontendapp -->|"routes to"| node_blogpage
node_frontendapp -->|"routes to"| node_loginui
node_frontendapp -->|"routes to"| node_adminui
node_home -->|"uses state"| node_appcontext
node_blogpage -->|"uses client"| node_appcontext
node_appcontext -->|"requests blogs"| node_server
node_blogpage -->|"requests article and comments"| node_server
node_server -->|"dispatches"| node_blogroutes
node_server -->|"dispatches"| node_adminroutes
node_blogroutes -->|"guards writes"| node_auth
node_adminroutes -->|"guards admin actions"| node_auth
node_blogroutes -->|"dispatches"| node_blogcontroller
node_adminroutes -->|"dispatches"| node_admincontroller
node_blogcontroller -->|"reads and writes"| node_blogmodel
node_blogcontroller -->|"reads and writes"| node_commentmodel
node_admincontroller -->|"reads and writes"| node_blogmodel
node_admincontroller -->|"reads and writes"| node_commentmodel
node_blogmodel -->|"persists"| node_mongodb
node_commentmodel -->|"persists"| node_mongodb
node_blogcontroller -->|"uploads images"| node_imagekit
node_blogcontroller -->|"generates content"| node_gemini

click node_home "https://github.com/jack8084/blogs/blob/main/Frontend/src/pages/Home.jsx"
click node_blogpage "https://github.com/jack8084/blogs/blob/main/Frontend/src/pages/Blog.jsx"
click node_appcontext "https://github.com/jack8084/blogs/blob/main/Frontend/context/Appcontext.jsx"
click node_adminui "https://github.com/jack8084/blogs/tree/main/Frontend/src/pages/admin"
click node_loginui "https://github.com/jack8084/blogs/blob/main/Frontend/src/components/admin/Login.jsx"
click node_frontendapp "https://github.com/jack8084/blogs/blob/main/Frontend/src/App.jsx"
click node_server "https://github.com/jack8084/blogs/blob/main/Backend/server.js"
click node_blogroutes "https://github.com/jack8084/blogs/blob/main/Backend/routes/blogroutes.js"
click node_adminroutes "https://github.com/jack8084/blogs/blob/main/Backend/routes/adminroutes.js"
click node_blogcontroller "https://github.com/jack8084/blogs/blob/main/Backend/controllers/blogcontroller.js"
click node_admincontroller "https://github.com/jack8084/blogs/blob/main/Backend/controllers/admincontroller.js"
click node_auth "https://github.com/jack8084/blogs/blob/main/Backend/middlewares/auth.js"
click node_blogmodel "https://github.com/jack8084/blogs/blob/main/Backend/models/blog.js"
click node_commentmodel "https://github.com/jack8084/blogs/blob/main/Backend/models/comments.js"
click node_mongodb "https://github.com/jack8084/blogs/blob/main/Backend/configs/db.js"
click node_imagekit "https://github.com/jack8084/blogs/blob/main/Backend/configs/iamgekit.js"
click node_gemini "https://github.com/jack8084/blogs/blob/main/Backend/configs/gemini.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_home,node_blogpage,node_appcontext,node_frontendapp toneBlue
class node_adminui,node_loginui toneAmber
class node_server,node_blogroutes,node_adminroutes,node_blogcontroller,node_admincontroller,node_auth toneMint
class node_blogmodel,node_commentmodel,node_mongodb,node_imagekit,node_gemini toneRose
class node_reader,node_administrator toneIndigo
```

## Components

### Public reading

- [Blog home](https://github.com/jack8084/blogs/blob/main/Frontend/src/pages/Home.jsx): `Frontend/src/pages/Home.jsx`
- [Article page](https://github.com/jack8084/blogs/blob/main/Frontend/src/pages/Blog.jsx): `Frontend/src/pages/Blog.jsx`
- [App context](https://github.com/jack8084/blogs/blob/main/Frontend/context/Appcontext.jsx): `Frontend/context/Appcontext.jsx`
- [Route selection](https://github.com/jack8084/blogs/blob/main/Frontend/src/App.jsx): `Frontend/src/App.jsx`

### Admin console

- [Admin screens](https://github.com/jack8084/blogs/tree/main/Frontend/src/pages/admin): `Frontend/src/pages/admin`
- [Admin login](https://github.com/jack8084/blogs/blob/main/Frontend/src/components/admin/Login.jsx): `Frontend/src/components/admin/Login.jsx`

### Backend API

- [API server](https://github.com/jack8084/blogs/blob/main/Backend/server.js): `Backend/server.js`
- [Blog routes](https://github.com/jack8084/blogs/blob/main/Backend/routes/blogroutes.js): `Backend/routes/blogroutes.js`
- [Admin routes](https://github.com/jack8084/blogs/blob/main/Backend/routes/adminroutes.js): `Backend/routes/adminroutes.js`
- [Blog workflows](https://github.com/jack8084/blogs/blob/main/Backend/controllers/blogcontroller.js): `Backend/controllers/blogcontroller.js`
- [Admin workflows](https://github.com/jack8084/blogs/blob/main/Backend/controllers/admincontroller.js): `Backend/controllers/admincontroller.js`
- [JWT validation](https://github.com/jack8084/blogs/blob/main/Backend/middlewares/auth.js): `Backend/middlewares/auth.js`

### Data and integrations

- [Blog records](https://github.com/jack8084/blogs/blob/main/Backend/models/blog.js): `Backend/models/blog.js`
- [Comment records](https://github.com/jack8084/blogs/blob/main/Backend/models/comments.js): `Backend/models/comments.js`
- [MongoDB](https://github.com/jack8084/blogs/blob/main/Backend/configs/db.js): `Backend/configs/db.js`
- [ImageKit](https://github.com/jack8084/blogs/blob/main/Backend/configs/iamgekit.js): `Backend/configs/iamgekit.js`
- [Gemini](https://github.com/jack8084/blogs/blob/main/Backend/configs/gemini.js): `Backend/configs/gemini.js`

### Other components

- **Reader**
- **Administrator**

## Connections

- Reader → Route selection: uses
- Administrator → Route selection: uses
- Route selection → Blog home: routes to
- Route selection → Article page: routes to
- Route selection → Admin login: routes to
- Route selection → Admin screens: routes to
- Blog home → App context: uses state
- Article page → App context: uses client
- App context → API server: requests blogs
- Article page → API server: requests article and comments
- API server → Blog routes: dispatches
- API server → Admin routes: dispatches
- Blog routes → JWT validation: guards writes
- Admin routes → JWT validation: guards admin actions
- Blog routes → Blog workflows: dispatches
- Admin routes → Admin workflows: dispatches
- Blog workflows → Blog records: reads and writes
- Blog workflows → Comment records: reads and writes
- Admin workflows → Blog records: reads and writes
- Admin workflows → Comment records: reads and writes
- Blog records → MongoDB: persists
- Comment records → MongoDB: persists
- Blog workflows → ImageKit: uploads images
- Blog workflows → Gemini: generates content
