A full-stack E-Commerce platform built with React, Node.js, and MongoDB. This project includes a complete online shopping experience with user authentication, product management, shopping cart, order processing, and admin dashboard.
-
User Authentication & Authorization
- JWT-based authentication
- Email verification
- Password reset functionality
- Role-based access control (User/Admin)
- Social login integration ready
-
Product Management
- Product catalog with categories
- Advanced search and filtering
- Product variants and options
- Image management
- Inventory tracking
- SEO-friendly URLs
-
Shopping Experience
- Shopping cart with persistence
- Guest cart support
- Wishlist functionality
- Product reviews and ratings
- Related products
- Discount codes
-
Order Management
- Secure checkout process
- Multiple payment methods (Stripe integration)
- Order tracking
- Email notifications
- Order history
- Invoice generation
-
Admin Dashboard
- Product CRUD operations
- Order management
- User management
- Sales analytics
- Review moderation
- Inventory management
-
Frontend
- React 18 with Vite
- Redux Toolkit for state management
- Tailwind CSS for styling
- Responsive design
- Progressive Web App ready
-
Backend
- Node.js with Express
- MongoDB with Mongoose
- JWT authentication
- File upload support
- Email integration
- Payment processing
-
Security
- JWT token authentication
- Password hashing with bcrypt
- Rate limiting
- CORS protection
- Input validation
- XSS protection
- Framework: React 18
- Build Tool: Vite
- State Management: Redux Toolkit
- Styling: Tailwind CSS
- Routing: React Router DOM
- HTTP Client: Axios
- UI Components: Headless UI, Heroicons
- Notifications: React Hot Toast
- Runtime: Node.js (v22.14.0)
- Framework: Express.js
- Database: MongoDB
- ODM: Mongoose
- Authentication: JWT
- Email: Nodemailer
- File Upload: Multer
- Payment: Stripe
- Security: Helmet, CORS, Rate Limiting
E-Commerce/
โโโ frontend/ # React frontend application
โ โโโ src/
โ โ โโโ components/ # Reusable UI components
โ โ โโโ pages/ # Page components
โ โ โโโ store/ # Redux store and slices
โ โ โโโ contexts/ # React contexts
โ โ โโโ utils/ # Utility functions
โ โ โโโ assets/ # Static assets
โ โโโ public/ # Public assets
โ โโโ package.json
โโโ backend/ # Node.js backend API
โ โโโ models/ # Database models
โ โโโ routes/ # API routes
โ โโโ middleware/ # Custom middleware
โ โโโ controllers/ # Route controllers
โ โโโ utils/ # Utility functions
โ โโโ config/ # Configuration files
โ โโโ server.js # Main server file
โโโ README.md
- Node.js (v18 or higher)
- MongoDB (local or Atlas)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd E-Commerce
-
Install dependencies
# Install backend dependencies cd backend npm install # Install frontend dependencies cd ../frontend npm install
-
Environment Setup
Backend (.env)
PORT=5000 NODE_ENV=development MONGODB_URI=mongodb://localhost:27017/ecommerce JWT_SECRET=your-super-secret-jwt-key-here JWT_EXPIRE=7d FRONTEND_URL=http://localhost:5173 EMAIL_HOST=smtp.gmail.com EMAIL_PORT=587 EMAIL_USER=your-email@gmail.com EMAIL_PASS=your-app-password STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
Frontend (.env)
VITE_API_URL=http://localhost:5000/api
-
Start the development servers
Backend
cd backend npm run devFrontend
cd frontend npm run dev -
Access the application
- Frontend: http://localhost:5173
- Backend API: http://localhost:5000
POST /api/auth/register- Register new userPOST /api/auth/login- User loginPOST /api/auth/verify-email- Verify emailPOST /api/auth/forgot-password- Request password resetGET /api/auth/me- Get current user
GET /api/products- Get all productsGET /api/products/:id- Get single productGET /api/products/featured- Get featured productsGET /api/products/search- Search products
GET /api/cart- Get user cartPOST /api/cart/add- Add item to cartPUT /api/cart/update/:productId- Update cart itemDELETE /api/cart/remove/:productId- Remove item from cart
POST /api/orders- Create new orderGET /api/orders- Get user ordersGET /api/orders/:id- Get single order
For complete API documentation, see the Backend README.
The frontend includes a comprehensive set of reusable components:
- Layout: Navbar, Footer, Sidebar
- Forms: Input, Button, Select, Checkbox
- Cards: ProductCard, OrderCard, ReviewCard
- Modals: ConfirmDialog, ImageModal
- Navigation: Breadcrumbs, Pagination
- Feedback: LoadingSpinner, ErrorBoundary
- Registration: User registers with email/password
- Email Verification: Verification email sent automatically
- Login: JWT token issued upon successful login
- Protected Routes: Token required for authenticated endpoints
- Token Refresh: Automatic token validation on app load
- Browse Products: Users can browse and search products
- Add to Cart: Products can be added to cart (guest or authenticated)
- Cart Management: Update quantities, apply discounts
- Checkout: Secure checkout with address and payment info
- Order Confirmation: Email confirmation and order tracking
- Dashboard: Sales analytics and overview
- Product Management: CRUD operations for products
- Order Management: View and update order status
- User Management: Manage user accounts and roles
- Review Moderation: Approve/reject product reviews
- Set up MongoDB (Atlas recommended)
- Configure environment variables
- Deploy to Heroku, Vercel, or any Node.js platform
- Build the application:
npm run build - Deploy to Vercel, Netlify, or any static hosting platform
Ensure all required environment variables are set in production:
- Database connection string
- JWT secret
- Email configuration
- Payment API keys
- Frontend URL
cd backend
npm testcd frontend
npm test- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support and questions:
- Create an issue in the repository
- Check the documentation
- Review the API endpoints
- Mobile App: React Native version
- Advanced Analytics: Detailed sales and user analytics
- Multi-language Support: Internationalization
- Advanced Search: Elasticsearch integration
- Real-time Features: WebSocket integration
- PWA Features: Offline support, push notifications
- Social Login: Google, Facebook, Apple integration
- Advanced Payment: Multiple payment gateways
- Inventory Management: Advanced stock tracking
- Marketing Tools: Email campaigns, coupons
Built with โค๏ธ using modern web technologies