Skip to content

amit171ku/AI-inventory-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– AI Inventory Management System

A full-stack AI-powered inventory management system with demand forecasting, real-time analytics, automated alerts, and role-based access control.

Tech Stack Tech Stack Tech Stack Tech Stack Deploy


🌐 Live Demo

πŸ”— Frontend: https://your-app.vercel.app
πŸ”— Backend API: https://your-backend.render.com/docs


✨ Features

πŸ” Authentication & Security

  • 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: Admin Manager Staff Viewer
  • bcrypt password hashing

πŸ“¦ Inventory Management

  • 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

πŸ“Š AI Demand Forecasting

  • 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

πŸ“ˆ Analytics Dashboard

  • 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)

πŸ”” Smart Notifications

  • Priority-based alerts: Critical β†’ Warning β†’ Info
  • Out-of-stock, low stock, dead stock detection
  • Lightweight navbar badge (polling every 30s)

πŸ€– AI Assistant

  • Natural language inventory queries
  • Rule-based engine: stock levels, value, trends
  • Inventory snapshot sidebar
  • Quick-ask prompts

πŸ‘₯ User Management

  • Create / update / deactivate users
  • Inline role change from table
  • Last login tracking

πŸ› οΈ Tech Stack

Layer Technology
Frontend React.js, TailwindCSS, Recharts, Framer Motion
Backend FastAPI, SQLAlchemy, SQLite
Auth JWT (PyJWT), bcrypt
ML ARIMA (statsmodels), pandas, numpy
Email Gmail SMTP (smtplib)
Deploy Vercel (frontend), Render (backend)

πŸ“ Project Structure

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

πŸš€ Getting Started

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • Git

Backend Setup

# 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 file

Create 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 8001

API docs: http://127.0.0.1:8001/docs


Frontend Setup

cd ../frontend

# 1. Install dependencies
npm install

# 2. Create .env file

Create frontend/.env:

VITE_API_URL=http://127.0.0.1:8001
# 3. Start dev server
npm run dev

App: http://localhost:5173


πŸ”‘ Default Login

Create your first admin user via API: POST /auth/create-user with { "email": "admin@test.com", "password": "123456", "role": "admin" }


πŸ“Έ Screenshots

Dashboard Analytics
dashboard analytics
Inventory AI Assistant
inventory ai

🌍 Deployment

Frontend β†’ Vercel

cd frontend
npm run build
# Push to GitHub β†’ Vercel auto-deploys

Backend β†’ Render

  1. New Web Service β†’ Connect GitHub repo
  2. Root directory: backend
  3. Build command: pip install -r requirements.txt
  4. Start command: uvicorn app.main:app --host 0.0.0.0 --port 10000
  5. Add environment variables from .env

πŸ“‹ API Endpoints

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

πŸ‘¨β€πŸ’» Author

Amit Sharma
πŸ“§ sharmaamit55174@gmail.com
πŸ”— LinkedIn
πŸ™ GitHub


πŸ“„ License

MIT License β€” feel free to use and modify.


Made with ❀️ using React + FastAPI

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors