A dynamic e-commerce platform for electronic gadgets enthusiasts, featuring products such as Mobiles, Laptops, TVs, and Refrigerators. The platform emphasizes user engagement, seamless browsing, and an immersive shopping experience using advanced technologies like Next.js, MongoDB, and Express.js.
-
User Management
- User registration and login.
- JWT-based authentication.
- User roles: Admin and Customer.
-
Product Management
- CRUD operations for products (Admin only).
- Categorize products by brand or category.
- Display detailed product information (images, title, description, price, brand/category, and ratings).
-
Flash Sale
- Highlight products marked for flash sales.
- Include countdown timers for flash sale expiration.
-
Search and Filter
- Search products by title or description.
- Filter by category, brand, price range, or ratings.
-
Trending Products
- Showcase top-rated products dynamically.
-
Dashboard
- Admin dashboard with product management features.
-
Frontend Features
- Static and dynamic routing for pages.
- Carousel and visually appealing layouts.
-
Performance Features
- Implement SSG, SSR, and ISR for optimized loading and data updates.
-
Error Handling
- Custom 404 pages.
- Scalability: Ensure the platform supports a growing number of users and products.
- Security: Protect user data and transactions with JWT, secure database connections, and proper error handling.
- Accessibility: Ensure responsive design across devices.
- Deployment: Use Vercel or similar hosting platforms for frontend and deploy backend with services like cyclic.sh.
{
"name": "String",
"email": "String",
"password": "String",
"role": "String", // 'admin' or 'customer'
"createdAt": "Date",
"updatedAt": "Date"
}
{
"title": "String",
"description": "String",
"price": "Number",
"brand": "String",
"category": "String",
"images": ["String"],
"rating": "Number",
"flashSale": "Boolean",
"createdAt": "Date",
"updatedAt": "Date"
}
{
"userId": "ObjectId",
"products": [
{
"productId": "ObjectId",
"quantity": "Number"
}
],
"totalPrice": "Number",
"status": "String", // 'pending', 'completed', 'cancelled'
"createdAt": "Date",
"updatedAt": "Date"
}
const UserSchema = new mongoose.Schema({
name: { type: String, required: true },
email: { type: String, required: true, unique: true },
password: { type: String, required: true },
role: { type: String, enum: ["admin", "customer"], default: "customer" },
createdAt: { type: Date, default: Date.now },
updatedAt: { type: Date, default: Date.now }
});
const ProductSchema = new mongoose.Schema({
title: { type: String, required: true },
description: { type: String, required: true },
price: { type: Number, required: true },
brand: { type: String, required: true },
category: { type: String, required: true },
images: [{ type: String }],
rating: { type: Number, default: 0 },
flashSale: { type: Boolean, default: false },
createdAt: { type: Date, default: Date.now },
updatedAt: { type: Date, default: Date.now }
});
const OrderSchema = new mongoose.Schema({
userId: { type: mongoose.Schema.Types.ObjectId, ref: "User", required: true },
products: [
{
productId: { type: mongoose.Schema.Types.ObjectId, ref: "Product", required: true },
quantity: { type: Number, required: true }
}
],
totalPrice: { type: Number, required: true },
status: { type: String, enum: ["pending", "completed", "cancelled"], default: "pending" },
createdAt: { type: Date, default: Date.now },
updatedAt: { type: Date, default: Date.now }
});
- Entities: User, Product, Order
- Relationships:
- User places multiple Orders.
- Order contains multiple Products.
- Products belong to Categories or Brands.
- A User can place multiple Orders.
- An Order can include multiple Products.
- Products are categorized by Brand or Category.
- POST
/api/register
: Register a new user. - POST
/api/login
: User login.
- GET
/api/products
: Fetch all products with optional filters (brand, category, price, rating). - GET
/api/products/:id
: Fetch single product details. - POST
/api/products
: Add a new product (Admin only). - PUT
/api/products/:id
: Update product details (Admin only). - DELETE
/api/products/:id
: Delete a product (Admin only).
- GET
/api/flash-sale
: Fetch all flash sale products.
- POST
/api/orders
: Place a new order. - GET
/api/orders
: Fetch user orders. - GET
/api/orders/:id
: Fetch single order details.