How mustafa-j-wardeh17/full-stack-ecommerce-mnrn works
Project type and purpose
• ByteVault is a full-stack eCommerce platform.
• Frontend: Next.js + Tailwind + shadcn UI, CSR/SSR hybrid, Context API for user state.
• Backend: NestJS monolith with modules (cart, products, orders, users), uses Mongoose/MongoDB, JWT auth, Stripe payment, Cloudinary image storage, Nodemailer mailer.
File structure
• Top level:
• backend/ – NestJS application (controllers, services, modules, schemas, repositories, middleware, interceptors, exception filters)
• frontend/ – Next.js app (app directory with nested layouts/pages, shared components, context, utilities)
• backend/src folders indicate a layered architecture:
• controllers → services → shared/repositories → shared/schemas
• middleware (auth, roles), interceptors, exception filters
• frontend/src shows feature-oriented routing under app/(auth), app/(root), app/dashboard
• Config and env: backend config/default.json, frontend .env.local, CI/ESLint, Prettier, Tailwind, PostCSS, Next config
README for additional insights
• Confirms tech stack, architectural patterns (global error handling, standardized API responses, modular design)
• Third-party integrations: Stripe, Cloudinary, Nodemailer, MongoDB, JWT
Main components & relationships
a. Components
• Client Browser (React/Next.js)
• Next.js App Server (SSR/CSR)
• API Gateway (NestJS application)
• MongoDB database
• File Storage
• Local uploads folder (temporary)
• Cloudinary (product image management)
• External Services: Stripe (checkout/webhook), Mailgun/Nodemailer (email notifications)
b. Interactions
1. Client ↔ Next.js: page requests, API calls (using fetch/Axios to NEXT_PUBLIC_API_URL)
2. Next.js ↔ NestJS: calls REST API under prefix /api/v1
3. NestJS controllers → service layer → repositories → MongoDB
4. On image upload: NestJS → Cloudinary API → store URL
5. On checkout: NestJS → Stripe API (redirect to Stripe, handle webhook)
6. On auth/email events: NestJS → Nodemailer/Mailgun → send emails
c. Architectural patterns
• Monolithic service with modularization
• Layered architecture: controller → service → repository → data source
• Global interceptors (response formatting) and exception filters
• Middleware for authentication & role-based authorization
• Next.js file-system routing for frontend features
d. Key technologies
• NestJS, Mongoose, JWT, Stripe SDK, Cloudinary SDK, Nodemailer
• Next.js, shadcn UI, Tailwind CSS, Framer Motion, React Context API