SmartStock AI
AI-powered inventory management — forecasting, natural-language analytics, RAG and autonomous purchasing.
Inventory, forecasting and analytics in one platform
Inventory intelligence
Plain-question access to inventory insight
Natural-language analytics
Agent-driven purchasing recommendations from forecast and policy
Autonomous purchasing
SmartStock AI is an AI-powered inventory management platform combining inventory intelligence, demand forecasting, natural-language analytics, autonomous purchasing workflows, RAG-based knowledge retrieval, vector search, multiple LLM providers, background processing, monitoring, and production-oriented infrastructure.
Inventory management breaks down the same way everywhere: demand is guessed instead of forecast, real insight is locked in dashboards only specialists can read, and purchasing decisions lag behind the data because nothing acts on it automatically. Answers that should take seconds take a query-writing session instead.
SmartStock AI treats the problem as a data plus AI problem. Inventory state lives in PostgreSQL with pgvector for semantic retrieval. A demand-forecasting pipeline built on Prophet produces forward-looking signals. A natural-language analytics layer turns plain questions into safe, executed queries, and autonomous purchasing agents act on forecast and policy. A RAG pipeline grounds every LLM answer in the organisation's own knowledge, and Langfuse keeps each AI call observable.
SmartStock AI is an ITI graduation project built as a team. The repository is owned by a team member (Eng-Ayman-Mohamed). Mostafa's role focused on the relevant full-stack / AI engineering work documented in this case study — Django REST, React/TypeScript, Celery/Redis, PostgreSQL/pgvector, RAG, LangChain, Docker and CI/CD.
How data moves through the system.
A separate React SPA on top of a Django REST API, with background workers and an AI/ML layer.
- 01React Frontend
- 02REST API
- 03Django Services
- 04PostgreSQL / Redis
- 05Background Workers
- 06AI / ML Components
- 01Inventory management
- 02Demand forecasting with Prophet
- 03Natural-language analytics
- 04AI-powered inventory analysis
- 05Autonomous purchasing agents
- 06RAG-based knowledge retrieval
- 07Vector search with pgvector
- 08Multi-provider LLM integration (OpenAI, Cohere, Groq, Gemini)
- 09Voice-in queries with Whisper
- 10Background processing with Celery
- 11Monitoring and observability
- 12REST API
Inventory, forecasting and analytics in one platform
Inventory intelligence
Plain-question access to inventory insight
Natural-language analytics
Agent-driven purchasing recommendations from forecast and policy
Autonomous purchasing
RAG over company knowledge with vector retrieval
Grounded answers
Every LLM call traced through Langfuse
Observable AI
Docker, CI, monitoring and alerting infrastructure
Production-oriented
Feature-based Django applications following clean architecture, with a separate React SPA. Services are split by concern — inventory, forecasting, analytics, purchasing, retrieval and LLM integration — so the AI layer stays decoupled from business logic.
A provider abstraction over OpenAI, Cohere, Groq and Gemini routes each task to the most appropriate model: cheap and fast for classification, strong for generation. Whisper handles voice-in natural-language queries. Every call is traced in Langfuse.
Product, supplier and inventory-policy documents are embedded and indexed in pgvector. Queries are retrieved over the vector index and grounded with those results before generation, so answers cite the organisation's own knowledge instead of the model's priors.
Prophet models historical demand to produce forward-looking forecasts. Those signals feed both the natural-language analytics layer and the purchasing agents.
Inventory analysis is exposed through natural language — ask about stock levels, trends or reorder pressure and get a grounded answer backed by live data.
Agents compare forecast demand against current stock and configured policies, then raise purchasing recommendations through the REST API for review and execution.
PostgreSQL 16 with pgvector for vector search; Redis for caching, queues and ephemeral state. Schema is managed with Django migrations.
A Django REST Framework API with typed endpoints for inventory, forecasts, analytics, retrieval and purchasing.
Prometheus collects metrics, Grafana visualises them, Alertmanager routes alerts, and Langfuse provides full tracing for AI and LLM calls.
pytest, pytest-django and pytest-cov for coverage reporting, with Ruff for linting and formatting.
Docker and Docker Compose for containerised environments, GitHub Actions for CI, Railway for deployment, and Nginx as the reverse proxy.
- Integrating multiple LLM providers behind a single interface without coupling business logic to any one vendor.
- Keeping RAG answers grounded in the organisation's own documents rather than the model's prior knowledge.
- Co-ordinating background forecasting and purchasing jobs so they stay consistent with live inventory state.
- Making natural-language analytics safe to run against real business data.
- Observability across traditional services and AI calls in one coherent view.
- A provider-agnostic LLM layer is worth the abstraction as soon as you care about cost and quality.
- Grounding retrieval beats prompt length — pgvector keeps knowledge inside PostgreSQL.
- Background jobs need the same discipline as request handlers: idempotency and observability.
- AI features are only trustworthy when every step is traceable.