An AI-assisted inventory management dashboard for exploring supply-chain data, asking natural-language questions, generating governed SQL plans, viewing KPIs, and exporting results.
The project combines a FastAPI backend, DuckDB analytics database, Gemini-powered agent orchestration, and a React/Vite frontend.
- Natural-language inventory analysis through a governed AI agent flow
- Role-based login for Analyst, Supervisor, Auditor, and Admin users
- DuckDB-backed inventory data loaded from Excel
- KPI calculations, rule checks, SQL templates, and audit logging
- Interactive React dashboard with tables and visualizations
- CSV and JSON export endpoints
- Backend tests for auth, health checks, orchestration, and planning
- Backend: Python, FastAPI, DuckDB, Pandas
- AI: Google Gemini API
- Auth: JWT, bcrypt
- Frontend: React, TypeScript, Vite, Tailwind CSS, Chart.js
- Testing: Pytest, HTTPX
.
|-- agents/ # Agent router and pipeline logic
|-- frontend/ # React/Vite frontend
|-- static/ # Built/static frontend assets
|-- tests/ # Backend test suite
|-- auth.py # JWT and password helpers
|-- bootstrap_data.py # Excel and DuckDB bootstrap logic
|-- config.py # Environment-driven app config
|-- main.py # FastAPI app and API routes
|-- requirements.txt # Python dependencies
`-- run_server.bat # Windows backend launcher
git clone https://github.com/iamkarandeepsingh/Inventory-Management-System-.git
cd Inventory-Management-System-python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txtCreate a .env file in the project root:
GEMINI_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-2.5-flash
JWT_SECRET=replace_with_a_long_random_secret
DUCKDB_PATH=./data/inventory.duckdb
JWT_EXPIRE_MINUTES=480Do not commit .env. It is already ignored by Git.
On Windows, run:
run_server.batOr start FastAPI directly:
python -m uvicorn main:app --reload --host localhost --port 8001The app will be available at:
- App: http://localhost:8001
- API docs: http://localhost:8001/docs
- Health check: http://localhost:8001/api/health
cd frontend
npm install
npm run devWhen the database is initialized, these development users are seeded:
| Username | Password | Role |
|---|---|---|
analyst |
analyst123 |
Analyst |
supervisor |
supervisor123 |
Supervisor |
auditor |
auditor123 |
Auditor |
admin |
admin123 |
Admin |
For production, change seeded credentials and set a strong JWT_SECRET.
POST /api/auth/login- sign in and receive a JWTGET /api/auth/me- return the authenticated userGET /api/health- service health checkPOST /api/chat- submit an inventory question to the AI agentGET /api/export/csv- export query results as CSVGET /api/export/json- export query results as JSON
pytest.env,.venv, Python caches, pytest caches, DuckDB files, frontend dependencies, and generated app assets are ignored.- The tracked Excel workbook is used as the seed data source for the inventory database.
- A local file named
import os.pyis ignored because it was used for scratch experimentation and should not be uploaded.




