Welcome to the ecommerce-mern project.
This documentation serves as a technical guide for engineers, providing an in-depth understanding of the codebase, architecture, and integration points.
This project leverages the MERN stack:
- MongoDB for the database
- Express.js for the backend framework
- React for the frontend
- Node.js as the runtime environment
ecommerce-mern/
βββ client/ # React frontend (UI, routing, pages, components)
βββ server/ # Node.js backend (API, models, controllers, middleware)
βββ .env # Environment variables
βββ package.json- User registration & login with hashed passwords
- JWT-based authentication
- Role-based access (User & Admin)
- Category CRUD (Create, Read, Update, Delete)
- Product CRUD with image upload
- Manage orders & update order status
- Browse products by category & price filters
- Search & pagination
- View product details & similar products
- Add to cart & checkout
- Manage profile & orders
- Encrypted passwords with bcrypt
- JWT-protected routes
- Admin-only access controls
- Online payment gateway support
git clone https://github.com/your-username/ecommerce-mern.git
cd ecommerce-merncd server
npm install- Create a
.envfile inserver/:
PORT=8080
MONGO_URL=your_mongo_connection_url
JWT_SECRET=your_jwt_secret- Start the backend server:
npm startcd client
npm install
npm start- Frontend will run on β
http://localhost:3000 - Backend will run on β
http://localhost:8080
- Register β User submits details β Password hashed β Saved in MongoDB
- Login β JWT generated & returned β Stored in local storage
- Protected Routes β Token verified by middleware (
requireSignIn,isAdmin)