AI-Powered Vendor Management and Purchasing System

About the Project

We built an AI-powered Vendor Management and Purchasing system that automates vendor discovery, compares real marketplace options, and generates smart purchase orders from your inventory needs.

It connects:

  • A React frontend for dashboards
  • An Express + MongoDB backend for data and orchestration
  • A Python Flask AI microservice that handles vendor search, recommendations, and insights

What Inspired Us

  • We’ve repeatedly seen small retailers spend hours comparing vendors and updating spreadsheets — a slow, error-prone process.
  • Modern marketplaces expose a wealth of public signals (price, rating, delivery windows) that can guide better purchasing decisions.
  • We wanted a “push-button” experience: from low-stock alerts to an AI-suggested order, including backups if a vendor is unavailable.

How We Built It

Frontend

  • React + TypeScript
  • Material-UI for a clean dashboard covering:
    • Inventory
    • Vendors
    • Purchase Orders
    • AI Insights

Backend

  • Node.js + Express routes with JWT authentication
  • MongoDB (via Mongoose) models for:
    • InventoryItem
    • Vendor
    • PurchaseOrder

AI Service

  • Python + Flask providing endpoints for:
    • Vendor search
    • Purchase recommendations
    • Inventory insights
  • Uses a Gemini key (if available) for enhanced reasoning

Orchestration

  • The backend:
    • Aggregates low-stock items
    • Calls the AI service to scrape vendors and compute recommendations
    • Creates draft purchase orders
  • The frontend calls backend APIs via a single REACT_APP_API_URL with auth token injection in the Axios interceptor

Scoring and Backups

We rank vendors using a transparent weighted formula:

$$ \text{score} = 0.40 \times (\text{price_score}) + 0.25 \times (\text{rating_score}) + 0.20 \times (\text{reliability_score}) + 0.15 \times (\text{delivery_score}) $$

For each item:

  • We select a primary vendor
  • Maintain ranked backups (#2–#5) for failover

What We Learned

  • Clear API contracts between services make multi-language stacks (TS + Python) productive.
  • Small, dedicated AI endpoints (e.g., vendor search, inventory insights) are easier to tune and monitor than a single monolith.
  • Observability matters: lightweight health checks and explicit fallback logic keep the app useful even without an AI key.

Challenges We Faced

  • Dependency pinning: aligning frontend peer dependencies and Python library versions required iteration.
  • Resilient scraping: marketplace variability demanded robust timeouts, custom user agents, and graceful fallbacks.
  • Inventory constraints: order proposals must respect:

$$ \text{remainingCapacity} = \max(0, \text{maxCapacity} - \text{currentStock}) $$

and supplier MOQ (Minimum Order Quantity), which sometimes conflicts with the “ideal” reorder amount.

  • Cross-service timeouts: coordinating backend ↔ AI service under load to avoid blocking the UI.

Impact and What’s Next

  • The system collapses hours of manual vendor comparison into seconds, offering traceable rationale and quick conversion into purchase orders.
  • Next steps:
    • Add historical price tracking
    • Improve reliability modeling with on-time delivery stats
    • Integrate with real marketplace APIs for live quotes

Built With

Share this project:

Updates