How adeeltahir-se/personal-blogs works
Project Type and Purpose
• This is a full-stack Personal Blog Application.
• Frontend: React (Vite, JSX, TailwindCSS) serving public Guest and Admin UIs.
• Backend: Node.js/Express providing a REST API, basic file-based data store (JSON files), and authentication.
File Structure Analysis
• Top-level: “index.html”, “public/” (static assets), “src/” (React code), build/config files (package.json, vite.config.js, tailwind.config.js, postcss.config.js).
• src/ breaks into two feature areas:
• Admin (Login.jsx, Dashboard.jsx, Add.jsx, Edit.jsx)
• Guest (Home.jsx, Article.jsx)
• backend/: Express server files (server.js, router.js, authentication.js) and JSON files acting as the database (users.json, db.json, log.json).
• Config: eslint.config.js for linting, package.json/package-lock.json for dependencies.
Key Insights from README
• Admin user flow: login → CRUD blog posts → view posts.
• Guest user flow: browse published posts.
• No external DB; uses local JSON files.
a. Main Components
• Browser (Guest/Admin UI)
• Frontend App (React + Vite)
• Backend API Server (Express)
• File-based Data Store (db.json, users.json, log.json)
• Authentication Module (authentication.js)
• Router (router.js)
b. Interactions/Data Flow
1. Browser sends HTTP(S) requests to Frontend via Vite dev server or served static build.
2. Frontend makes REST calls (fetch/axios) to Backend API endpoints.
3. Backend → authentication.js validates credentials against users.json.
4. router.js directs requests:
• CRUD on blog posts ↔ db.json
• Logging actions → log.json
5. Responses propagate back to Frontend for UI updates.
c. Architectural Patterns & Principles
• MVC-light: router (Controller) → JSON data (Model) → Express responses (View).
• Single-Page Application (SPA) for front-end, RESTful API for server.
• Separation of concerns: UI, API, Data Storage.
d. Key Technologies
• React (+JSX)
• Vite Dev/Build
• TailwindCSS
• Node.js + Express
• JSON-based file datastore