# ashiqfury/react-blog-app architecture

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

- Interactive diagram: https://gitdiagram.com/ashiqfury/react-blog-app
- Repository: https://github.com/ashiqfury/react-blog-app

## Overview

#### Purpose and topology
A MERN blog application: a React single-page client consumes a Node/Express REST API backed by MongoDB. Core domain operations cover users/authentication, posts, comments, and categories. The client and API are separate deployable/runtime units.

#### Runtime entry points
- Client bootstraps React from `client/src/index.js`; application routing/layout begins in `client/src/App.js`.
- API process starts at `api/index.js`, with endpoint aggregation in `api/routes/routes.js`.
- Backend requires `MONGO_DB` and a port (documented as `2506`); the frontend is intended to run on port 3000. `api/proxyrc.js` is the API-proxy boundary for local client-to-server requests.

#### Client application shell and navigation
`client/src/App.js` composes route-level screens for home, authentication, post detail, author settings, and writing. Pages in `client/src/pages/Home.jsx`, `client/src/pages/Single.jsx`, and `client/src/pages/Write.jsx` form the primary content lifecycle: browse posts, inspect one post/comments, and create or edit publishing content. Shared presentation/navigation is centralized in `client/src/components/Topbar.jsx`, `client/src/components/Header.jsx`, and `client/src/components/Sidebar.jsx`.

#### Client state and session boundary
Application-wide client state is managed through a Context/Reducer pattern: `client/src/context/Context.js`, `client/src/context/Reducer.js`, and `client/src/context/Action.js`. Browser persistence is isolated in `client/src/localStorage.js`. This is the main boundary between authenticated/user state and route/component consumers, including `client/src/pages/Login.jsx`, `client/src/pages/Register.jsx`, and `client/src/pages/Settings.jsx`.

#### Content presentation and interactions
Post-list and post-detail rendering are separated into reusable components: `client/src/components/Posts.jsx`, `client/src/components/Post.jsx`, and `client/src/components/SinglePost.jsx`. Comment retrieval/display is handled by `client/src/components/Comments.jsx` and `client/src/components/Comment.jsx`. The write page is the client-side authoring boundary, while the API owns persistence and authorization-related server behavior.

#### API routing and domain services
Express routes expose REST resources under `/api`: auth, users, posts, comments, and categories. Route modules are `api/routes/auth.js`, `api/routes/posts.js`, `api/routes/comments.js`, with corresponding user/category modules. `api/routes/routes.js` is the likely route mounting layer; controllers are not separately represented, so route handlers are the API’s domain-operation boundary.

#### Persistence, files, and external services
Mongoose models define the MongoDB persistence layer: `api/models/User.js`, `api/models/Post.js`, `api/models/Comment.js`, and `api/models/Category.js`. The API also has an `api/images` directory, consistent with Multer-backed image upload/storage described by the stack. Client contact functionality is expected to use EmailJS through `REACT_APP_SERVICEID`, `REACT_APP_TEMPLATEID`, and `REACT_APP_USERID`; MongoDB Atlas is configured through `MONGO_DB`.

Main entry points: [`client/src/App.js`](https://github.com/ashiqfury/react-blog-app/blob/master/client/src/App.js) (App Shell & Routes), [`client/src/pages/Login.jsx`](https://github.com/ashiqfury/react-blog-app/blob/master/client/src/pages/Login.jsx) (Auth & Settings Pages), [`client/src/pages/Home.jsx`](https://github.com/ashiqfury/react-blog-app/blob/master/client/src/pages/Home.jsx) (Content Pages), [`api/routes/routes.js`](https://github.com/ashiqfury/react-blog-app/blob/master/api/routes/routes.js) (Route Mounting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React Client"]
  node_client_bootstrap(("React Bootstrap<br/>client entry<br/>[index.js]"))
  node_app_shell["App Shell &amp; Routes<br/>routing shell<br/>[App.js]"]
  node_content_pages["Content Pages<br/>page layer<br/>[Home.jsx]"]
  node_auth_pages["Auth &amp; Settings Pages<br/>page layer<br/>[Login.jsx]"]
  node_shared_ui["Shared Navigation UI<br/>component layer<br/>[Topbar.jsx]"]
  node_post_ui["Post &amp; Comment UI<br/>content components<br/>[Posts.jsx]"]
  node_client_state{{"Session State<br/>context reducer<br/>[Context.js]"}}
  node_browser_storage["Browser Persistence<br/>local storage adapter<br/>[localStorage.js]"]
  node_local_proxy["Local API Proxy<br/>development proxy<br/>[proxyrc.js]"]
end

subgraph group_api["Express API"]
  node_api_entry(("API Process<br/>Express entry<br/>[index.js]"))
  node_route_mounts["Route Mounting<br/>REST router<br/>[routes.js]"]
  node_domain_routes["Auth, User &amp; Post Routes<br/>route handlers<br/>[auth.js]"]
  node_interaction_routes["Comment &amp; Category Routes<br/>route handlers<br/>[comments.js]"]
  node_models["Mongoose Models<br/>persistence models<br/>[User.js]"]
  node_image_storage["Image Storage<br/>upload files"]
end

subgraph group_data["Data &amp; External Services"]
  node_mongodb[("MongoDB Atlas<br/>database")]
  node_emailjs["EmailJS<br/>external email service"]
end

node_client_bootstrap -->|"renders"| node_app_shell
node_app_shell -->|"routes to"| node_content_pages
node_app_shell -->|"routes to"| node_auth_pages
node_app_shell -->|"composes"| node_shared_ui
node_content_pages -->|"uses"| node_post_ui
node_app_shell -->|"provides session"| node_client_state
node_auth_pages -->|"reads and updates"| node_client_state
node_client_state -->|"persists session"| node_browser_storage
node_content_pages -.->|"REST requests"| node_local_proxy
node_auth_pages -.->|"auth requests"| node_local_proxy
node_local_proxy -.->|"forwards locally"| node_api_entry
node_api_entry -->|"registers"| node_route_mounts
node_route_mounts -->|"mounts"| node_domain_routes
node_route_mounts -->|"mounts"| node_interaction_routes
node_domain_routes -->|"persists domain data"| node_models
node_interaction_routes -->|"persists domain data"| node_models
node_models -->|"Mongoose connection"| node_mongodb
node_domain_routes -->|"stores uploads"| node_image_storage
node_auth_pages -.->|"contact email"| node_emailjs

click node_client_bootstrap "https://github.com/ashiqfury/react-blog-app/blob/master/client/src/index.js"
click node_app_shell "https://github.com/ashiqfury/react-blog-app/blob/master/client/src/App.js"
click node_content_pages "https://github.com/ashiqfury/react-blog-app/blob/master/client/src/pages/Home.jsx"
click node_auth_pages "https://github.com/ashiqfury/react-blog-app/blob/master/client/src/pages/Login.jsx"
click node_shared_ui "https://github.com/ashiqfury/react-blog-app/blob/master/client/src/components/Topbar.jsx"
click node_post_ui "https://github.com/ashiqfury/react-blog-app/blob/master/client/src/components/Posts.jsx"
click node_client_state "https://github.com/ashiqfury/react-blog-app/blob/master/client/src/context/Context.js"
click node_browser_storage "https://github.com/ashiqfury/react-blog-app/blob/master/client/src/localStorage.js"
click node_local_proxy "https://github.com/ashiqfury/react-blog-app/blob/master/api/proxyrc.js"
click node_api_entry "https://github.com/ashiqfury/react-blog-app/blob/master/api/index.js"
click node_route_mounts "https://github.com/ashiqfury/react-blog-app/blob/master/api/routes/routes.js"
click node_domain_routes "https://github.com/ashiqfury/react-blog-app/blob/master/api/routes/auth.js"
click node_interaction_routes "https://github.com/ashiqfury/react-blog-app/blob/master/api/routes/comments.js"
click node_models "https://github.com/ashiqfury/react-blog-app/blob/master/api/models/User.js"
click node_image_storage "https://github.com/ashiqfury/react-blog-app/tree/master/api/images"

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_bootstrap,node_app_shell,node_content_pages,node_auth_pages,node_shared_ui,node_post_ui,node_client_state,node_browser_storage,node_local_proxy toneBlue
class node_api_entry,node_route_mounts,node_domain_routes,node_interaction_routes,node_models,node_image_storage toneAmber
class node_mongodb,node_emailjs toneMint
```

## Components

### React Client

Single-page application runtime.

- [React Bootstrap](https://github.com/ashiqfury/react-blog-app/blob/master/client/src/index.js): client entry · `client/src/index.js`
- [App Shell & Routes](https://github.com/ashiqfury/react-blog-app/blob/master/client/src/App.js): routing shell · Composes route-level screens and shared layout. · `client/src/App.js`
- [Content Pages](https://github.com/ashiqfury/react-blog-app/blob/master/client/src/pages/Home.jsx): page layer · Browse, detail, and authoring flows. · `client/src/pages/Home.jsx`
- [Auth & Settings Pages](https://github.com/ashiqfury/react-blog-app/blob/master/client/src/pages/Login.jsx): page layer · Login, registration, and account settings consumers. · `client/src/pages/Login.jsx`
- [Shared Navigation UI](https://github.com/ashiqfury/react-blog-app/blob/master/client/src/components/Topbar.jsx): component layer · `client/src/components/Topbar.jsx`
- [Post & Comment UI](https://github.com/ashiqfury/react-blog-app/blob/master/client/src/components/Posts.jsx): content components · Renders post lists, post details, and comments. · `client/src/components/Posts.jsx`
- [Session State](https://github.com/ashiqfury/react-blog-app/blob/master/client/src/context/Context.js): context reducer · Global authenticated user state boundary. · `client/src/context/Context.js`
- [Browser Persistence](https://github.com/ashiqfury/react-blog-app/blob/master/client/src/localStorage.js): local storage adapter · `client/src/localStorage.js`
- [Local API Proxy](https://github.com/ashiqfury/react-blog-app/blob/master/api/proxyrc.js): development proxy · Forwards local client API requests to the server. · `api/proxyrc.js`

### Express API

REST API runtime.

- [API Process](https://github.com/ashiqfury/react-blog-app/blob/master/api/index.js): Express entry · `api/index.js`
- [Route Mounting](https://github.com/ashiqfury/react-blog-app/blob/master/api/routes/routes.js): REST router · Mounts /api resource routes. · `api/routes/routes.js`
- [Auth, User & Post Routes](https://github.com/ashiqfury/react-blog-app/blob/master/api/routes/auth.js): route handlers · Authentication, user, and post domain operations. · `api/routes/auth.js`
- [Comment & Category Routes](https://github.com/ashiqfury/react-blog-app/blob/master/api/routes/comments.js): route handlers · Comment and category domain operations. · `api/routes/comments.js`
- [Mongoose Models](https://github.com/ashiqfury/react-blog-app/blob/master/api/models/User.js): persistence models · User, post, comment, and category schemas. · `api/models/User.js`
- [Image Storage](https://github.com/ashiqfury/react-blog-app/tree/master/api/images): upload files · Multer-backed local image storage. · `api/images`

### Data & External Services

- **MongoDB Atlas**: database · Configured through MONGO_DB.
- **EmailJS**: external email service · Used by client contact functionality.

## Connections

- React Bootstrap → App Shell & Routes: renders
- App Shell & Routes → Content Pages: routes to
- App Shell & Routes → Auth & Settings Pages: routes to
- App Shell & Routes → Shared Navigation UI: composes
- Content Pages → Post & Comment UI: uses
- App Shell & Routes → Session State: provides session
- Auth & Settings Pages → Session State: reads and updates
- Session State → Browser Persistence: persists session
- Content Pages → Local API Proxy: REST requests
- Auth & Settings Pages → Local API Proxy: auth requests
- Local API Proxy → API Process: forwards locally
- API Process → Route Mounting: registers
- Route Mounting → Auth, User & Post Routes: mounts
- Route Mounting → Comment & Category Routes: mounts
- Auth, User & Post Routes → Mongoose Models: persists domain data
- Comment & Category Routes → Mongoose Models: persists domain data
- Mongoose Models → MongoDB Atlas: Mongoose connection
- Auth, User & Post Routes → Image Storage: stores uploads
- Auth & Settings Pages → EmailJS: contact email
