| Home Page | Product Page | Cart Page | Admin Dashboard |
|---|---|---|---|
This repository includes both the client (React + Vite + Tailwind CSS) and the server (Node.js + Express + MongoDB) for a full e-commerce application.
Key backend features:
- JWT authentication
- MongoDB with Mongoose
- File uploads via Cloudinary
- Stripe payments
- Cart & order management
Client: React, Vite, Tailwind CSS
Server: Node.js, Express
Database: MongoDB (Mongoose)
Auth: JWT
Payments: Stripe
File Storage: Cloudinary
- Node.js v18+
- npm or yarn
- MongoDB connection URI
- Cloudinary credentials:
- CLOUDINARY_CLOUD_NAME
- CLOUDINARY_API_KEY
- CLOUDINARY_API_SECRET
- Stripe secret key
PORT=4000
MONGODB_URI=<your-mongodb-uri>
JWT_SECRET=<strong-jwt-secret>
CLOUDINARY_CLOUD_NAME=<cloud_name>
CLOUDINARY_API_KEY=<api_key>
CLOUDINARY_API_SECRET=<api_secret>
STRIPE_SECRET_KEY=<stripe_secret_key>
STRIPE_WEBHOOK_SECRET=<stripe_webhook_secret> # optional
COOKIE_SECRET=<cookie-secret> # optional
VITE_API_BASE_URL=http://localhost:4000
# Server
cd server
npm install
# Client
cd ../client
npm installcd server
npm run serve # development with nodemon
# or
npm start # productionDefault port: 4000
cd client
npm run devDefault Vite port: http://localhost:5173
- npm run serve β dev mode with nodemon
- npm start β production
- npm run dev β Vite dev server
- npm run build β production build
- npm run preview β preview build
- GET / β health check
- /api/user/* β user auth & profile
- /api/seller/* β seller functionality
- /api/product/* β products CRUD
- /api/cart/* β cart actions
- /api/address/* β addresses
- /api/order/* β orders & Stripe webhook
Auth header format:
Authorization: Bearer <token>
- Cloudinary config via configs/cloudinary.js
- Stripe integration for payment + optional webhook handling with STRIPE_WEBHOOK_SECRET
Server: Set production environment variables for MongoDB, Stripe, Cloudinary, JWT, etc.
Client: Deploy /dist to services like Netlify, Vercel, Surge, or serve statically via Express.
| Issue | Fix |
|---|---|
| MongoDB connection fails | Ensure valid URI (mongodb+srv:// or mongodb://) |
| Cloudinary not working | Check env variables |
| CORS/cookies broken | Update CORS settings in Express |
| Wrong DB name | Update in server .connect() if needed |
root/
βββ client/ # Frontend (React + Vite)
β βββ src/
β βββ public/
β βββ ...
βββ server/ # Backend (Express + MongoDB)
β βββ routes/
β βββ models/
β βββ controllers/
β βββ configs/
β βββ middleware/
β βββ ...
βββ README.md
π License: Proprietary β Permission Required
If youβd like extra sections (setup screenshots, Docker support, or contribution guidelines), just say the word!