A Full-Stack Ecommerce application built using MongoDB, Express, React (TypeScript), Node.js with Stripe payment integration, Firebase authentication, and Redis caching.
cd backend
npm install
npm run build # or npm run dev for developmentCreate a .env file in backend/ with:
PORT=4000
MONGO_URI=mongodb://localhost:27017/localmart
STRIPE_KEY=your_stripe_secret_key
PRODUCT_PER_PAGE=8
REDIS_URL=redis://localhost:6379
cd frontend
npm install
npm run dev # start development server
npm run preview # preview production buildCreate a .env file in frontend/ with:
VITE_FIREBASE_KEY=your_firebase_key
VITE_AUTH_DOMAIN=your_firebase_auth_domain
VITE_PROJECT_ID=your_firebase_project_id
VITE_STORAGE_BUCKET=your_firebase_storage_bucket
VITE_MESSAGING_SENDER_ID=your_firebase_sender_id
VITE_APP_ID=your_firebase_app_id
VITE_SERVER=http://localhost:4000
VITE_STRIPE_KEY=your_stripe_publishable_key
- The frontend uses SCSS for modular and scalable styling.
- Global variables and mixins are placed under
/src/styles/. - Each component has its own
.scssfile for encapsulated styling.
POST /api/v1/user/new→ Register new userPOST /api/v1/user/login→ Login userGET /api/v1/user/me→ Get logged-in userGET /api/v1/user/all→ Get all users (Admin only)GET /api/v1/user/:id→ Get user by IDDELETE /api/v1/user/:id→ Delete user (Admin only)
GET /api/v1/product→ Get all productsGET /api/v1/product/:id→ Get single productPOST /api/v1/product/new→ Create product (Admin only)PUT /api/v1/product/:id→ Update product (Admin only)DELETE /api/v1/product/:id→ Delete product (Admin only)
POST /api/v1/order/new→ Place new orderGET /api/v1/order/:id→ Get order detailsGET /api/v1/order/me→ Get my ordersGET /api/v1/admin/orders→ Get all orders (Admin only)PUT /api/v1/admin/order/:id→ Update order status (Admin only)DELETE /api/v1/admin/order/:id→ Delete order (Admin only)
POST /api/v1/payment/create→ Create Stripe payment intentPOST /api/v1/payment/coupon/new→ Create new coupon (Admin only)GET /api/v1/payment/discount→ Apply discountGET /api/v1/payment/coupon/all→ Get all coupons (Admin only)DELETE /api/v1/payment/coupon/:id→ Delete coupon (Admin only)
GET /api/v1/dashboard/stats→ Get dashboard stats (Admin only)GET /api/v1/dashboard/pie→ Get pie chart data (Admin only)GET /api/v1/dashboard/bar→ Get bar chart data (Admin only)GET /api/v1/dashboard/line→ Get line chart data (Admin only)
- Redis is used for caching frequently accessed data (products, stats, etc.).
- Default connection:
redis://localhost:6379 - Configurable via
REDIS_URLin.env.
POST /api/v1/user/new
{
"name": "Alice",
"email": "alice@example.com",
"password": "password123"
}POST /api/v1/product/new
{
"name": "Laptop",
"price": 900,
"stock": 10,
"category": "Electronics",
"description": "Powerful laptop with 16GB RAM"
}- User Authentication (Firebase + JWT)
- Role-based access (Admin / User)
- Product management (CRUD)
- Cart & Orders
- Stripe Payment Integration
- Redis Caching
- SCSS styling
- Admin Dashboard with Stats (Charts, Orders, Users, Coupons)
- Frontend: React (TypeScript), SCSS
- Backend: Node.js, Express.js
- Database: MongoDB
- Cache: Redis
- Auth: Firebase Authentication
- Payments: Stripe