How rohitkumarsingh0111/quickblog works
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: Layout.jsx Admin Layout · adminController.js adminController · App.jsx App.jsx · adminRoutes.js admin routes
Components 26
Client SPA
React/Vite single-page app for public browsing and admin operations
- main.jsx · Client bootstrap and render entry point
client/src/main.jsx - App.jsx · Top-level SPA composition and route wiring
client/src/App.jsx - AppContext · Shared client state and API coordination
client/src/context/AppContext.jsx - Home · Landing page for blog discovery
client/src/pages/Home.jsx - Blog · Single-post reading view
client/src/pages/Blog.jsx - BlogList · Blog feed/list rendering component
client/src/components/BlogList.jsx - BlogCard · Preview card for individual posts
client/src/components/BlogCard.jsx - Newsletter · Public subscription or capture component
client/src/components/Newsletter.jsx - Admin Layout · Admin area wrapper and navigation framing
client/src/pages/admin/Layout.jsx - Dashboard · Admin overview and metrics screen
client/src/pages/admin/Dashboard.jsx - AddBlog · Create-new-post workflow
client/src/pages/admin/AddBlog.jsx - ListBlog · Post management screen
client/src/pages/admin/ListBlog.jsx - Comment · Comment moderation screen
client/src/pages/admin/Comment.jsx - Login · Admin authentication entry form
client/src/components/admin/Login.jsx
Server API
Node/Express backend with routing, controllers, middleware, and models
- server.js · Express application bootstrap and runtime wiring
server/server.js - blog routes · Public content endpoints
server/routes/blogRoutes.js - admin routes · Admin capability endpoints
server/routes/adminRoutes.js - blogController · Blog request handling and business logic
server/controllers/blogController.js - adminController · Admin request handling and business logic
server/controllers/adminController.js - auth · Admin access protection
server/middleware/auth.js - multer · File upload ingestion
server/middleware/multer.js
Data & Services
Persistence and external integrations used by the backend
- db.js · Database connection setup
server/configs/db.js - Blog · Post persistence model
server/models/Blog.js - Comment · Comment persistence model
server/models/Comment.js - ImageKit · Image storage and delivery integration
server/configs/imageKit.js - Gemini · AI integration for content assistance
server/configs/gemini.js
Connections 27
- 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