How nnminh-sam/watch-e-commerce-nestjs works
Project type and purpose
• This is a monolithic back-end API service for an e-commerce store (Watch E-Commerce).
• Built with NestJS (TypeScript), it exposes REST endpoints for authentication, product/brand/category management, cart, orders and transactions.
• It persists data in MongoDB (replica set or single instance) and uses Redis for cart sessions and token black-listing.
File structure
• Top-level configuration: Dockerfile, docker-compose.yml (spins up API + Mongo replica set), docker-compose-single-mongo.yml available.
• src/commons: global decorators, DTOs, filters, guards, interceptors, pipes — cross-cutting concerns for request validation, auth, response shaping, logging.
• src/database: database.module bootstraps Mongoose connections; Redis services for cart and token black-list.
• src/environment: centralized environment variable management.
• src/models: Mongoose schema definitions for all domain entities (User, Product, Order, Cart, Transaction, etc.).
• src/modules: feature modules (auth, user, product, brand, category, cart, order, transaction, jwt-manager, logger). Each follows NestJS pattern: controller → service → repository (where needed) → DTOs → strategies.
• test: end-to-end tests.
Key insights from README
• Emphasis on MongoDB replication topology or single instance via docker-compose.
• No other external dependencies beyond Redis, Mongo and the NestJS API itself.