My Market is a full-stack multi-platform e-commerce application developed for the SBU semester project. It includes a Flask backend, a React web frontend, and an Expo React Native mobile client.
- Backend: Flask + MongoDB via
mongoengine - Frontend: React + Vite + client-side role-based routing
- Mobile: Expo React Native app with tab navigation
- Authentication: JWT-based login and profile management
- Image upload: Cloudinary-backed product image storage
- Deployment-ready: Vercel configs for backend and frontend
backend/— Flask API, MongoDB models, authentication, cart, orders, product managementfrontend/— React web application with protected pages for customers, sellers, and adminsmobile/— Expo mobile app with bottom tabs and seller/customer flows
- Customer — browse products, manage cart, checkout, view order history, update profile
- Seller — add/edit/delete products, manage inventory, view seller orders, analytics, ledger
- Admin — manage users, view all orders, access admin dashboard/analytics
backend/main.py- Registers blueprints for
auth,shop,cart, andorder - Connects to MongoDB using
MONGO_URI - Enables CORS for cross-origin access
-
POST /auth/register— register new users -
POST /auth/login— login and receive JWT -
GET /auth/profile/<user_id>— fetch user profile -
PUT /auth/update_profile/<user_id>— update user profile -
GET /auth/admin/users— list users (admin) -
PATCH /auth/admin/users/<target_id>— change role (admin) -
DELETE /auth/admin/users/<target_id>— delete user (admin) -
GET /shop/product— fetch all products -
POST /shop/product— add product with Cloudinary image upload -
GET /shop/product/<product_id>— get single product -
PATCH /shop/product/<product_id>— update product -
DELETE /shop/product/<product_id>— delete product and image -
POST /shop/seller— fetch products by seller -
PATCH /shop/product/<product_id>/restock— restock product -
GET /shop/seller/ledger— seller ledger history -
POST /cart/add_cart— add/update cart items -
POST /cart/clear_cart— clear cart -
GET /cart/get_cart— get cart for authenticated user -
DELETE /cart/delete_item— remove a cart item -
POST /order/place_order— place an order and clear cart -
GET /order/history— fetch authenticated user order history -
GET /order/seller_orders— get seller-specific orders -
PATCH /order/update_status/<order_id>— update order status -
GET /order/seller_analytics— seller metrics -
GET /order/admin/all— admin all orders -
GET /order/admin/dashboard— admin dashboard stats -
GET /order/admin/analytics— admin analytics
User— fullname, username, email, password, role, addressProduct— name, description, seller, cost_price, price, category, stock_quantity, image_url, specificationsInventoryLog— seller ledger for restocks and expense trackingCart— one cart per user with embeddedCartItemOrder— order items, total amount, status, gateway reference, timestamp
frontend/src/App.jsx- Uses
react-router-domfor routes and role-based protected routes - Includes layouts:
CustomerLayout,SellerLayout,AdminLayout
- Public:
Home,Login,Register,Profile - Customer:
Shop,Cart,Checkout,OrderHistory,ProductDetail - Seller:
AddProduct,ManageInventory,ManageOrders,SellerAnalytics,SellerLedger - Admin:
AdminDashboard,AllOrders,UserControl,AdminAnalytics
frontend/src/api.js— Axios instance with optionalVITE_API_URL
mobile/App.js- Expo app with authentication bootstrap and role-based redirection
- Customer tabs:
Store,Cart,Checkout,History,Profile - Seller tabs:
Inventory,Add,Orders,Analytics,Profile - Uses
AsyncStorage, JWT decoding, andreact-navigation
mobile/app.jsonmobile/package.json
cd backend
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txtCreate a .env file in backend/ with:
MONGO_URI=<your-mongodb-uri>
SECRET_KEY=<your-secret-key>
CLOUDINARY_CLOUD_NAME=<cloudinary-cloud-name>
CLOUDINARY_API_KEY=<cloudinary-api-key>
CLOUDINARY_API_SECRET=<cloudinary-api-secret>Then run:
python main.pycd frontend
npm install
npm run dev- Use
VITE_API_URLinfrontend/.envwhen pointing to a deployed backend - Leave blank for local proxy during development
cd mobile
npm install
npm start- Then open the Expo project in the Expo Go app or emulator
- Flask
- Flask-Cors
- mongoengine
- pymongo
- PyJWT
- python-dotenv
- cloudinary
- react
- react-dom
- react-router-dom
- axios
- zod
- animejs
- react-hook-form
- bootstrap
- tailwindcss
- expo
- react-native
- axios
- jwt-decode
- react-hook-form
- react-navigation
- @react-native-async-storage/async-storage
- twrnc
backend/vercel.jsonis configured for a serverless Flask deploymentfrontend/vercel.jsonrewrites all routes toindex.html- The mobile app is built with Expo and can be published with Expo or EAS
- The backend is designed to work in serverless environments with a delayed MongoDB connection
- Product images upload to Cloudinary and are removed when products are deleted or replaced
- Order processing deducts stock and saves price snapshots for each item
This repository is built for academic/project use and is not intended for commercial release.