# kanishk1420/bloggify-blogging-platform architecture

> Architecture diagram of the GitHub repository kanishk1420/bloggify-blogging-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kanishk1420/bloggify-blogging-platform
- Repository: https://github.com/kanishk1420/bloggify-blogging-platform

## Overview

1. Bloggify is a two-tier monorepo: a React frontend in `Frontend/` and a Node/Express backend in `Backend/`. The frontend is a single-page app that talks to the backend through HTTP API modules; the backend exposes REST endpoints and owns persistence, auth, and media handling.

2. The backend is organized around a classic MVC-style split. `server.js`/`app.js` bootstrap Express, then `routes/` define endpoints, `controller/` contains request logic, `models/` define Mongoose schemas for `User`, `Post`, and `Comment`, and `middleware/` handles auth and file upload concerns. `utils/` holds shared helpers like JWT, email, OTP, and file/data conversion.

3. MongoDB is the primary system of record. User accounts, posts, comments, follow relationships, likes/dislikes, bookmarks, and profile data are all persisted through Mongoose models. The backend routes are the only place that should mutate this data, which makes the API the main architectural boundary.

4. Authentication is JWT-based with password hashing via bcrypt. The auth flow includes register, login, logout, token refetch, and password reset support. `middleware/auth.js` gates protected endpoints, so the frontend’s route access and redirection logic depends on whether a valid token-backed session exists.

5. Media upload is a separate pipeline. `middleware/multer.js` accepts multipart uploads, `utils/dataUri.js` converts files for upload, and Cloudinary is used as the external image host. That means post creation/editing and profile-image updates are not stored directly in MongoDB; the database stores references/URLs while Cloudinary stores the actual assets.

6. The backend’s feature domains map cleanly to the controller files: `post.js` for publishing, editing, reactions, bookmarks, search, feed, and analytics; `comment.js` for comment CRUD and post-thread retrieval; `follow.js` for follow/unfollow and follower lists; `user.js` for profile lookup, update, deletion, and search; `auth.js` for account/session lifecycle. This is the core business-logic layer of the system.

7. Engagement data is highly interconnected. A post can be liked, disliked, bookmarked, and commented on, while user profiles track followers/following and aggregate analytics. The analytics endpoint on the backend likely computes counts across these relationships and feeds the dashboard view in the frontend.

8. The frontend is a Vite-based React application with a route-driven UI. `src/pages/` contains the screen-level boundaries such as Landing, Home, Auth, Post Details, Create/Edit Post, Profile, Followers/Following, Search, Reset Password, and Analytics. `src/components/` holds reusable UI pieces like navbar, sidebar, loaders, skeletons, modals, post cards, comment actions, and layout wrappers.

9. State management is centralized with Redux Toolkit. The `src/slices/` and `src/redux/slices/` folders indicate global slices for auth/session, posts, and theme, while `src/api/` contains request helpers for auth, posts, comments, and users. This is where server data is fetched, cached, and synchronized with the UI.

10. UX behavior is driven by client-side concerns rather than server rendering. The app includes theme initialization, dark/light toggling, mobile navigation, toast notifications, loading states, page transitions, and skeleton components. These are presentation-layer concerns that sit above the API boundary and do not affect persistence.

11. Routing and access control are an important frontend boundary. The app distinguishes unauthenticated landing/auth flows from authenticated content flows, and redirects users based on session state. That means the root route, `/home`, profile pages, and post management screens are guarded by client-side logic informed by the auth slice and backend token validation.

12. Search and discovery are separate experiences layered over the same backend data. The frontend pages for users, posts, trending/discovery, tags, and “who to follow” all consume server endpoints that filter or aggregate MongoDB data. The architecture favors server-side query endpoints over local filtering for these views.

13. Overall data flow is: user action in React -> API helper -> Express route -> controller -> model/database or Cloudinary/email service -> response -> Redux/UI update. The clean separation between presentation, API client, business logic, and persistence is the key structure to capture in an architecture diagram.

Main entry points: [`Backend/controller`](https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Backend/controller) (Controllers), [`Frontend/src/App.jsx`](https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Frontend/src/App.jsx) (App shell), [`Frontend/src/pages`](https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Frontend/src/pages) (Pages), [`Frontend/src/api`](https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Frontend/src/api) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_fe_entry(("Client entry<br/>React bootstrap<br/>[main.jsx]"))
  node_fe_app["App shell<br/>Router shell<br/>[App.jsx]"]
  node_fe_pages["Pages<br/>Screen views"]
  node_fe_components["UI kit<br/>Reusable components"]
  node_fe_api["API client<br/>HTTP modules"]
  node_fe_store[("Redux store<br/>Client state<br/>[store.js]")]
  node_fe_slices["State slices<br/>Redux Toolkit slices"]
  node_fe_theme(("Theme UX<br/>Presentation layer"))
  node_fe_layout["Route layout<br/>UI composition<br/>[MainLayout.jsx]"]
end

subgraph group_backend["Backend"]
  node_be_entry(("Server bootstrap<br/>Express entry<br/>[server.js]"))
  node_be_app["Express app<br/>Express setup<br/>[app.js]"]
  node_be_routes["Routes<br/>API boundary"]
  node_be_ctrl["Controllers<br/>Business logic"]
  node_be_mw["Middleware<br/>Request guards"]
  node_be_models[("Models<br/>Mongoose schemas")]
  node_be_utils["Utilities<br/>Shared helpers"]
  node_be_data[("Data stores<br/>MongoDB + Cloudinary<br/>[data.js]")]
end

node_fe_entry -->|"boots"| node_fe_app
node_fe_app -->|"routes to"| node_fe_pages
node_fe_app -->|"wraps"| node_fe_layout
node_fe_pages -->|"composes"| node_fe_components
node_fe_pages -->|"fetches via"| node_fe_api
node_fe_api -->|"hydrates"| node_fe_store
node_fe_store -->|"combines"| node_fe_slices
node_fe_store -->|"guards"| node_fe_app
node_fe_theme -->|"affects"| node_fe_components
node_fe_api -->|"calls"| node_be_routes
node_be_entry -->|"starts"| node_be_app
node_be_app -->|"mounts"| node_be_routes
node_be_routes -->|"delegates"| node_be_ctrl
node_be_ctrl -->|"uses"| node_be_mw
node_be_ctrl -->|"reads/writes"| node_be_models
node_be_ctrl -->|"uses"| node_be_utils
node_be_models -->|"persists to"| node_be_data
node_be_mw -->|"uploads to"| node_be_data
node_be_utils -->|"supports"| node_be_data

click node_fe_entry "https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Frontend/src/main.jsx"
click node_fe_app "https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Frontend/src/App.jsx"
click node_fe_pages "https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Frontend/src/pages"
click node_fe_components "https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Frontend/src/components"
click node_fe_api "https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Frontend/src/api"
click node_fe_store "https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Frontend/src/app/store.js"
click node_fe_slices "https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Frontend/src/slices"
click node_fe_theme "https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Frontend/src/components/ThemeInitializer.jsx"
click node_fe_layout "https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Frontend/src/components/Layout/MainLayout.jsx"
click node_be_entry "https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Backend/server.js"
click node_be_app "https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Backend/app.js"
click node_be_routes "https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Backend/routes"
click node_be_ctrl "https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Backend/controller"
click node_be_mw "https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Backend/middleware"
click node_be_models "https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Backend/models"
click node_be_utils "https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Backend/utils"
click node_be_data "https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Backend/data/data.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_fe_entry,node_fe_app,node_fe_pages,node_fe_components,node_fe_api,node_fe_store,node_fe_slices,node_fe_theme,node_fe_layout toneBlue
class node_be_entry,node_be_app,node_be_routes,node_be_ctrl,node_be_mw,node_be_models,node_be_utils,node_be_data toneAmber
```

## Components

### Frontend

Vite + React SPA with route-driven UI and centralized state

- [Client entry](https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Frontend/src/main.jsx): React bootstrap · Initializes the SPA and global providers · `Frontend/src/main.jsx`
- [App shell](https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Frontend/src/App.jsx): Router shell · Top-level app composition and route wiring · `Frontend/src/App.jsx`
- [Pages](https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Frontend/src/pages): Screen views · Route-level screens for auth, home, posts, profiles, search, and analytics · `Frontend/src/pages`
- [UI kit](https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Frontend/src/components): Reusable components · Navigation, layout, loaders, post actions, and profile widgets · `Frontend/src/components`
- [API client](https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Frontend/src/api): HTTP modules · Request helpers for auth, posts, comments, and users · `Frontend/src/api`
- [Redux store](https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Frontend/src/app/store.js): Client state · Central state container for session, posts, and theme · `Frontend/src/app/store.js`
- [State slices](https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Frontend/src/slices): Redux Toolkit slices · Auth, post, and theme state reducers and selectors · `Frontend/src/slices`
- [Theme UX](https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Frontend/src/components/ThemeInitializer.jsx): Presentation layer · Theme initialization, page transitions, toasts, loading states, and responsive navigation · `Frontend/src/components/ThemeInitializer.jsx`
- [Route layout](https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Frontend/src/components/Layout/MainLayout.jsx): UI composition · Main layout wrapper that frames authenticated views · `Frontend/src/components/Layout/MainLayout.jsx`

### Backend

Express API with MVC-style business logic and persistence

- [Server bootstrap](https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Backend/server.js): Express entry · Starts the backend process and HTTP server · `Backend/server.js`
- [Express app](https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Backend/app.js): Express setup · Configures middleware and mounts route modules · `Backend/app.js`
- [Routes](https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Backend/routes): API boundary · REST endpoints for auth, posts, comments, follows, and users · `Backend/routes`
- [Controllers](https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Backend/controller): Business logic · Feature handlers for auth, posts, comments, follows, and users · `Backend/controller`
- [Middleware](https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Backend/middleware): Request guards · JWT auth and multipart upload handling · `Backend/middleware`
- [Models](https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Backend/models): Mongoose schemas · User, Post, and Comment persistence models · `Backend/models`
- [Utilities](https://github.com/kanishk1420/bloggify-blogging-platform/tree/main/Backend/utils): Shared helpers · JWT, email, OTP, and file/data conversion helpers · `Backend/utils`
- [Data stores](https://github.com/kanishk1420/bloggify-blogging-platform/blob/main/Backend/data/data.js): MongoDB + Cloudinary · Primary record store plus external media hosting · `Backend/data/data.js`

## Connections

- Client entry → App shell: boots · Client entry initializes the app shell
- App shell → Pages: routes to · App shell selects screen-level views
- App shell → Route layout: wraps · Authenticated views are composed inside the main layout
- Pages → UI kit: composes · Pages assemble reusable UI pieces
- Pages → API client: fetches via · Screens call HTTP modules for server data
- API client → Redux store: hydrates · Responses update centralized client state
- Redux store → State slices: combines · Store is built from feature slices
- Redux store → App shell: guards · Session state drives route access and redirects
- Theme UX → UI kit: affects · Theme and UX helpers influence shared UI behavior
- API client → Routes: calls · Frontend communicates with the backend API boundary
- Server bootstrap → Express app: starts · Server bootstrap loads the Express application
- Express app → Routes: mounts · Express app registers route modules
- Routes → Controllers: delegates · Routes hand off request handling to controllers
- Controllers → Middleware: uses · Protected and upload flows depend on middleware
- Controllers → Models: reads/writes · Controllers implement business operations over persisted entities
- Controllers → Utilities: uses · Controllers rely on JWT, email, OTP, and conversion helpers
- Models → Data stores: persists to · Mongoose models store core data in MongoDB
- Middleware → Data stores: uploads to · Multipart media is routed to Cloudinary while MongoDB stores references
- Utilities → Data stores: supports · Utility helpers support token, email, and file workflows
