# rohitkumarsingh0111/quickblog architecture

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

- Interactive diagram: https://gitdiagram.com/rohitkumarsingh0111/quickblog
- Repository: https://github.com/rohitkumarsingh0111/quickblog

## Overview

1. **What this repository is**
   - QuickBlog is a two-part blog platform: a **React/Vite client** and a **Node/Express server**.
   - The client handles the public blog experience plus an admin UI.
   - The server exposes APIs for blogs, comments, admin actions, authentication, and media/AI integrations.

2. **Top-level boundary**
   - `client/` and `server/` are separate deployable runtimes.
   - The client talks to the server over HTTP; the server owns business logic, persistence, and third-party integrations.
   - This is the main architectural split to show in a diagram.

3. **Client application shape**
   - `client/src/main.jsx` and `App.jsx` are the SPA entry points.
   - `src/pages/` contains route-level screens:
     - public: `Home.jsx`, `Blog.jsx`
     - admin: `pages/admin/*`
   - `src/components/` contains reusable UI pieces like blog cards, lists, navbar/footer, loader, newsletter, and admin table rows.

4. **State and data access on the client**
   - `src/context/AppContext.jsx` is the shared client-side state layer.
   - It likely centralizes API data, loading/error state, and app-wide blog/admin data needed by multiple pages.
   - In an architecture diagram, this is the client’s internal coordination layer between pages/components and the backend API.

5. **Public content flow**
   - Visitors land on `Home.jsx`, browse lists of posts via `BlogList`/`BlogCard`, and open a single post in `Blog.jsx`.
   - Content is rendered from server-provided blog data rather than being hardcoded in the client.
   - `Newsletter.jsx` suggests a subscription or capture form in the public UX, though the backend handling is not visible here.

6. **Admin console flow**
   - Admin pages are isolated under `src/pages/admin/`.
   - Key functions include:
     - `AddBlog.jsx` for creating content
     - `ListBlog.jsx` and `BlogTableItem.jsx` for managing posts
     - `Comment.jsx` and `CommentTableItem.jsx` for comment moderation
     - `Dashboard.jsx` for overview metrics
     - `Layout.jsx`, `Sidebar.jsx`, and `Login.jsx` for admin shell and access entry
   - This is a distinct operational path from the public site, even though it lives in the same frontend codebase.

7. **Server API layer**
   - `server/routes/blogRoutes.js` and `server/routes/adminRoutes.js` divide the backend into public-content and admin-capability endpoints.
   - `server/controllers/blogController.js` and `adminController.js` hold the request handling and business logic.
   - This separation suggests a fairly standard layered API design: routes → controllers → models/services.

8. **Data model and persistence**
   - MongoDB is strongly implied by `server/configs/db.js` and the `models/` directory.
   - Core entities are:
     - `Blog.js` for post content, metadata, and likely media references
     - `Comment.js` for reader feedback or moderation workflows
   - The database is the source of truth for both public rendering and admin management.

9. **Cross-cutting server middleware**
   - `middleware/auth.js` protects admin-only actions.
   - `middleware/multer.js` handles file upload ingestion before content creation.
   - These are important boundaries: authentication gates admin routes, and upload middleware sits in front of content/media processing.

10. **External integrations**
   - `configs/imageKit.js` indicates ImageKit is used for image storage/CDN delivery, likely for blog images.
   - `configs/gemini.js` indicates Gemini AI is integrated for some content-generation or assistance feature.
   - These services are not core storage; they augment blog creation and media handling.

11. **Runtime and tooling**
   - The client is built with **Vite** and React.
   - The server runs on **Node.js/Express**.
   - Deployment config exists for both sides via `vercel.json`, so the repo is prepared for separate frontend/backend hosting or serverless-style deployment.

12. **How data moves through the system**
   - Public user: browser → React pages/components → API requests → blog routes/controllers → MongoDB → back to client render.
   - Admin user: browser → admin UI → auth-protected admin routes → controllers → DB and external services (ImageKit/Gemini) → updated content reflected back in public pages.
   - Comments follow a similar DB-backed flow, with moderation capability exposed through admin screens.

13. **Diagram emphasis**
   - Show three main zones:
     - **Client SPA**: public site + admin UI
     - **Server API**: routes/controllers/middleware
     - **Data/services**: MongoDB, ImageKit, Gemini
   - The most important boundaries are client/server, public/admin, and internal/external service interactions.

Main entry points: [`client/src/pages/admin/Layout.jsx`](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/admin/Layout.jsx) (Admin Layout), [`server/controllers/adminController.js`](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/controllers/adminController.js) (adminController), [`client/src/App.jsx`](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/App.jsx) (App.jsx), [`server/routes/adminRoutes.js`](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/routes/adminRoutes.js) (admin routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client SPA"]
  node_client_main["main.jsx<br/>spa entry<br/>[main.jsx]"]
  node_client_app["App.jsx<br/>app shell<br/>[App.jsx]"]
  node_client_context["AppContext<br/>state layer<br/>[AppContext.jsx]"]
  node_client_home["Home<br/>public page<br/>[Home.jsx]"]
  node_client_blog["Blog<br/>post page<br/>[Blog.jsx]"]
  node_client_bloglist["BlogList<br/>list UI<br/>[BlogList.jsx]"]
  node_client_blogcard["BlogCard<br/>card UI<br/>[BlogCard.jsx]"]
  node_client_newsletter["Newsletter<br/>public form<br/>[Newsletter.jsx]"]
  node_client_admin_layout["Admin Layout<br/>admin shell<br/>[Layout.jsx]"]
  node_client_admin_dashboard["Dashboard<br/>admin page<br/>[Dashboard.jsx]"]
  node_client_admin_add["AddBlog<br/>admin page<br/>[AddBlog.jsx]"]
  node_client_admin_list["ListBlog<br/>admin page<br/>[ListBlog.jsx]"]
  node_client_admin_comment["Comment<br/>admin page<br/>[Comment.jsx]"]
  node_client_admin_login["Login<br/>admin entry<br/>[Login.jsx]"]
end

subgraph group_server["Server API"]
  node_server_server["server.js<br/>api host<br/>[server.js]"]
  node_server_blog_routes["blog routes<br/>http routes<br/>[blogRoutes.js]"]
  node_server_admin_routes["admin routes<br/>http routes<br/>[adminRoutes.js]"]
  node_server_blog_controller["blogController<br/>[blogController.js]"]
  node_server_admin_controller["adminController<br/>[adminController.js]"]
  node_server_auth["auth<br/>middleware<br/>[auth.js]"]
  node_server_multer["multer<br/>middleware<br/>[multer.js]"]
end

subgraph group_services["Data & Services"]
  node_server_db[("db.js<br/>mongodb config<br/>[db.js]")]
  node_server_blog_model[("Blog<br/>model<br/>[Blog.js]")]
  node_server_comment_model[("Comment<br/>model<br/>[Comment.js]")]
  node_server_imagekit["ImageKit<br/>media service<br/>[imageKit.js]"]
  node_server_gemini["Gemini<br/>ai service<br/>[gemini.js]"]
end

node_client_main -->|"mounts"| node_client_app
node_client_app -->|"uses"| node_client_context
node_client_app -->|"routes to"| node_client_home
node_client_app -->|"routes to"| node_client_blog
node_client_app -->|"routes to"| node_client_admin_layout
node_client_home -->|"renders"| node_client_bloglist
node_client_bloglist -->|"composes"| node_client_blogcard
node_client_home -->|"includes"| node_client_newsletter
node_client_admin_layout -->|"hosts"| node_client_admin_dashboard
node_client_admin_layout -->|"hosts"| node_client_admin_add
node_client_admin_layout -->|"hosts"| node_client_admin_list
node_client_admin_layout -->|"hosts"| node_client_admin_comment
node_client_admin_layout -->|"includes"| node_client_admin_login
node_client_context -->|"requests"| node_server_blog_routes
node_client_context -->|"requests"| node_server_admin_routes
node_server_server -->|"mounts"| node_server_blog_routes
node_server_server -->|"mounts"| node_server_admin_routes
node_server_blog_routes -->|"delegates"| node_server_blog_controller
node_server_admin_routes -->|"delegates"| node_server_admin_controller
node_server_admin_routes -->|"protects with"| node_server_auth
node_server_admin_controller -->|"uses"| node_server_multer
node_server_blog_controller -->|"persists via"| node_server_db
node_server_admin_controller -->|"persists via"| node_server_db
node_server_blog_controller -->|"uses"| node_server_blog_model
node_server_admin_controller -->|"uses"| node_server_comment_model
node_server_admin_controller -->|"uploads to"| node_server_imagekit
node_server_admin_controller -->|"augments with"| node_server_gemini

click node_client_main "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/main.jsx"
click node_client_app "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/App.jsx"
click node_client_context "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/context/AppContext.jsx"
click node_client_home "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/Home.jsx"
click node_client_blog "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/Blog.jsx"
click node_client_bloglist "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/components/BlogList.jsx"
click node_client_blogcard "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/components/BlogCard.jsx"
click node_client_newsletter "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/components/Newsletter.jsx"
click node_client_admin_layout "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/admin/Layout.jsx"
click node_client_admin_dashboard "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/admin/Dashboard.jsx"
click node_client_admin_add "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/admin/AddBlog.jsx"
click node_client_admin_list "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/admin/ListBlog.jsx"
click node_client_admin_comment "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/admin/Comment.jsx"
click node_client_admin_login "https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/components/admin/Login.jsx"
click node_server_server "https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/server.js"
click node_server_blog_routes "https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/routes/blogRoutes.js"
click node_server_admin_routes "https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/routes/adminRoutes.js"
click node_server_blog_controller "https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/controllers/blogController.js"
click node_server_admin_controller "https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/controllers/adminController.js"
click node_server_auth "https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/middleware/auth.js"
click node_server_multer "https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/middleware/multer.js"
click node_server_db "https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/configs/db.js"
click node_server_blog_model "https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/models/Blog.js"
click node_server_comment_model "https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/models/Comment.js"
click node_server_imagekit "https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/configs/imageKit.js"
click node_server_gemini "https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/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_client_main,node_client_app,node_client_context,node_client_home,node_client_blog,node_client_bloglist,node_client_blogcard,node_client_newsletter,node_client_admin_layout,node_client_admin_dashboard,node_client_admin_add,node_client_admin_list,node_client_admin_comment,node_client_admin_login toneBlue
class node_server_server,node_server_blog_routes,node_server_admin_routes,node_server_blog_controller,node_server_admin_controller,node_server_auth,node_server_multer toneAmber
class node_server_db,node_server_blog_model,node_server_comment_model,node_server_imagekit,node_server_gemini toneMint
```

## Components

### Client SPA

React/Vite single-page app for public browsing and admin operations

- [main.jsx](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/main.jsx): spa entry · Client bootstrap and render entry point · `client/src/main.jsx`
- [App.jsx](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/App.jsx): app shell · Top-level SPA composition and route wiring · `client/src/App.jsx`
- [AppContext](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/context/AppContext.jsx): state layer · Shared client state and API coordination · `client/src/context/AppContext.jsx`
- [Home](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/Home.jsx): public page · Landing page for blog discovery · `client/src/pages/Home.jsx`
- [Blog](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/Blog.jsx): post page · Single-post reading view · `client/src/pages/Blog.jsx`
- [BlogList](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/components/BlogList.jsx): list UI · Blog feed/list rendering component · `client/src/components/BlogList.jsx`
- [BlogCard](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/components/BlogCard.jsx): card UI · Preview card for individual posts · `client/src/components/BlogCard.jsx`
- [Newsletter](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/components/Newsletter.jsx): public form · Public subscription or capture component · `client/src/components/Newsletter.jsx`
- [Admin Layout](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/admin/Layout.jsx): admin shell · Admin area wrapper and navigation framing · `client/src/pages/admin/Layout.jsx`
- [Dashboard](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/admin/Dashboard.jsx): admin page · Admin overview and metrics screen · `client/src/pages/admin/Dashboard.jsx`
- [AddBlog](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/admin/AddBlog.jsx): admin page · Create-new-post workflow · `client/src/pages/admin/AddBlog.jsx`
- [ListBlog](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/admin/ListBlog.jsx): admin page · Post management screen · `client/src/pages/admin/ListBlog.jsx`
- [Comment](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/pages/admin/Comment.jsx): admin page · Comment moderation screen · `client/src/pages/admin/Comment.jsx`
- [Login](https://github.com/rohitkumarsingh0111/quickblog/blob/main/client/src/components/admin/Login.jsx): admin entry · Admin authentication entry form · `client/src/components/admin/Login.jsx`

### Server API

Node/Express backend with routing, controllers, middleware, and models

- [server.js](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/server.js): api host · Express application bootstrap and runtime wiring · `server/server.js`
- [blog routes](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/routes/blogRoutes.js): http routes · Public content endpoints · `server/routes/blogRoutes.js`
- [admin routes](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/routes/adminRoutes.js): http routes · Admin capability endpoints · `server/routes/adminRoutes.js`
- [blogController](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/controllers/blogController.js): controller · Blog request handling and business logic · `server/controllers/blogController.js`
- [adminController](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/controllers/adminController.js): controller · Admin request handling and business logic · `server/controllers/adminController.js`
- [auth](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/middleware/auth.js): middleware · Admin access protection · `server/middleware/auth.js`
- [multer](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/middleware/multer.js): middleware · File upload ingestion · `server/middleware/multer.js`

### Data & Services

Persistence and external integrations used by the backend

- [db.js](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/configs/db.js): mongodb config · Database connection setup · `server/configs/db.js`
- [Blog](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/models/Blog.js): model · Post persistence model · `server/models/Blog.js`
- [Comment](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/models/Comment.js): model · Comment persistence model · `server/models/Comment.js`
- [ImageKit](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/configs/imageKit.js): media service · Image storage and delivery integration · `server/configs/imageKit.js`
- [Gemini](https://github.com/rohitkumarsingh0111/quickblog/blob/main/server/configs/gemini.js): ai service · AI integration for content assistance · `server/configs/gemini.js`

## Connections

- main.jsx → App.jsx: mounts · Bootstraps the SPA
- App.jsx → AppContext: uses · Shares state and API data
- App.jsx → Home: routes to · Public landing experience
- App.jsx → Blog: routes to · Single-post view
- App.jsx → Admin Layout: routes to · Admin area shell
- Home → BlogList: renders · Shows post listings
- BlogList → BlogCard: composes · Builds list from cards
- Home → Newsletter: includes · Public capture flow
- Admin Layout → Dashboard: hosts · Admin overview screen
- Admin Layout → AddBlog: hosts · Create-post workflow
- Admin Layout → ListBlog: hosts · Manage posts
- Admin Layout → Comment: hosts · Moderate comments
- Admin Layout → Login: includes · Entry/auth screen
- AppContext → blog routes: requests · Fetches public blog data
- AppContext → admin routes: requests · Sends admin actions
- server.js → blog routes: mounts · Registers public routes
- server.js → admin routes: mounts · Registers admin routes
- blog routes → blogController: delegates · Handles public API logic
- admin routes → adminController: delegates · Handles admin API logic
- admin routes → auth: protects with · Gates admin actions
- adminController → multer: uses · Accepts file uploads
- blogController → db.js: persists via · Reads and writes database state
- adminController → db.js: persists via · Updates managed content
- blogController → Blog: uses · Blog data model
- adminController → Comment: uses · Comment moderation model
- adminController → ImageKit: uploads to · Stores media assets
- adminController → Gemini: augments with · AI-assisted content workflow
