🔗 Live Demo: LIVE LINK
- About
- Features
- Tech Stack
- Project Structure
- Getting Started
- API Overview
- Security Notes
- Roadmap
- Contributing
- Author
E-Commerce is a full-stack online shopping platform built on the MERN stack (MongoDB, Express, React, Node.js). The backend exposes a REST API covering authentication, product catalog management, order processing, payments, and admin-facing sales analytics, with a React front end consuming it.
Beyond being a working store, this project doubles as a system design playground — it's the base I'm extending with caching, event streaming, and service decomposition as it grows (see Roadmap).
- 🔐 Secure Authentication — JWT-based sessions with hashed passwords (
bcryptjs) and httpOnly cookies - 🛍️ Product Catalog — Endpoints for browsing and managing products
- 📦 Order Management — Place, track, and manage orders
- 💳 Payments — Checkout integration via Razorpay
- 🖼️ Image Uploads — Product images handled with Multer and hosted on Cloudinary
- 📧 Transactional Emails — Order and account emails via Brevo
- 📊 Admin Analytics — Dedicated analytics endpoints for sales and order insight
- 🌐 CORS-Ready API — Configured for a separately hosted client, with credentialed cross-origin requests
Backend
| Category | Technology |
|---|---|
| Runtime | Node.js |
| Framework | Express 5 |
| Database | MongoDB + Mongoose |
| Authentication | JSON Web Tokens (jsonwebtoken), bcryptjs, cookie-parser |
| Payments | Razorpay |
| Media Handling | Cloudinary, Multer |
| Brevo | |
| Config | dotenv |
| HTTP Client | Axios |
Frontend
| Category | Technology |
|---|---|
| Library | React |
Dev Tooling
concurrently— runs the client and server together in developmentcors— cross-origin resource sharing control
E-Commerce/
├── backend/
│ ├── config/
│ │ └── dbConnect.js # MongoDB connection setup
│ └── routes/
│ ├── auth.js # /api/auth
│ ├── productRoute.js # /api/products
│ ├── orderRoute.js # /api/orders
│ └── analyticsRoute.js # /api/analytics
├── frontend/ # React client app
├── index.js # Express app entry point
├── package.json
└── .gitignore
- Node.js 18+ and npm
- A MongoDB instance (local or MongoDB Atlas)
- API credentials for Cloudinary, Razorpay, and Resend (for full functionality)
# Clone the repository
git clone https://github.com/Garvit711/E-Commerce.git
cd E-Commerce
# Install both backend and frontend dependencies
npm run install-allCreate a .env file in the project root:
# Server
PORT=8000
CLIENT_URL=http://localhost:3000
# Database
MONGO_URI=your_mongodb_connection_string
# Auth
JWT_SECRET=your_jwt_secret
# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Razorpay
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret
# Email
BREVO_API_KEY=your_brevo_api_keyVariable names above follow common convention — double-check them against whatever
backend/configand the route/controller files actually read, and adjust as the implementation evolves.
If the frontend needs to know the API's base URL, add a separate .env inside frontend/ (e.g. REACT_APP_API_URL=http://localhost:8000).
# Run backend + frontend together
npm run dev
# Or run them individually
npm run dev:server # backend only → http://localhost:8000
npm run dev:client # frontend only → http://localhost:3000npm run buildAll routes are mounted under /api:
| Route | Handles |
|---|---|
/api/auth |
User registration, login, logout, and session handling |
/api/products |
Product listing, details, and catalog management |
/api/orders |
Order creation, retrieval, and status updates |
/api/analytics |
Sales and order analytics (admin-facing) |
- Passwords are hashed with bcrypt.js before storage — plaintext is never persisted
- Sessions use JWTs delivered via httpOnly cookies (
cookie-parser), reducing exposure to XSS token theft - CORS is locked to a single configured
CLIENT_URLwith credentials enabled, rather than left open to all origins trust proxyis enabled so secure cookies and client IPs resolve correctly behind a reverse proxy (e.g. Render, Railway, or similar platforms)
Planned enhancements as the project grows into a more distributed system:
- Redis caching for hot reads (product catalog, sessions)
- Kafka-based event streaming for order and inventory events
- Decomposition into microservices (auth, catalog, orders, payments)
- Docker +
docker-composefor local multi-container orchestration - CI/CD pipeline via GitHub Actions
- Rate limiting and request throttling
- Background job processing for emails and notifications
- Product search
Contributions, issues, and feature requests are welcome.
- Fork the repo
- Create your feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
Garvit
- GitHub: @Garvit711
- Repository: Garvit711/E-Commerce
If you found this project useful, consider giving it a ⭐