- Overview
- Features
- Tech Stack
- Architecture
- Quick Start
- API Documentation
- Screenshots
- Deployment
- Performance & Security
- Contributing
- License
ShopEasy is a full-stack MERN-based e-commerce platform designed for speed, security, and scalability. It provides users with a seamless shopping experience β from browsing products to secure checkout β while offering admins powerful tools for managing products, orders, and analytics.
- β‘ Performance β Redis caching & optimized database queries for lightning-fast responses
- π Security β JWT authentication, bcrypt hashing, Helmet.js protection, and rate limiting
- π Scalability β Modular architecture deployed with Vercel & Railway for effortless scaling
- π³ Integrated Payments β Razorpay checkout with support for multiple payment methods
- π§ Smart Admin Panel β Real-time analytics, revenue tracking, and order insights
- Authentication & Authorization: Secure user registration and login with JWT tokens
- Product Browsing: Browse products with advanced search, filter by category, price range, and ratings
- Shopping Cart: Add, remove, and update product quantities in real-time
- Checkout Flow: Seamless checkout with Cash on Delivery (COD) or Razorpay payment integration
- Order Management: View order history, track shipment status, and download invoices
- User Profile: Edit personal information, manage shipping addresses, and update preferences
- Wishlist: Save favorite products for later purchase
- Product Reviews: Rate and review purchased products
- Product Management: Complete CRUD operations for products with image uploads and inventory tracking
- Category Management: Create, edit, and organize product categories and subcategories
- Order Management: View all orders, update order status, process refunds, and cancel orders
- Analytics Dashboard: Visualize sales trends, revenue metrics, user growth, and popular products
- User Management: View registered users, manage permissions, and monitor user activity
- Inventory Control: Track stock levels, set low-stock alerts, and manage product availability
| Layer | Technologies |
|---|---|
| Frontend | React 18, React Router v6, Context API, Axios, Tailwind CSS, React Query |
| Backend | Node.js, Express.js, MongoDB, Mongoose, Redis, JWT, Bcrypt.js, Razorpay SDK |
| DevOps / Deployment | Vercel (Frontend), Railway (Backend), MongoDB Atlas (Database), Redis Cloud |
| Additional Tools | Helmet.js, Express Rate Limit, Multer, Cors, Dotenv, Nodemailer |
Architecture Overview:
- Client (React + Tailwind): Single-page application with responsive UI and state management via Context API
- API Layer (Express): RESTful API handling authentication, CRUD operations, and business logic
- Redis Cache: High-performance caching for frequently accessed data (products, categories)
- MongoDB Atlas: Persistent storage for products, orders, users, and application data
- Razorpay Gateway: Secure payment processing with webhook support for order confirmation
- Node.js 16.x or higher
- MongoDB Atlas account (or local MongoDB)
- Redis instance (local or cloud)
- Razorpay account for payment integration
1. Clone the repository
git clone https://github.com/yourusername/shopeasy.git
cd shopeasy2. Backend Setup
cd backend
npm install
# Create .env file
cp .env.example .envBackend Environment Variables (.env)
# Server Configuration
PORT=5000
NODE_ENV=development
# Database
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/shopeasy?retryWrites=true&w=majority
# Redis
REDIS_URL=redis://localhost:6379
# Or for Redis Cloud: redis://default:password@redis-12345.c1.cloud.redislabs.com:12345
# JWT Secret
JWT_SECRET=your_super_secret_jwt_key_here
JWT_EXPIRE=7d
# Razorpay
RAZORPAY_KEY_ID=rzp_test_xxxxxxxxxxxxx
RAZORPAY_KEY_SECRET=your_razorpay_secret_key
# Email (Optional - for order confirmations)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
# Frontend URL
CLIENT_URL=http://localhost:30003. Frontend Setup
cd ../frontend
npm install
# Create .env file
cp .env.example .envFrontend Environment Variables (.env)
REACT_APP_API_URL=http://localhost:5000/api
REACT_APP_RAZORPAY_KEY_ID=rzp_test_xxxxxxxxxxxxx4. Run the Application
# Terminal 1 - Backend
cd backend
npm run dev
# Terminal 2 - Frontend
cd frontend
npm startThe application will be available at:
- Frontend:
http://localhost:3000 - Backend API:
http://localhost:5000
Email: admin@shopeasy.com
Password: Admin@123
http://localhost:5000/api
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /auth/register |
Register new user | β |
| POST | /auth/login |
User login | β |
| GET | /auth/profile |
Get user profile | β |
| PUT | /auth/profile |
Update profile | β |
| POST | /auth/logout |
Logout user | β |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /products |
Get all products (with filters) | β |
| GET | /products/:id |
Get product by ID | β |
| POST | /products |
Create product | β (Admin) |
| PUT | /products/:id |
Update product | β (Admin) |
| DELETE | /products/:id |
Delete product | β (Admin) |
| GET | /products/featured |
Get featured products | β |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /categories |
Get all categories | β |
| GET | /categories/:id |
Get category by ID | β |
| POST | /categories |
Create category | β (Admin) |
| PUT | /categories/:id |
Update category | β (Admin) |
| DELETE | /categories/:id |
Delete category | β (Admin) |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /cart |
Get user cart | β |
| POST | /cart/add |
Add item to cart | β |
| PUT | /cart/update/:itemId |
Update cart item quantity | β |
| DELETE | /cart/remove/:itemId |
Remove item from cart | β |
| DELETE | /cart/clear |
Clear entire cart | β |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /orders |
Create new order | β |
| GET | /orders |
Get user orders | β |
| GET | /orders/:id |
Get order by ID | β |
| GET | /orders/admin/all |
Get all orders | β (Admin) |
| PUT | /orders/:id/status |
Update order status | β (Admin) |
| DELETE | /orders/:id |
Cancel order | β |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /payments/create-order |
Create Razorpay order | β |
| POST | /payments/verify |
Verify payment signature | β |
| POST | /payments/webhook |
Razorpay webhook handler | β |
Sample Request - Create Product
POST /api/products
Content-Type: application/json
Authorization: Bearer <your_jwt_token>
{
"name": "Wireless Headphones",
"description": "Premium noise-cancelling headphones",
"price": 2999,
"category": "electronics",
"stock": 50,
"images": ["image_url_1", "image_url_2"],
"featured": true
}Sample Response
{
"success": true,
"data": {
"_id": "64abc123def456789",
"name": "Wireless Headphones",
"price": 2999,
"stock": 50,
"createdAt": "2024-01-15T10:30:00.000Z"
}
}- Push your code to GitHub
- Visit Vercel and import your repository
- Configure environment variables in Vercel dashboard:
REACT_APP_API_URL=https://your-backend.railway.app/api REACT_APP_RAZORPAY_KEY_ID=rzp_live_xxxxxxxxxxxxx - Deploy with one click!
- Create a new project on Railway
- Connect your GitHub repository
- Add environment variables in Railway dashboard:
NODE_ENV=production MONGODB_URI=<your_mongodb_atlas_uri> REDIS_URL=<your_redis_cloud_uri> JWT_SECRET=<strong_secret_key> RAZORPAY_KEY_ID=<live_key_id> RAZORPAY_KEY_SECRET=<live_key_secret> CLIENT_URL=https://your-app.vercel.app - Railway will automatically deploy your backend
- Create a free cluster on MongoDB Atlas
- Whitelist Railway's IP addresses (or allow access from anywhere for development)
- Create a database user with read/write permissions
- Copy the connection string and add to your environment variables
- Run database migrations if needed:
npm run seed # Optional: Seed initial data
- Sign up for Redis Cloud
- Create a free database instance
- Copy the connection URL and add to environment variables
- Test connection from your Railway backend
- Redis Caching: Frequently accessed data (products, categories) cached with 5-minute TTL, reducing database queries by up to 80%
- Database Indexing: Optimized indexes on
productId,userId,category, andcreatedAtfields for faster queries - Lazy Loading: React lazy loading for route-based code splitting, reducing initial bundle size by 40%
- Image Optimization: Images served via CDN with automatic compression and responsive sizing
- API Response Compression: Gzip compression enabled for all API responses
- Connection Pooling: MongoDB connection pool configured for optimal concurrent request handling
- JWT Authentication: Secure token-based authentication with httpOnly cookies and automatic token refresh
- Password Hashing: Bcrypt with 10 salt rounds for secure password storage
- Helmet.js: HTTP headers secured against common vulnerabilities (XSS, clickjacking, MIME sniffing)
- Rate Limiting: API rate limiting (100 requests/15 minutes per IP) to prevent abuse and DDoS attacks
- CORS Configuration: Strict CORS policy allowing only whitelisted frontend domains
- Input Validation: Comprehensive validation and sanitization using express-validator
- SQL Injection Prevention: Mongoose parameterized queries protect against NoSQL injection
- Payment Security: Razorpay signature verification ensures payment authenticity
- Environment Variables: Sensitive data stored securely in environment variables, never committed to repository
- Request logging with Morgan middleware
- Error tracking and monitoring (ready for integration with Sentry)
- Performance metrics tracking with custom middleware
We welcome contributions from the community! Here's how you can help:
- Fork the repository to your GitHub account
- Clone your fork locally:
git clone https://github.com/your-username/shopeasy.git cd shopeasy - Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes and commit:
git add . git commit -m "Add amazing feature"
- Push to your fork:
git push origin feature/amazing-feature
- Open a Pull Request against the
mainbranch with a clear description of your changes
- Write clean, maintainable code following existing patterns
- Include comments for complex logic
- Update documentation for any API or feature changes
- Add tests for new features when possible
- Ensure all tests pass before submitting PR
- Follow the existing code style and formatting
Found a bug or have a feature request? Please open an issue on GitHub with:
- Clear description of the problem or suggestion
- Steps to reproduce (for bugs)
- Expected vs actual behavior
- Screenshots if applicable
This project is licensed under the MIT License. You are free to use, modify, and distribute this software for personal or commercial purposes.
See the LICENSE file for full details.
Built with β€οΈ by Shubz





