How waydansh/mernbloggingwebsite works
Project Type & Purpose
• This is a full-stack MERN (MongoDB, Express, React, Node) blogging website.
• The README describes a blog editor, Google authentication, dynamic pages, search, profiles, dashboard, nested comments, notifications, and mobile responsiveness.
Top-Level Structure
• Frontend (“blogging website – frontend”): a Vite-powered React app, Tailwind CSS, Editor.js integration, AWS/Firebase helper modules.
• Backend (“server”): an Express server (server.js), Mongoose schemas for Blog, Comment, Notification, User; Firebase Admin SDK for auth; uses a MongoDB database.
Main Components
a. Client / Browser (React SPA)
b. Static Hosting / CDN (Netlify or equivalent serving the built dist/)
c. Frontend App
• Routing & Pages (home, blog, dashboard, auth, profile, search, 404)
• Components (editor, blog list, comments, notifications, etc.)
• Common Services:
• Firebase SDK for Google Auth
• AWS SDK (e.g., S3) for media uploads
• API client for Node/Express
d. API Server (Node + Express)
• Authentication Layer (Firebase Admin SDK verifies tokens)
• Business Logic & Controllers (user, blog, comment, notification routes)
• Mongoose Models (User, Blog, Comment, Notification)
e. Database (MongoDB Atlas or Self-hosted)
f. External Services
• Firebase Auth
• AWS S3 (or equivalent) for image storage
g. Optional Dev/Config
• .env files, netlify.toml, postcss.config.js, tailwind.config.js, vite.config.js
Relationships & Data Flows
• User in Browser → (1) Google Auth via Firebase SDK → receives ID token
• Browser → (2) HTTP(S) API requests (with token) to Express server
• Server → (3) Verifies token via Firebase Admin SDK
• Server → (4) Reads/Writes documents in MongoDB
• Server → (5) Uploads/Retrieves media from AWS S3
• Server → (6) Emits or stores notifications in MongoDB
• Browser → (7) Polls or fetches notifications via API
Architectural Patterns & Principles
• Frontend: Component-based UI, Single-Page Application, client-side routing
• Backend: RESTful API, MVC-style separation with Mongoose models + controllers
• Stateless auth with JWT (Firebase)
• Externalizing media storage & auth to cloud services