Mahila is an e-commerce platform built with Next.js and MongoDB for data storage. Users can browse products and add items to cart. (Stripe payments have been removed; the cart flow ends at the checkout step.)
This project also serves as our Final Year Project (FYP). As part of the FYP, we fine-tuned the IDM-VITON model for virtual try-on and wired it into the store as a live API widget: the user uploads their picture (or picks a preset model), selects a product, and the widget generates a preview of that product worn on them.
- Model: IDM-VITON, fine-tuned for this project
- Serving: the fine-tuned model runs on a RunPod serverless GPU endpoint; the app submits a job (person image + garment image) and polls for the result
- UI flow: upload your photo or choose a preset model → select a product → generate → view/download the try-on result
The app is connected to a live MongoDB database, and /inventory is a password-protected admin dashboard built on top of it for running the store day to day:
- Dashboard overview: total products, total SKUs, units on hand, low-stock alerts, total sales, total profit
- Product management: add, edit, and delete products, sizes/variants, and pricing
- Image management: upload and update product pictures directly from the dashboard
- Collections & styles: manage product collections and styles shown on the storefront
- Barcode/QR labels: generate and print scannable price labels per product
- Admin login: session-based auth (signed cookie) gates access to the dashboard
- Live Database: MongoDB-backed product, cart, and inventory data
- No Authentication Required (storefront): Session-based cart system using localStorage
- Automatic User Creation: User accounts created during Stripe checkout
- Secure Payments: Stripe integration with webhook support
- MongoDB Storage: Cart items, users, and orders stored in MongoDB
- Responsive Design: Built with Tailwind CSS
- AI Virtual Try-On: Fine-tuned IDM-VITON model, served via a RunPod API widget (FYP feature)
- Inventory Dashboard:
/inventoryadmin panel to manage products, stock, and pictures (see below)
- Node.js 18+ installed
- MongoDB Atlas account (free tier available)
- Stripe account (test mode works fine)
-
Clone the repository
git clone <your-repo-url> cd mahila
-
Install dependencies
npm install
-
Set up environment variables
Copy
.env.exampleto.envand fill in your values:cp .env.example .env
Required variables:
# MongoDB MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/ecommerce # Stripe STRIPE_SECRET_KEY=sk_test_your_key NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_your_key STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
-
Set up Stripe Webhook
For local development, use Stripe CLI:
stripe listen --forward-to localhost:3000/api/webhook
For production, add webhook endpoint in Stripe Dashboard:
- URL:
https://yourdomain.com/api/webhook - Event:
checkout.session.completed
- URL:
-
Run the development server
npm run dev
-
Open your browser
Navigate to http://localhost:3000
- Unique session ID generated per browser
- Stored in localStorage
- Cart persists across page reloads
- No sign-in required
- User adds products to cart
- Clicks "Proceed to Checkout"
- Redirected to Stripe Checkout page
- Stripe collects: email, name, phone, addresses
- After payment success:
- Webhook triggers user creation
- User data saved to MongoDB
- Order recorded
- Cart automatically cleared
- cart: Temporary cart items with session IDs
- users: Customer information (created at checkout)
- orders: Order history and details
Use Stripe test card for testing:
- Card Number:
4242 4242 4242 4242 - Expiry: Any future date
- CVC: Any 3 digits
- ZIP: Any 5 digits
This project was recently migrated from:
- ❌ Clerk Authentication → ✅ Session-based cart
- ❌ PostgreSQL/Drizzle → ✅ MongoDB
- ❌ Pre-checkout user creation → ✅ Checkout-time user creation
See MIGRATION_GUIDE.md for detailed migration notes.
- Framework: Next.js 15
- Database: MongoDB
- Payments: Stripe
- Styling: Tailwind CSS
- Language: TypeScript
- AI Try-On: Fine-tuned IDM-VITON served on RunPod serverless GPU
- Push your code to GitHub
- Import project in Vercel
- Add environment variables
- Update Stripe webhook URL to production domain
- Deploy!
This project is open source and available under the MIT License.
Contributions, issues, and feature requests are welcome!