This project is a complete real-time retail logistics management system built using FastAPI, Kafka, MongoDB, and Gemini AI. It allows retail stores to maintain inventory, monitor low stock, process sales, and auto-optimize restock deliveries using vehicle capacity constraints and AI-generated SCM strategies.
Youtube link explaining the project: https://www.youtube.com/watch?v=mMhBD4ASmDo
- Backend: FastAPI
- Database: MongoDB
- Messaging Queue: Apache Kafka
- AI Integration: Gemini API (RAG for SCM strategy)
- Testing: Postman, Kafka UI
- Containerization: Docker (optional)
- Monitoring: Health check endpoints
- Store, Product & Inventory Management
- Real-time Sale & Stock Updates
- Auto-generated Restock Requests (threshold-based)
- Low-stock analytics alerts
- Vehicle-based delivery fulfillment optimization
- AI-prompt generation for SCM strategies (via Gemini)
- Kafka event streaming across the system
Base URL: http://localhost:8001
GET /healthTests service, database, and Kafka connectivity.
POST /api/v1/storesCreates a new store with location, manager, capacity.
POST /api/v1/productsAdds new product metadata to the catalog.
POST /api/v1/inventoryLinks a product to a store’s inventory.
POST /api/v1/salesLogs customer purchases, deducts stock.
POST /api/v1/restock-requestsTriggers a manual restock for a store-product.
GET /api/v1/inventory?store_id=STORE001GET /api/v1/analytics/low-stock-alertsGET /api/v1/analytics/inventory-summaryPUT /api/v1/inventory/{store_id}/{product_id}POST /api/v1/vehicles
GET /api/v1/vehiclesCRUD operations for delivery vehicles.
POST /api/v1/fulfillment/process-requestAssigns vehicles based on store demands and delivery constraints.
GET /api/v1/ai/generate-promptReturns structured SCM prompt and Gemini suggestion.
- Health check
- Create store
- Add product
- Add inventory item
- Record sale (repeat to trigger low stock)
- Fetch low stock alerts
- Create restock request
- Process fulfillment
- Generate AI strategy
Check Kafka UI (http://localhost:8080) for event logs:
sales-eventsinventory-updatesrestock-requestsfulfillment-events
- Duplicate store/product
- Oversell inventory
- Malformed/invalid requests
/inventory_service/
/fulfillment_service/
/models/
/kafka_client/
/utils/
/tests/
/docs/
main.py
{
"scm_prompt": "How can we optimize van delivery for STORE001 needing 20 units of PROD001?",
"gemini_response": "Suggest sending 2 vans of type A and B with combined capacity of 1000kg."
}Tejas Venugopalan – GitHub
📩 tenacioustejas@gmail.com