How thangtranse/node-express-mongoose-template works
Project type and purpose
• This is a backend‐focused, monolithic RESTful API built with Node.js and Express.
• Its primary features are user authentication (including Google OAuth), JWT access/refresh tokens, file uploads, and a mini CRM for managing customers and posts.
• It uses MongoDB as the primary data store and Redis for token/session storage or caching.
File structure
• Top‐level Docker and CI/CD artifacts:
• Dockerfile, docker-compose.yml, a docker/ directory for MongoDB containers
• GitHub Actions workflows in .github/workflows (CI, CD, branch cleanup, sync)
• src/ directory follows a layered pattern:
• configs/ – Express middleware configuration (CORS, Helmet, Multer)
• constants/ – Shared constants (e.g., campaign codes)
• controllers/ – Routing logic handlers (user, post, CRM customer, transport, static files)
• services/ – Business logic grouped by domain (user, post, uploadFile, crmCustomer)
• models/ – Mongoose schemas and plugins (e.g., soft‐delete)
• routes/ – Express route definitions that invoke controllers
• databases/ – Connection setup for MongoDB (single & multi) and Redis
• helpers/ and utils/ – Token generation, JWT service, validation, logging, file utilities
• Public assets: public/uploads for storing uploaded files, static‐file controller serves them.
• scripts/ contains production startup scripts.
README for additional insights
• Lists out all major services (register, login/logout, Google login, token refresh, list users, upload file, mini CRM).
• Specifies dependencies and environment variables: ports, DB URLs, JWT secrets, Google client ID.
• References Docker images for MongoDB and Redis Commander.