Skip to content

Sudhanshu-NITR/SmartStockX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 SmartStockX: AI-Powered Inventory Optimization

Every unsold item is a missed opportunity. SmartStockX is an intelligent stock revival engine designed to tackle inventory inefficiency head-on. By leveraging machine learning for demand prediction, it provides actionable insights on dynamic pricing and suggests optimal inter-store transfers, minimizing waste and maximizing profitability. This project was originally developed for the Walmart Sparkathon 2025.

Why SmartStockX?

Retail inventory management is a high-stakes balancing act. Overstocking leads to tied-up capital, increased holding costs, and potential losses from expired or obsolete products. Understocking results in lost sales and dissatisfied customers. SmartStockX addresses the critical need for a data-driven approach.

By using predictive analytics, SmartStockX transforms inventory management from a reactive process to a proactive strategy. It empowers retailers to make smarter, faster decisions, ensuring the right product is at the right place, at the right time, and at the right price. This closes critical gaps in manual forecasting and prevents losses due to preventable stock imbalances.

How SmartStockX Solves The Problem?

SmartStockX addresses this critical issue by:

🧠 Predicting Future Demand: Utilizes a Random Forest machine learning model to forecast product demand based on historical sales, stock levels, and shelf life.

πŸ’Έ Optimizing Prices Dynamically: Automatically calculates and suggests discounts for items nearing expiry or facing low demand, helping to clear stock and recover potential losses before they occur.

🚚 Suggesting Smart Transfers: Identifies stores with surplus stock ("donors") and those with deficits ("receivers"), then recommends optimized transfer routes to rebalance inventory across locations efficiently.

πŸ“Š Providing Actionable Analytics: Delivers a clear, intuitive dashboard with key metrics on projected revenue, potential losses, and overall inventory health, turning raw data into strategic insights.

By automating predictions and centralizing inventory intelligence, SmartStockX ensures that no sale is missed and no product is wasted due to preventable forecasting errors.

πŸ› οΈ Tech Stack

SmartStockX is built using a modern full-stack architecture combining Python's data science capabilities with a responsive JavaScript frontend.

πŸ”— Backend

  • Python – Core backend language.
  • Django & Django REST Framework – For building a robust and scalable REST API.
  • PostgreSQL – Powerful, open-source object-relational database system.
  • Scikit-learn – For implementing the Random Forest machine learning model for demand prediction.
  • Pandas – For high-performance, easy-to-use data structures and data analysis.
  • Gunicorn – As the WSGI HTTP server for production deployment.

🌐 Frontend

  • React.js – Core UI library for building an interactive and component-based user interface.
  • Vite – Next-generation frontend tooling for a blazing-fast development experience.
  • Tailwind CSS – A utility-first CSS framework for rapidly building custom designs.
  • Axios – For handling all frontend HTTP requests to the backend API.
  • Chart.js – To create beautiful and informative charts for the analytics dashboard.
  • Lucide React – For a clean and consistent icon library.

πŸš€ Deployment

  • Vercel – For hosting the frontend, providing fast performance and global CDN support.
  • Render – For hosting the backend Django application and PostgreSQL database, with auto-scaling capabilities.

πŸ“‘ API Reference

The backend exposes a simple REST API to run the engine and fetch results.

Main Engine

POST /api/run/

Runs the entire SmartStockX engine. Requires inventory_file and distance_file as multipart/form-data. It processes the data, runs predictions, and saves the results to the database.

Data Retrieval

GET /api/inventory/

Fetches the complete, processed inventory data, including predicted demand and optimized pricing.

GET /api/transfers/

Fetches all the suggested inter-store transfers generated by the engine.

πŸ§ͺ Getting Started

Follow the steps below to run SmartStockX locally on your machine.

πŸ“¦ Prerequisites

  • Python (v3.8+ recommended)
  • Node.js (v18+ recommended)
  • PostgreSQL (Local instance or cloud-hosted)
  • Package managers: pip and npm

πŸš€ Installation

1. Clone the Repository

git clone https://github.com/Sudhanshu-NITR/SmartStockX.git
cd SmartStockX

2. Setup Backend

cd Backend/SmartStockX
# It's recommended to create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows, use `venv\Scripts\activate`

# Install dependencies
pip install -r requirements.txt

3. Setup Frontend

cd ../../Frontend/SmartStockX
npm install

πŸ” Environment Variables

The backend requires a .env file in the Backend/SmartStockX/ directory. Create one and add the following variables:

# Django Secret Key (generate a new one for production)
DJANGO_SECRET_KEY='your-django-secret-key'

# Debug mode
DJANGO_DEBUG=True

# PostgreSQL Database Connection URL
# Example: postgresql://USER:PASSWORD@HOST:PORT/DB_NAME
DATABASE_URL='your_postgresql_connection_string'

The frontend requires a .env.local file in the Frontend/SmartStockX/ directory:

# URL of your locally running backend server
VITE_API_BASE_URL=http://127.0.0.1:8000

πŸ§‘β€πŸ’» Running the App Locally

Start the Backend

Make sure your PostgreSQL server is running. In a terminal, navigate to the backend directory and run:

cd Backend/SmartStockX
python manage.py migrate
python manage.py runserver

Your backend will be live at http://127.0.0.1:8000.

Start the Frontend

In a new terminal window, navigate to the frontend directory and run:

cd Frontend/SmartStockX
npm run dev

Your frontend will be live at http://localhost:5173.

πŸ“Έ Screenshots

Landing Page

Landing

Inventory Page

Inventory

Transfer Suggestions

Transfers

🌱 Future Scope

  • Real-Time Data Integration: Connect directly with Point-of-Sale (POS) systems for real-time inventory updates.
  • Enhanced ML Models: Incorporate more complex models (e.g., LSTMs) that account for seasonality, holidays, and promotional events.
  • Supplier Recommendations: Extend the engine to suggest optimal restocking orders directly to suppliers.
  • UI/UX Enhancements: Introduce more granular filtering, sorting, and data visualization options on the frontend.
  • Automated Execution: Add functionality to automatically execute approved transfers and price changes in the inventory system.

πŸ‘₯ Team

This project was developed as a team submission for the Walmart Sparkathon 2025. The project reflects our combined efforts across machine learning, backend, frontend, database design, and deployment.

Team Members:

About

SmartStockX is an intelligent stock revival engine designed to tackle inventory inefficiency head-on

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors