A MERN stack ecommerce website for a handmade resin art brand. The app includes product browsing, JWT authentication, cart management, Cash on Delivery checkout, user order tracking, custom artwork requests, and an admin dashboard for products and orders.
- Frontend: React, React Router, Tailwind CSS, Axios, React Hot Toast
- Backend: Node.js, Express, MongoDB, Mongoose
- Authentication: JWT with protected customer and admin routes
- Payment: Cash on Delivery now, with a backend payment provider structure ready for future gateways
- Product catalogue with responsive handmade resin art UI
- Add to cart, remove from cart, update quantity
- Cart saved in browser local storage
- Checkout page with customer shipping details
- Cash on Delivery as the only active payment method
- Order confirmation page after successful checkout
- User order history and order detail tracking
- Admin product management
- Admin order management with search, status filters, and status updates
- Admin analytics for total orders, pending orders, delivered orders, and revenue
- Custom resin artwork request form, managed separately from ecommerce orders
- Light and dark theme support
client/
src/
components/ Shared UI components
context/ Auth, theme, and cart state
pages/ Home, cart, checkout, orders, admin pages
api/ Axios API client
utils/ Shared frontend helpers
server/
src/
controllers/ Request handlers
models/ MongoDB schemas
routes/ REST API routes
middleware/ JWT auth, admin guard, uploads
services/ Payment provider abstraction
Install dependencies separately if needed:
npm.cmd install --prefix client
npm.cmd install --prefix serverCreate server/.env:
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
CLIENT_URL=http://localhost:5173
PORT=5000Seed demo products and an admin user:
npm.cmd run seed --prefix serverDefault admin login:
- Email:
admin@resinart.local - Password:
admin12345
Start the backend:
npm.cmd start --prefix serverStart the frontend:
npm.cmd run dev --prefix clientOpen:
- Frontend:
http://localhost:5173 - Backend health check:
http://localhost:5000/api/health
- A customer adds products to the cart.
- Cart data is stored in local storage.
- Checkout requires login.
- The customer enters shipping details.
- Cash on Delivery is selected by default.
- The backend validates products, stock, quantities, address, and payment method.
- An order is stored with
payment.method = "cod"andpayment.status = "cod_pending". - The customer is redirected to the order confirmation page.
- The customer can track the order from the order history page.
Admins can update ecommerce order status to:
pendingconfirmedprocessingshippeddeliveredcancelled
The backend uses a payment provider layer:
server/src/services/payments/
codProvider.js
index.js
Only COD is enabled right now. Future gateways such as Razorpay, Stripe, PhonePe, or PayPal can be added by creating a new provider and registering it in services/payments/index.js.
Supported payment status values:
pendingpaidfailedcod_pending
Auth:
POST /api/auth/signupPOST /api/auth/login
Products:
GET /api/productsGET /api/products/:idPOST /api/productsadmin onlyPUT /api/products/:idadmin onlyDELETE /api/products/:idadmin only
Orders:
POST /api/ordersauthenticated customer checkoutGET /api/orders/mineauthenticated customer order historyGET /api/orders/mine/:idauthenticated customer order detailsGET /api/ordersadmin onlyPATCH /api/orders/:idadmin onlyGET /api/orders/admin/analyticsadmin only
Custom requests:
POST /api/orders/customGET /api/orders/customadmin onlyPATCH /api/orders/custom/:idadmin only
Build the frontend:
npm.cmd run build --prefix clientRun backend syntax checks:
node server/src/server.js