How ashiqfury/react-blog-app works
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: App.js App Shell & Routes · Login.jsx Auth & Settings Pages · Home.jsx Content Pages · routes.js Route Mounting
Components 17
React Client
Single-page application runtime.
- React Bootstrap
client/src/index.js - App Shell & Routes · Composes route-level screens and shared layout.
client/src/App.js - Content Pages · Browse, detail, and authoring flows.
client/src/pages/Home.jsx - Auth & Settings Pages · Login, registration, and account settings consumers.
client/src/pages/Login.jsx - Shared Navigation UI
client/src/components/Topbar.jsx - Post & Comment UI · Renders post lists, post details, and comments.
client/src/components/Posts.jsx - Session State · Global authenticated user state boundary.
client/src/context/Context.js - Browser Persistence
client/src/localStorage.js - Local API Proxy · Forwards local client API requests to the server.
api/proxyrc.js
Express API
REST API runtime.
- API Process
api/index.js - Route Mounting · Mounts /api resource routes.
api/routes/routes.js - Auth, User & Post Routes · Authentication, user, and post domain operations.
api/routes/auth.js - Comment & Category Routes · Comment and category domain operations.
api/routes/comments.js - Mongoose Models · User, post, comment, and category schemas.
api/models/User.js - Image Storage · Multer-backed local image storage.
api/images
Data & External Services
- MongoDB Atlas · Configured through MONGO_DB.
- EmailJS · Used by client contact functionality.
Connections 19
- 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