A full-stack AI-powered inventory management system with demand forecasting, real-time analytics, automated alerts, and role-based access control.
π Frontend: https://your-app.vercel.app
π Backend API: https://your-backend.render.com/docs
- JWT-based login with Remember Me (7 days)
- OTP-based forgot password via Gmail SMTP
- Admin notification on every password reset request
- Role-based access:
AdminManagerStaffViewer - bcrypt password hashing
- Add, edit, soft-delete products
- SKU-based duplicate detection
- Bulk CSV upload with row-wise error reporting
- Stock history with full audit trail (before/after values)
- Reorder point & reorder quantity per product
- ARIMA model with auto order selection
- Per-product forecast with confidence intervals
- Days-of-stock-left prediction
- Fallback to Moving Average for short data series
- KPI cards: inventory value, SKUs, orders, out-of-stock count
- Bar chart, Pie chart, Line chart (Recharts)
- Top selling products, turnover rate, stock status table
- AI-generated insights (danger / warning / info)
- Priority-based alerts: Critical β Warning β Info
- Out-of-stock, low stock, dead stock detection
- Lightweight navbar badge (polling every 30s)
- Natural language inventory queries
- Rule-based engine: stock levels, value, trends
- Inventory snapshot sidebar
- Quick-ask prompts
- Create / update / deactivate users
- Inline role change from table
- Last login tracking
| Layer | Technology |
|---|---|
| Frontend | React.js, TailwindCSS, Recharts, Framer Motion |
| Backend | FastAPI, SQLAlchemy, SQLite |
| Auth | JWT (PyJWT), bcrypt |
| ML | ARIMA (statsmodels), pandas, numpy |
| Gmail SMTP (smtplib) | |
| Deploy | Vercel (frontend), Render (backend) |
ai-inventory-system/
βββ frontend/
β βββ src/
β β βββ components/ # Layout, Header, Sidebar, ProtectedRoute
β β βββ context/ # AuthContext
β β βββ pages/ # Dashboard, Inventory, Orders, Analytics...
β β βββ services/ # productAPI.js (axios)
β β βββ hooks/
β βββ ...
β
βββ backend/
β βββ app/
β βββ routes/ # auth, product, orders, suppliers, analytics...
β βββ ml/ # forecast_model.py (ARIMA)
β βββ models.py # SQLAlchemy models
β βββ schemas.py # Pydantic schemas
β βββ database.py # DB config
β βββ main.py # FastAPI app
βββ README.md
- Python 3.10+
- Node.js 18+
- Git
# 1. Clone the repo
git clone https://github.com/your-username/ai-inventory-system.git
cd ai-inventory-system/backend
# 2. Install dependencies
pip install fastapi uvicorn sqlalchemy pydantic bcrypt PyJWT
pip install pandas numpy statsmodels
# 3. Create .env fileCreate backend/.env:
JWT_SECRET=your-secret-key-here
SENDER_EMAIL=your-gmail@gmail.com
SENDER_PASSWORD=your-16-digit-app-password
APP_NAME=AI Inventory System
FRONTEND_URL=http://localhost:5173# 4. Run migration (first time only)
python migrate.py
# 5. Start server
python -m uvicorn app.main:app --reload --port 8001API docs: http://127.0.0.1:8001/docs
cd ../frontend
# 1. Install dependencies
npm install
# 2. Create .env fileCreate frontend/.env:
VITE_API_URL=http://127.0.0.1:8001# 3. Start dev server
npm run devApp: http://localhost:5173
Create your first admin user via API:
POST /auth/create-userwith{ "email": "admin@test.com", "password": "123456", "role": "admin" }
| Dashboard | Analytics |
|---|---|
![]() |
![]() |
| Inventory | AI Assistant |
|---|---|
![]() |
![]() |
cd frontend
npm run build
# Push to GitHub β Vercel auto-deploys- New Web Service β Connect GitHub repo
- Root directory:
backend - Build command:
pip install -r requirements.txt - Start command:
uvicorn app.main:app --host 0.0.0.0 --port 10000 - Add environment variables from
.env
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/login |
Login with JWT |
| POST | /auth/forgot-password |
Send OTP |
| POST | /auth/verify-otp |
Verify OTP |
| POST | /auth/reset-password |
Reset password |
| GET | /products/ |
Get all products |
| POST | /products/ |
Create product |
| GET | /analytics/ |
Full analytics |
| GET | /forecast/{id} |
Product forecast |
| GET | /notifications/ |
Get alerts |
| GET | /ai/ask?question= |
AI assistant |
Amit Sharma
π§ sharmaamit55174@gmail.com
π LinkedIn
π GitHub
MIT License β feel free to use and modify.
Made with β€οΈ using React + FastAPI



