A complete e-commerce solution for baby products with a modern client storefront, powerful admin dashboard, and robust backend API.
- Project Overview
- Tech Stack
- Features
- Project Structure
- Installation
- Environment Variables
- Running the Application
- API Documentation
BabyShop is a full-stack e-commerce platform specifically designed for baby products. It consists of three main parts:
| Part | Description | Port |
|---|---|---|
| Client | Customer-facing storefront | 3000 |
| Admin | Dashboard for managing products, orders, users | 5173 |
| Server | RESTful API backend | 5000 |
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 16.1.6 | React framework with App Router & Turbopack |
| React | 19.2.4 | UI library |
| TypeScript | 5.9.3 | Type safety |
| Tailwind CSS | 4.x | Utility-first CSS framework |
| Zustand | 5.0.10 | State management |
| React Hook Form | 7.71.1 | Form handling |
| Zod | 4.3.6 | Schema validation |
| Framer Motion | 12.29.0 | Animations |
| Radix UI | Latest | Accessible UI components |
| Lucide React | 0.539.0 | Icon library |
| Stripe | 20.2.0 | Payment processing |
| Sonner | 2.0.7 | Toast notifications |
| next-themes | 0.4.6 | Dark/Light mode |
| js-cookie | 3.0.5 | Cookie management |
| use-debounce | 10.1.0 | Debounce hooks |
| Technology | Version | Purpose |
|---|---|---|
| React | 19.1.0 | UI library |
| Vite | 7.0.4 | Build tool & dev server |
| TypeScript | 5.8.3 | Type safety |
| Tailwind CSS | 4.1.11 | Utility-first CSS framework |
| React Router | 7.13.0 | Client-side routing |
| Axios | 1.13.2 | HTTP client |
| Zustand | 5.0.10 | State management |
| React Hook Form | 7.71.1 | Form handling |
| Zod | 4.3.6 | Schema validation |
| Recharts | 3.7.0 | Charts & analytics |
| Motion | 12.29.0 | Animations |
| Radix UI | Latest | Accessible UI components |
| Lucide React | 0.539.0 | Icon library |
| React Dropzone | 14.3.8 | File uploads |
| React to Print | 3.2.0 | Invoice printing |
| Sonner | 2.0.7 | Toast notifications |
| next-themes | 0.4.6 | Dark/Light mode |
| Technology | Version | Purpose |
|---|---|---|
| Express | 5.1.0 | Web framework |
| MongoDB | via Mongoose 8.17.1 | Database |
| Mongoose | 8.17.1 | ODM for MongoDB |
| JWT | 9.0.2 | Authentication |
| bcryptjs | 3.0.2 | Password hashing |
| Cloudinary | 2.7.0 | Image storage & CDN |
| Multer | 2.0.2 | File upload handling |
| Stripe | 18.4.0 | Payment processing |
| Nodemailer | 7.0.5 | Email sending |
| Swagger | 6.2.8 | API documentation |
| CORS | 2.8.5 | Cross-origin resource sharing |
| dotenv | 17.2.1 | Environment variables |
| express-async-handler | 1.2.0 | Async error handling |
| Nodemon | 3.1.10 | Development auto-restart |
- Product Browsing - Browse products by categories, brands, search
- Product Details - Detailed product pages with images
- Shopping Cart - Add/remove items, quantity management
- Wishlist - Save favorite products
- User Authentication - Register, login, profile management
- Checkout - Secure checkout with Stripe payment
- Order Tracking - View order history and status
- Responsive Design - Mobile-first responsive UI
- Dark/Light Mode - Theme switching
- Search Functionality - Search products with debounce
- Dashboard - Analytics with charts (Recharts)
- Product Management - CRUD operations for products
- Category Management - Create, edit, delete categories
- Brand Management - Manage product brands
- Banner Management - Homepage banner management
- Order Management - View and update order status
- User Management - View, edit, delete users
- Invoice Management - View and print invoices
- Role-based Access - Admin, User, Deliveryman roles
- RESTful API - Clean API architecture
- JWT Authentication - Secure token-based auth
- Role-based Authorization - Protected routes
- Image Upload - Cloudinary integration
- Payment Processing - Stripe integration
- Email Notifications - Order confirmation emails
- API Documentation - Swagger UI
- Error Handling - Centralized error handling
babyshop-ecommerce/
βββ client/ # Next.js Customer Storefront
β βββ src/
β β βββ app/ # App Router pages
β β β βββ about/ # About page
β β β βββ auth/ # Login, Register
β β β βββ help/ # Help Center
β β β βββ privacy/ # Privacy Policy
β β β βββ product/ # Product details
β β β βββ returns/ # Returns & Refunds
β β β βββ search/ # Search results
β β β βββ shop/ # Shop page
β β β βββ terms/ # Terms & Conditions
β β β βββ success/ # Payment success page
β β β βββ user/ # User pages
β β β β βββ cart/ # Shopping cart
β β β β βββ wishlist/ # Wishlist
β β β β βββ checkout/ # Checkout
β β β β βββ orders/ # Order history
β β β β βββ profile/ # User profile
β β β βββ ...
β β βββ components/ # Reusable components
β β βββ hooks/ # Custom hooks
β β βββ lib/ # Utilities, store, API
β β βββ types/ # TypeScript types
β βββ package.json
β
βββ admin/ # Vite Admin Dashboard
β βββ src/
β β βββ pages/ # Dashboard pages
β β β βββ Dashboard.tsx
β β β βββ Products.tsx
β β β βββ Categories.tsx
β β β βββ Brands.tsx
β β β βββ Banners.tsx
β β β βββ Orders.tsx
β β β βββ Users.tsx
β β β βββ Invoices.tsx
β β β βββ Account.tsx
β β βββ components/ # UI components
β β βββ hooks/ # Custom hooks
β β βββ lib/ # Utilities, API
β β βββ store/ # Zustand store
β βββ package.json
β
βββ server/ # Express Backend API
β βββ config/ # Database & app config
β βββ controllers/ # Request handlers
β βββ middleware/ # Auth & error middleware
β βββ models/ # Mongoose models
β β βββ userModel.js
β β βββ productModel.js
β β βββ categoryModel.js
β β βββ brandModel.js
β β βββ bannerModel.js
β β βββ cartModel.js
β β βββ orderModel.js
β βββ routes/ # API routes
β βββ utils/ # Helper functions
β βββ index.js # Entry point
β βββ package.json
β
βββ README.md
- Node.js 18+
- MongoDB (local or Atlas)
- Stripe account
- Cloudinary account
git clone https://github.com/yourusername/babyshop-ecommerce.git
cd babyshop-ecommerce# Install server dependencies
cd server
npm install
# Install admin dependencies
cd ../admin
npm install
# Install client dependencies
cd ../client
npm install# MongoDB
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/babyshop
# JWT
JWT_SECRET=your_jwt_secret_key
# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Stripe
STRIPE_SECRET_KEY=sk_test_xxx
# Email (Nodemailer)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
# App
PORT=5000
NODE_ENV=developmentNEXT_PUBLIC_API_URL=http://localhost:5000/api
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_xxxVITE_API_URL=http://localhost:5000/apiOpen 3 terminal windows:
# Terminal 1 - Start Server
cd server
npm run dev
# Terminal 2 - Start Admin Dashboard
cd admin
npm run dev
# Terminal 3 - Start Client
cd client
npm run dev| Application | URL |
|---|---|
| Client Store | http://localhost:3000 |
| Admin Dashboard | http://localhost:5173 |
| API Server | http://localhost:5000 |
| API Docs (Swagger) | http://localhost:5000/api-docs |
# Build client
cd client
npm run build
# Build admin
cd ../admin
npm run build
# Start server in production
cd ../server
npm run start:productionThe API documentation is available via Swagger UI at:
http://localhost:5000/api-docs
| Method | Endpoint | Description |
|---|---|---|
| Auth | ||
| POST | /api/auth/register |
Register new user |
| POST | /api/auth/login |
Login user |
| GET | /api/auth/me |
Get current user |
| Products | ||
| GET | /api/products |
Get all products |
| GET | /api/products/:id |
Get product by ID |
| POST | /api/products |
Create product (Admin) |
| PUT | /api/products/:id |
Update product (Admin) |
| DELETE | /api/products/:id |
Delete product (Admin) |
| Categories | ||
| GET | /api/categories |
Get all categories |
| POST | /api/categories |
Create category (Admin) |
| Orders | ||
| GET | /api/orders |
Get user orders |
| GET | /api/orders/admin |
Get all orders (Admin) |
| POST | /api/orders |
Create order |
| PUT | /api/orders/:id/status |
Update order status |
| Users | ||
| GET | /api/users |
Get all users (Admin) |
| PUT | /api/users/:id |
Update user (Admin) |
| DELETE | /api/users/:id |
Delete user (Admin) |
Shoriful Islam
This project is licensed under the ISC License.