An ML-powered inventory management system built for kirana (small retail) stores — a FastAPI backend with Prophet-based demand forecasting, paired with a cross-platform Expo mobile app for managers and cashiers.
ShelfSense/
├── BackEnd/ # Python REST API + ML forecasting
│ ├── core/ # Auth/security, reorder-alert logic
│ ├── database/ # Schema, ER diagram
│ ├── ml/ # Prophet demand forecasting
│ ├── models/ # SQLAlchemy models
│ ├── routers/ # API endpoints (auth, inventory, sales, orders, payments, predictions, alerts, staff)
│ └── schemas/ # Pydantic request/response schemas
└── MobileApp/ # Expo React Native app (manager + cashier roles)
├── app/(auth)/ # Manager / cashier login
├── app/(manager)/ # Dashboard, inventory, alerts, staff management
├── app/(cashier)/ # Point-of-sale
└── stores/ # Zustand state (auth, cart)
Note: the previous React web dashboard (
FrontEnd/) has been removed from this branch — the project now consists of the backend API and the mobile app only.
- 🔐 Multi-role auth — Shop owner/manager registration & JWT login, plus manager-created cashier accounts with their own login
- 🗃️ Inventory management — Add, edit, delete, and track products with per-shop categories and suppliers
- 🔎 Product search — Lookup by name or SKU/barcode for fast POS scanning
- 🛒 Point of Sale (POS) — Order creation, Razorpay checkout, and server-side payment signature verification
- 📈 Sales logging & summaries — Per-shop sales history and aggregated summaries
- 🤖 ML demand forecasting — Prophet-based per-SKU and category-level forecasts, holiday-aware, with a rule-based fallback for low-history products
- 🔔 Reorder alerts — Automatic low-stock/out-of-stock detection on startup with a resolution workflow and recommended reorder quantities
- 👥 Staff management — Managers can create, deactivate, and reactivate cashier accounts
- 📱 Mobile app — Role-based navigation (manager tabs vs. cashier POS) built with Expo Router, secure token storage, and offline-friendly state via Zustand
| Layer | Technology |
|---|---|
| Backend | Python, FastAPI, SQLAlchemy, Alembic, PostgreSQL |
| Auth | JWT (python-jose), bcrypt (passlib) |
| ML | Prophet, pandas, holidays |
| Payments | Razorpay |
| Mobile | React Native (Expo 54), Expo Router, TypeScript, Zustand, Axios, expo-secure-store |
| Charts | react-native-gifted-charts |
- Node.js v18+
- Python 3.10+
- PostgreSQL
- Expo Go app (for mobile) or an Android/iOS dev build (Razorpay checkout requires a dev build — it's disabled in Expo Go)
git clone <repo-url>
cd ShelfSensecd BackEnd
pip install -r ../requirements.txtCreate a .env file in BackEnd/:
DATABASE_URL=postgresql://user:password@localhost:5432/shelfsense_db
SECRET_KEY=your_secret_key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=10080
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secretRun the server:
uvicorn main:app --reloadBackend runs on http://localhost:8000 (interactive docs at /docs)
cd MobileApp
npm installCreate a .env file in MobileApp/:
EXPO_PUBLIC_API_URL=http://<your-local-ip>:8000Start Expo:
# Set your machine's hotspot/LAN IP
$env:REACT_NATIVE_PACKAGER_HOSTNAME="192.168.x.x" # PowerShell
npx expo start --clearScan the QR code with Expo Go, or run npx expo run:android / npx expo run:ios for a dev build (required to test Razorpay checkout).
Best setup for development:
- Connect laptop to Ethernet
- Share connection via Mobile Hotspot to your phone
- Find your hotspot IP:
ipconfig→ look for192.168.137.1 - Set
REACT_NATIVE_PACKAGER_HOSTNAMEto that IP - Run
npx expo start --clearand scan the QR
The project uses PostgreSQL. To set up the database:
psql -U postgres -c "CREATE DATABASE shelfsense_db;"
psql -U postgres -d shelfsense_db -f BackEnd/database/schema.sqlAn ER diagram is available at BackEnd/database/er.png.
This project is for educational purposes.