A complete e-commerce platform for a mobile shop with separate customer website, admin dashboard, and backend API.
Partha/
├── api/ # Backend Express API (Node.js + TypeScript + MySQL)
├── customer/ # Customer-facing React app
├── admin/ # Admin dashboard React app
└── README.md
- Node.js + Express + TypeScript
- MySQL with Prisma ORM
- JWT Authentication
- Cloudinary for image storage
- React 18 + TypeScript
- Vite
- Tailwind CSS
- Zustand (State Management)
- React Query
- Framer Motion
- React 18 + TypeScript
- Vite
- Tailwind CSS
- Zustand (State Management)
- React Query
- TanStack Table
- Node.js (v18 or higher)
- MySQL Database (Hostinger)
- Cloudinary account (for image storage)
cd api
npm install
# Create .env file (copy from env.template):
# cp env.template .env
# Then edit .env and add your actual credentials:
# - DATABASE_URL with your MySQL connection string
# - JWT_SECRET and JWT_REFRESH_SECRET (generate strong secrets)
# - Cloudinary credentials from your Cloudinary dashboard
# - PORT, CUSTOMER_URL, ADMIN_URL
# Generate Prisma Client
npm run prisma:generate
# Run database migrations
npm run prisma:migrate
# Start development server
npm run devcd customer
npm install
# Create .env file (optional):
# VITE_API_URL=http://localhost:5000/api
# Start development server
npm run devThe customer website will run on http://localhost:5173
cd admin
npm install
# Create .env file (optional):
# VITE_API_URL=http://localhost:5000/api
# Start development server
npm run devThe admin dashboard will run on http://localhost:5174
The project uses MySQL database. Configure your connection in the .env file:
The connection string format:
DATABASE_URL="mysql://username:password@host:port/database"
Note: If your password contains special characters, URL-encode them:
!becomes%21:becomes%3A- etc.
- User registration and login
- Product browsing with filters and search
- Product details with image carousel
- Shopping cart management
- Wishlist functionality
- Checkout with Cash on Delivery
- Order history
- User profile and address management
- Admin authentication
- Dashboard with analytics
- Product management (CRUD)
- Order management and status updates
- User management (view, block/unblock)
- Category and brand management
- RESTful API endpoints
- JWT-based authentication
- Role-based access control
- Product CRUD operations
- Cart and order management
- User and admin management
- Dashboard analytics
POST /api/auth/register- User registrationPOST /api/auth/login- User/Admin loginPOST /api/auth/refresh- Refresh tokenGET /api/auth/profile- Get user profilePOST /api/auth/logout- Logout
GET /api/products- Get all products (with filters)GET /api/products/:id- Get product by IDGET /api/products/slug/:slug- Get product by slugPOST /api/products- Create product (Admin)PUT /api/products/:id- Update product (Admin)DELETE /api/products/:id- Delete product (Admin)
GET /api/cart- Get user cartPOST /api/cart- Add to cartPUT /api/cart/:id- Update cart itemDELETE /api/cart/:id- Remove from cart
POST /api/orders- Create orderGET /api/orders- Get user ordersGET /api/orders/:id- Get order details
GET /api/admin/dashboard- Dashboard statsGET /api/admin/orders- Get all ordersPUT /api/admin/orders/:id/status- Update order statusGET /api/admin/users- Get all usersPUT /api/admin/users/:id/block- Toggle user block status
- Start the API server:
cd api && npm run dev- Start the customer website:
cd customer && npm run dev- Start the admin dashboard:
cd admin && npm run devcd api
npm run build
npm startcd customer
npm run build
# Serve the dist/ folder with a web servercd admin
npm run build
# Serve the dist/ folder with a web server- JWT tokens are used for authentication
- Passwords are hashed using bcrypt
- CORS is configured for specific origins
- Rate limiting is implemented
- Input validation on all endpoints
- Role-based access control for admin routes
This project is proprietary software.