How nghiavn1/notetaking-app works
Project type and purpose
• This is a MERN-stack (MongoDB, Express, React, Node.js) note-taking application with two distinct frontends:
a) “admin/frontend” – an administrative dashboard client.
b) “frontend” – the end-user note-taking client.
• The backend (“backend” directory) is an Express/Node.js REST API using Mongoose models for notes, users, labels, checklists, trash, and authentication via JWT.
File structure
• Top-level services:
• admin/frontend (React app)
• frontend (React app)
• backend (Node.js/Express API)
• Infrastructure as code:
• compose.yaml (defines multi-container Docker Compose setup)
• Dockerfiles under “frontend” and “backend”
• build-deploy.sh (deployment script)
• GitHub workflows for Docker publish & auto-deploy
• Backend: organized into src/configs, controllers, middlewares, models, routes, utils.
• Frontends share typical React/Vite setup with components, routes, context, and API client wrappers under frontend/api.
README
• Title: “mern-notetaking-app.”
a. Main components to include
• Admin Web Client (React/Vite)
• User Web Client (React/Vite)
• REST API Server (Node.js + Express)
• MongoDB Database
• Authentication Service (JWT module in backend)
• Docker & Orchestration (Docker Compose)
• CI/CD Pipeline (GitHub Actions workflows)
b. Relationships & interactions
– Both React frontends ↔ HTTP(S) ↔ REST API
– REST API ↔ MongoDB (via Mongoose)
– REST API issues and verifies JWT tokens for protected routes (auth middleware)
– Docker Compose spins up API and DB containers; frontends can be containerized/deployed separately
– GitHub Actions → builds Docker images → pushes to registry → triggers build-deploy.sh / auto-deploy
c. Architectural patterns & principles
– Layered architecture in backend (controllers → services/models → database)
– Separation of concerns: two distinct UIs (admin vs. end-user) consuming shared API
– Stateless RESTful API with token-based (JWT) authentication
– Infrastructure as code and containerization for reproducible deployments
d. Key technologies
– React + Vite for UIs
– Node.js + Express for API
– MongoDB + Mongoose for persistence
– JSON Web Tokens (JWT) for auth
– Docker, Docker Compose for container orchestration
– GitHub Actions for CI/CD