UrbanCart is a modern, full-featured MERN e-commerce platform built with Next.js, React, MongoDB, and Express.js. It provides a seamless shopping experience with role-based access control, comprehensive product management, and complete order processing.
- Browse and search products with advanced filtering
- Product details with ratings and reviews
- Shopping cart with persistent storage
- Checkout with multiple payment options
- Order tracking and history
- User profile management
- Wishlist functionality
- Promo code support
- Comprehensive dashboard with analytics
- Product management (CRUD operations)
- Order management and tracking
- User management
- Revenue and sales metrics
- Vendor dashboard with sales metrics
- Product listing and management
- Order tracking for vendor products
- Revenue analytics
- Role-based access control (RBAC)
- Secure authentication with JWT + Cookies
- Responsive mobile-first design
- Premium dark/light theme support
- Real-time cart updates
- Multiple promo codes (SAVE20, FLAT50, SUMMER30)
- Product filtering and search
- Order confirmation and tracking
Frontend:
- Next.js 16 (React 19)
- TypeScript
- Tailwind CSS v4
- Lucide Icons
- Client-side state management with localStorage
Backend:
- Node.js + Express.js (via Next.js API Routes)
- MongoDB for data storage
- JWT for authentication
- Bcrypt for password hashing
Deployment:
- Vercel (recommended)
- MongoDB Atlas (cloud database)
- Node.js 18+
- MongoDB connection (local or Atlas)
- npm or yarn
-
Clone the repository: ```bash git clone cd urbancart ```
-
Install dependencies: ```bash npm install ```
-
Create
.env.localfile: ```env MONGODB_URI=mongodb+srv://user:password@cluster.mongodb.net/urbancart JWT_SECRET=your-secret-key-here ``` -
Run development server: ```bash npm run dev ```
-
Open http://localhost:3000 in your browser
- Email:
customer@example.com - Password:
customer123
- Email:
vendor@example.com - Password:
vendor123
- Email:
admin@example.com - Password:
admin123
- SAVE20: 20% off entire purchase
- FLAT50: $50 off orders over $200
- SUMMER30: 30% off selected items
GET /api/products- Get all products (with filtering)GET /api/products/:id- Get product detailsPOST /api/products- Create product (admin/vendor)PUT /api/products/:id- Update product (admin/vendor)DELETE /api/products/:id- Delete product (admin)
POST /api/auth/register- Register new userPOST /api/auth/login- Login user
POST /api/orders- Create orderGET /api/orders- Get user's ordersGET /api/orders/:id- Get order details
``` urbancart/ ├── app/ │ ├── api/ # API routes │ ├── admin/ # Admin dashboard │ ├── vendor/ # Vendor dashboard │ ├── products/ # Product pages │ ├── cart/ # Shopping cart │ ├── checkout/ # Checkout page │ ├── login/ # Login page │ ├── register/ # Registration page │ └── layout.tsx # Root layout ├── components/ │ ├── navbar.tsx # Navigation bar │ ├── product-card.tsx # Product card component │ └── ui/ # UI components ├── lib/ │ ├── db.ts # Database connection │ ├── auth.ts # Authentication utilities │ └── seed-data.ts # Sample data ├── public/ # Static assets └── globals.css # Global styles ```
- JWT-based authentication
- Cookie-based session management
- Role-based access control (RBAC)
- Protected routes and API endpoints
- Advanced product search and filtering
- Category-based browsing
- Price range filtering
- Product ratings and reviews
- Stock management
- Multiple product images
- Persistent cart storage
- Real-time cart updates
- Quantity management
- Cart summary with totals
- Multi-step checkout process
- Shipping address collection
- Payment information handling
- Order confirmation
- Order tracking
- Email notifications
- Sales analytics
- User management
- Product management
- Order management
- Revenue tracking
- Sales metrics
- Product management
- Order tracking
- Revenue analytics
- Mobile-first approach
- Fully responsive on all screen sizes
- Touch-friendly interfaces
- Optimized for performance
- Password hashing with bcrypt
- JWT token validation
- CORS protection
- Input validation
- SQL injection prevention (MongoDB)
- Secure cookie storage
- Server-side rendering with Next.js
- Image optimization
- Code splitting
- Lazy loading
- Efficient database queries
- Payment gateway integration (Stripe)
- Email notifications
- Advanced analytics
- Inventory management
- Supplier management
- Product recommendations
- Social media integration
- Mobile app version
- Two-factor authentication
- Multi-language support
- Verify MongoDB URI in
.env.local - Check MongoDB Atlas IP whitelist
- Ensure database credentials are correct
- Clear browser cache and localStorage
- Check JWT_SECRET environment variable
- Verify cookie settings in browser
- Check MongoDB collections exist
- Verify product data structure
- Check browser console for errors
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License.
For issues and questions:
- Create an issue in the repository
- Contact: support@urbancart.example.com
Visit UrbanCart at: [deployment-url]
Made with ❤️ by UrbanCart Team ```