# aakif9866/mern-blog architecture

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

- Interactive diagram: https://gitdiagram.com/aakif9866/mern-blog
- Repository: https://github.com/aakif9866/mern-blog

## Overview

This is a MERN blogging platform: readers browse and search posts, while users authenticate, comment, and manage profiles; administrators can manage posts, users, and comments. The React client calls an Express API backed by Mongoose models. The graph shows the documented content, auth, and admin capabilities, but some client-to-API calls and unsampled page details are not visible in the excerpts, so those links are omitted or marked unverified.

Main entry points: [`client/src/App.jsx`](https://github.com/aakif9866/mern-blog/blob/main/client/src/App.jsx) (React routes), [`client/src/components/OAuth.jsx`](https://github.com/aakif9866/mern-blog/blob/main/client/src/components/OAuth.jsx) (Google sign-in), [`client/src/components/DashboardComp.jsx`](https://github.com/aakif9866/mern-blog/blob/main/client/src/components/DashboardComp.jsx) (Admin dashboard), [`api/routes/post.route.js`](https://github.com/aakif9866/mern-blog/blob/main/api/routes/post.route.js) (Post routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browse["Reading and discovery"]
  node_app["React routes<br/>[App.jsx]"]
  node_home["Home feed<br/>[Home.jsx]"]
  node_search["Post search<br/>[Search.jsx]"]
  node_postpage["Post and comments<br/>[PostPage.jsx]"]
  node_commentui["Comment section<br/>[CommentSection.jsx]"]
  node_postcard["Post card<br/>[PostCard.jsx]"]
end

subgraph group_manage["Authoring and administration"]
  node_create["Post editor<br/>[CreatePost.jsx]"]
  node_update["Post updater<br/>[UpdatePost.jsx]"]
  node_dashboard["Admin dashboard<br/>[DashboardComp.jsx]"]
  node_dashposts["Post management<br/>[DashPost.jsx]"]
  node_dashusers["User management<br/>[DashUsers.jsx]"]
  node_dashcomments["Comment management<br/>[DashComments.jsx]"]
end

subgraph group_identity["Identity and client state"]
  node_signin["Sign-in and signup<br/>[SignIn.jsx]"]
  node_oauth["Google sign-in<br/>[OAuth.jsx]"]
  node_firebase["Firebase auth client<br/>[firebase.js]"]
  node_userstate["User state<br/>[userSlice.js]"]
end

subgraph group_api["REST API"]
  node_authroutes["Auth routes<br/>[auth.route.js]"]
  node_authctrl["Auth controller<br/>[auth.controller.js]"]
  node_postroutes["Post routes<br/>[post.route.js]"]
  node_postctrl["Post controller<br/>[post.controller.js]"]
  node_commentroutes["Comment routes<br/>[comment.route.js]"]
  node_commentctrl["Comment controller"]
  node_userroutes["User routes<br/>[user.route.js]"]
  node_userctrl["User controller<br/>[user.controller.js]"]
  node_verify["JWT verification<br/>[verifyUser.js]"]
end

subgraph group_data["Persistence"]
  node_posts[("Post records<br/>[post.model.js]")]
  node_comments[("Comment records<br/>[comment.model.js]")]
  node_users[("User records<br/>[user.model.js]")]
end

node_reader(("Visitor or user"))
node_google(("Google identity"))
node_mongo[("MongoDB")]

node_reader -->|"uses"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_search
node_app -->|"routes to"| node_postpage
node_app -->|"routes to"| node_dashboard
node_home -->|"renders"| node_postcard
node_search -->|"renders"| node_postcard
node_postpage -->|"renders"| node_commentui
node_reader -.->|"authenticates"| node_signin
node_signin -->|"offers"| node_oauth
node_oauth -->|"authenticates with"| node_firebase
node_oauth -->|"signs in via"| node_google
node_oauth -->|"posts Google login"| node_authroutes
node_oauth -->|"updates"| node_userstate
node_signin -.->|"updates"| node_userstate
node_create -.->|"submits post"| node_postroutes
node_update -.->|"updates post"| node_postroutes
node_dashboard -->|"selects"| node_dashposts
node_dashboard -->|"selects"| node_dashusers
node_dashboard -->|"selects"| node_dashcomments
node_authroutes -->|"dispatches"| node_authctrl
node_postroutes -->|"dispatches"| node_postctrl
node_commentroutes -->|"dispatches"| node_commentctrl
node_userroutes -->|"dispatches"| node_userctrl
node_postroutes -->|"protects routes"| node_verify
node_commentroutes -->|"protects routes"| node_verify
node_userroutes -->|"protects routes"| node_verify
node_authctrl -->|"reads and writes"| node_users
node_postctrl -->|"reads and writes"| node_posts
node_commentctrl -->|"reads and writes"| node_comments
node_userctrl -->|"reads and writes"| node_users
node_users -.->|"persists in"| node_mongo
node_posts -.->|"persists in"| node_mongo
node_comments -.->|"persists in"| node_mongo

click node_app "https://github.com/aakif9866/mern-blog/blob/main/client/src/App.jsx"
click node_home "https://github.com/aakif9866/mern-blog/blob/main/client/src/pages/Home.jsx"
click node_search "https://github.com/aakif9866/mern-blog/blob/main/client/src/pages/Search.jsx"
click node_postpage "https://github.com/aakif9866/mern-blog/blob/main/client/src/pages/PostPage.jsx"
click node_commentui "https://github.com/aakif9866/mern-blog/blob/main/client/src/components/CommentSection.jsx"
click node_postcard "https://github.com/aakif9866/mern-blog/blob/main/client/src/components/PostCard.jsx"
click node_create "https://github.com/aakif9866/mern-blog/blob/main/client/src/pages/CreatePost.jsx"
click node_update "https://github.com/aakif9866/mern-blog/blob/main/client/src/pages/UpdatePost.jsx"
click node_dashboard "https://github.com/aakif9866/mern-blog/blob/main/client/src/components/DashboardComp.jsx"
click node_dashposts "https://github.com/aakif9866/mern-blog/blob/main/client/src/components/DashPost.jsx"
click node_dashusers "https://github.com/aakif9866/mern-blog/blob/main/client/src/components/DashUsers.jsx"
click node_dashcomments "https://github.com/aakif9866/mern-blog/blob/main/client/src/components/DashComments.jsx"
click node_signin "https://github.com/aakif9866/mern-blog/blob/main/client/src/pages/SignIn.jsx"
click node_oauth "https://github.com/aakif9866/mern-blog/blob/main/client/src/components/OAuth.jsx"
click node_firebase "https://github.com/aakif9866/mern-blog/blob/main/client/src/firebase.js"
click node_userstate "https://github.com/aakif9866/mern-blog/blob/main/client/src/redux/user/userSlice.js"
click node_authroutes "https://github.com/aakif9866/mern-blog/blob/main/api/routes/auth.route.js"
click node_authctrl "https://github.com/aakif9866/mern-blog/blob/main/api/controller/auth.controller.js"
click node_postroutes "https://github.com/aakif9866/mern-blog/blob/main/api/routes/post.route.js"
click node_postctrl "https://github.com/aakif9866/mern-blog/blob/main/api/controller/post.controller.js"
click node_commentroutes "https://github.com/aakif9866/mern-blog/blob/main/api/routes/comment.route.js"
click node_commentctrl "https://github.com/aakif9866/mern-blog/blob/main/api/controller/comment.controller.js"
click node_userroutes "https://github.com/aakif9866/mern-blog/blob/main/api/routes/user.route.js"
click node_userctrl "https://github.com/aakif9866/mern-blog/blob/main/api/controller/user.controller.js"
click node_verify "https://github.com/aakif9866/mern-blog/blob/main/api/utils/verifyUser.js"
click node_posts "https://github.com/aakif9866/mern-blog/blob/main/api/models/post.model.js"
click node_comments "https://github.com/aakif9866/mern-blog/blob/main/api/models/comment.model.js"
click node_users "https://github.com/aakif9866/mern-blog/blob/main/api/models/user.model.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_app,node_home,node_search,node_postpage,node_commentui,node_postcard,node_reader toneBlue
class node_create,node_update,node_dashboard,node_dashposts,node_dashusers,node_dashcomments,node_mongo toneAmber
class node_signin,node_oauth,node_firebase,node_userstate toneMint
class node_authroutes,node_authctrl,node_postroutes,node_postctrl,node_commentroutes,node_commentctrl,node_userroutes,node_userctrl,node_verify toneRose
class node_posts,node_comments,node_users,node_google toneIndigo
```

## Components

### Reading and discovery

- [React routes](https://github.com/aakif9866/mern-blog/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Home feed](https://github.com/aakif9866/mern-blog/blob/main/client/src/pages/Home.jsx): `client/src/pages/Home.jsx`
- [Post search](https://github.com/aakif9866/mern-blog/blob/main/client/src/pages/Search.jsx): `client/src/pages/Search.jsx`
- [Post and comments](https://github.com/aakif9866/mern-blog/blob/main/client/src/pages/PostPage.jsx): `client/src/pages/PostPage.jsx`
- [Comment section](https://github.com/aakif9866/mern-blog/blob/main/client/src/components/CommentSection.jsx): `client/src/components/CommentSection.jsx`
- [Post card](https://github.com/aakif9866/mern-blog/blob/main/client/src/components/PostCard.jsx): `client/src/components/PostCard.jsx`

### Authoring and administration

- [Post editor](https://github.com/aakif9866/mern-blog/blob/main/client/src/pages/CreatePost.jsx): `client/src/pages/CreatePost.jsx`
- [Post updater](https://github.com/aakif9866/mern-blog/blob/main/client/src/pages/UpdatePost.jsx): `client/src/pages/UpdatePost.jsx`
- [Admin dashboard](https://github.com/aakif9866/mern-blog/blob/main/client/src/components/DashboardComp.jsx): `client/src/components/DashboardComp.jsx`
- [Post management](https://github.com/aakif9866/mern-blog/blob/main/client/src/components/DashPost.jsx): `client/src/components/DashPost.jsx`
- [User management](https://github.com/aakif9866/mern-blog/blob/main/client/src/components/DashUsers.jsx): `client/src/components/DashUsers.jsx`
- [Comment management](https://github.com/aakif9866/mern-blog/blob/main/client/src/components/DashComments.jsx): `client/src/components/DashComments.jsx`

### Identity and client state

- [Sign-in and signup](https://github.com/aakif9866/mern-blog/blob/main/client/src/pages/SignIn.jsx): `client/src/pages/SignIn.jsx`
- [Google sign-in](https://github.com/aakif9866/mern-blog/blob/main/client/src/components/OAuth.jsx): `client/src/components/OAuth.jsx`
- [Firebase auth client](https://github.com/aakif9866/mern-blog/blob/main/client/src/firebase.js): `client/src/firebase.js`
- [User state](https://github.com/aakif9866/mern-blog/blob/main/client/src/redux/user/userSlice.js): `client/src/redux/user/userSlice.js`

### REST API

- [Auth routes](https://github.com/aakif9866/mern-blog/blob/main/api/routes/auth.route.js): `api/routes/auth.route.js`
- [Auth controller](https://github.com/aakif9866/mern-blog/blob/main/api/controller/auth.controller.js): `api/controller/auth.controller.js`
- [Post routes](https://github.com/aakif9866/mern-blog/blob/main/api/routes/post.route.js): `api/routes/post.route.js`
- [Post controller](https://github.com/aakif9866/mern-blog/blob/main/api/controller/post.controller.js): `api/controller/post.controller.js`
- [Comment routes](https://github.com/aakif9866/mern-blog/blob/main/api/routes/comment.route.js): `api/routes/comment.route.js`
- [Comment controller](https://github.com/aakif9866/mern-blog/blob/main/api/controller/comment.controller.js): `api/controller/comment.controller.js`
- [User routes](https://github.com/aakif9866/mern-blog/blob/main/api/routes/user.route.js): `api/routes/user.route.js`
- [User controller](https://github.com/aakif9866/mern-blog/blob/main/api/controller/user.controller.js): `api/controller/user.controller.js`
- [JWT verification](https://github.com/aakif9866/mern-blog/blob/main/api/utils/verifyUser.js): `api/utils/verifyUser.js`

### Persistence

- [Post records](https://github.com/aakif9866/mern-blog/blob/main/api/models/post.model.js): `api/models/post.model.js`
- [Comment records](https://github.com/aakif9866/mern-blog/blob/main/api/models/comment.model.js): `api/models/comment.model.js`
- [User records](https://github.com/aakif9866/mern-blog/blob/main/api/models/user.model.js): `api/models/user.model.js`

### Other components

- **Visitor or user**
- **Google identity**
- **MongoDB**

## Connections

- Visitor or user → React routes: uses (evidence: `client/src/App.jsx`)
- React routes → Home feed: routes to (evidence: `client/src/App.jsx`)
- React routes → Post search: routes to (evidence: `client/src/App.jsx`)
- React routes → Post and comments: routes to (evidence: `client/src/App.jsx`)
- React routes → Admin dashboard: routes to (evidence: `client/src/App.jsx`)
- Home feed → Post card: renders (evidence: `client/src/pages/Home.jsx`)
- Post search → Post card: renders (evidence: `client/src/pages/Search.jsx`)
- Post and comments → Comment section: renders (evidence: `client/src/pages/PostPage.jsx`)
- Visitor or user → Sign-in and signup: authenticates (evidence: `README.md`)
- Sign-in and signup → Google sign-in: offers (evidence: `client/src/pages/SignIn.jsx`)
- Google sign-in → Firebase auth client: authenticates with (evidence: `client/src/components/OAuth.jsx`)
- Google sign-in → Google identity: signs in via (evidence: `client/src/components/OAuth.jsx`)
- Google sign-in → Auth routes: posts Google login (evidence: `client/src/components/OAuth.jsx`)
- Google sign-in → User state: updates (evidence: `client/src/components/OAuth.jsx`)
- Sign-in and signup → User state: updates (evidence: `client/src/pages/SignIn.jsx`)
- Post editor → Post routes: submits post
- Post updater → Post routes: updates post
- Admin dashboard → Post management: selects (evidence: `client/src/pages/Dashboard.jsx`)
- Admin dashboard → User management: selects (evidence: `client/src/pages/Dashboard.jsx`)
- Admin dashboard → Comment management: selects (evidence: `client/src/pages/Dashboard.jsx`)
- Auth routes → Auth controller: dispatches (evidence: `api/routes/auth.route.js`)
- Post routes → Post controller: dispatches (evidence: `api/routes/post.route.js`)
- Comment routes → Comment controller: dispatches (evidence: `api/routes/comment.route.js`)
- User routes → User controller: dispatches (evidence: `api/routes/user.route.js`)
- Post routes → JWT verification: protects routes (evidence: `api/routes/post.route.js`)
- Comment routes → JWT verification: protects routes (evidence: `api/routes/comment.route.js`)
- User routes → JWT verification: protects routes (evidence: `api/routes/user.route.js`)
- Auth controller → User records: reads and writes (evidence: `api/controller/auth.controller.js`)
- Post controller → Post records: reads and writes (evidence: `api/controller/post.controller.js`)
- Comment controller → Comment records: reads and writes (evidence: `api/controller/comment.controller.js`)
- User controller → User records: reads and writes (evidence: `api/controller/user.controller.js`)
- User records → MongoDB: persists in (evidence: `README.md`)
- Post records → MongoDB: persists in (evidence: `README.md`)
- Comment records → MongoDB: persists in (evidence: `README.md`)
