An AI-powered business intelligence & welfare enablement assistant for India's 10+ million street vendors and micro-entrepreneurs.
π Live Prototype β’ π API Docs β’ π₯ Demo Video β’ β‘ Quickstart / Local Run β’ ποΈ System Architecture β’ π Core Capabilities β’ π API Reference β’ π§ͺ Testing
| Item | Details |
|---|---|
| Hackathon | OOSC 4.0 Hackathon |
| Problem Statement | Problem Statement 5: AI for Public Good |
| Theme | Inclusive AI, Social Impact and Empowerment of Underserved Communities |
| Sub-Track | AI for Micro-Entrepreneurs and Street Vendors & AI for Accessible Public Services |
| Repository | github.com/lowkeyd3v/flux |
| Live Prototype URL | π https://flux-frontend-iojr.onrender.com |
| Live API Swagger Docs | π https://flux-backend-w7fd.onrender.com/docs |
| Demo Video | Watch 5-Minute Video Demo (YouTube) (Mandatory submission video) |
| Test Suite | 48/48 Automated Tests Passing (Pytest + React Build) |
- π Live Web Application: https://flux-frontend-iojr.onrender.com
- π Interactive OpenAPI (Swagger) Docs: https://flux-backend-w7fd.onrender.com/docs
- π©Ί Live Health & Readiness Probe: https://flux-backend-w7fd.onrender.com/api/health/ready
- π Live Prometheus Metrics: https://flux-backend-w7fd.onrender.com/api/metrics
For evaluators who prefer to run the prototype locally, the entire stack can be launched with a single command using Docker Compose:
# 1. Clone the repository
git clone https://github.com/lowkeyd3v/flux.git
cd flux
# 2. Start the full application stack (PostgreSQL, Backend API, Web Frontend, Prometheus)
docker compose -f docker-compose.prod.yml up -d --build- π Web Dashboard:
http://localhost - π Interactive OpenAPI (Swagger) Docs:
http://localhost:8000/docs - π Prometheus Real-Time Metrics:
http://localhost:8000/api/metrics - π©Ί Health & Readiness Check:
http://localhost:8000/api/health/ready
(For step-by-step developer setup without Docker, see Local Developer Setup)
π Video Submission Link: Watch FLUX 5-Minute Demo Video on YouTube
- Team Intro & Street Vendor Problem Reality: Context on India's 10M+ street vendors, perishable spoilage, and language barriers.
- Live Dashboard & ML Demand Forecasting: Dynamic vendor profiles, daily sales logging, and real-time ML demand inference with confidence bounds.
- Weather-Aware Stock Recommendation Engine: Margin-optimized prep recommendations factoring in extreme heat, rain, and perishability.
- Grounded Scheme RAG & Trilingual Voice Assistant: Grounded Q&A for PM SVANidhi, MUDRA & Vishwakarma with hands-free voice interaction in Hindi, English, and Hinglish.
- Production Engineering, Metrics & 48 Tests: OpenAPI Swagger documentation, live Prometheus telemetry, and 48/48 passing automated tests.
- Measurable Social Impact & Closing Remarks: Financial resilience, welfare accessibility, and production readiness.
India is home to over 10 million street vendors and micro-entrepreneurs who drive daily urban commerceβchaiwalas, fruit sellers, chaat carts, street tailors, and artisans. Despite their vital contribution, they operate with extreme vulnerability:
- Demand Uncertainty & Perishable Spoilage: Vendors rely on guesswork to prep stock. Over-preparation leads to spoiled ingredients and direct financial loss; under-preparation leads to lost daily income.
- Weather Sensitivity: Extreme summer heat (>40Β°C) or sudden monsoon rains decimate footfall, but vendors lack localized forecasting tools tailored to their specific products.
- Information Asymmetry in Government Welfare: Schemes like PM SVANidhi (collateral-free credit + 7% interest subsidy), PM MUDRA Yojana, and PM Vishwakarma (βΉ15,000 toolkits + 5% loans) exist, but complex portals and bureaucratic jargon prevent informal workers from discovering eligibility and applying.
- Digital & Language Literacy Barriers: Most vendors prefer speaking in Hindi or colloquial Hinglish over navigating dense English web portals.
FLUX is a lightweight, mobile-first, voice-enabled business intelligence copilot designed specifically for Indian micro-enterprises:
+---------------------------------------------------------------------------------------------------+
| FLUX CORE CAPABILITIES |
| |
| [π ML Demand Forecast] --> Predicts unit demand with uncertainty bounds (Random Forest) |
| [π€οΈ Stock Decision Engine] --> Computes prep quantities capped by budget & adjusted for weather |
| [ποΈ Scheme RAG Advisor] --> Answers scheme questions grounded in official government docs |
| [π― Personalized Matching] --> Matches vendor trades with optimal credit lines & toolkit grants |
| [π£οΈ Trilingual Voice Assistant] --> Speech-to-Text & Text-to-Speech in English, Hindi & Hinglish|
| [π Production Telemetry] --> Prometheus metrics, structured JSON logs & distributed tracing |
+---------------------------------------------------------------------------------------------------+
+---------------------------------------------+
| End User / Vendor |
| (Mobile / Desktop PWA) |
+---------------------------------------------+
|
v
+---------------------------------------------+
| Cloudflare / CloudFront CDN & SSL |
| - Hashed Static Chunks Cached 1yr |
| - Dynamic API Requests Pass-Through |
+---------------------------------------------+
/ \
(Static Assets / Web) (API Gateway / Reverse Proxy)
/ \
v v
+---------------------------------------------+ +-----------------------------------------------------------------+
| Nginx Alpine Container | | FastAPI Production Container |
| - SPA Client-Side Fallback Routing | | (Gunicorn + Uvicorn ASGI Workers) |
| - Immutable Vite Asset Headers | | |
| - Security Headers & Compression | | +-------------------+ +------------------+ +--------------+ |
+---------------------------------------------+ | | Vendors & Sales | | Demand Forecast | | Stock Recs | |
| +-------------------+ +------------------+ +--------------+ |
| | Schemes RAG Engine| | Voice Intent API | | Health Probes| |
| +-------------------+ +------------------+ +--------------+ |
| | |
| [ X-Request-ID Tracing ] [ JSON Structured Logs ] [ Prometheus ]|
+-----------------------------------------------------------------+
/ | \
/ | \
v v v
+---------------------+ +----------------------+ +---------------------+
| PostgreSQL Database | | External Providers | | Prometheus Scraper |
| (Persistent Volume) | | (OpenWeather, LLM) | | & Grafana Dashboard|
+---------------------+ +----------------------+ +---------------------+
- Time-Series Random Forest Regressor trained on weekly seasonality, holiday/festival calendar multipliers, price elasticity, and weather sensitivities.
- Uncertainty Bounds: Computes 10th percentile (
predicted_demand_low), mean point estimate (predicted_demand_point), and 90th percentile (predicted_demand_high) across the decision tree ensemble. - Strict Chronological Validation: Train/validation splits are strictly date-based (80/20 chronological) to prevent future data leakage (Validation MAE β 8.7 units, RΒ² β 0.84).
- Constraint-Aware Arithmetic: Calculates exact units to prepare based on existing stock (
prep_units = forecast - inventory), strictly capped by the vendor's daily working budget (budget / selling_price). - Live Weather Integration: Connects with OpenWeatherMap API for live temperature and rain forecasts (with automatic fallback to neutral baselines when offline).
- Explainable Decision Logic: Generates plain-language reasoning and risk scores (
low,medium,high) explaining forecast confidence and weather impacts.
- Comprehensive Knowledge Base: Curated database of major Indian micro-enterprise schemes:
- PM SVANidhi: Collateral-free working capital loan (βΉ10,000 β βΉ20,000 β βΉ50,000) with 7% interest subvention and digital cashback.
- PM MUDRA Yojana: Non-farm micro-loans up to βΉ10 Lakhs across Shishu (up to βΉ50k), Kishore (βΉ50kββΉ5L), and Tarun (βΉ5LββΉ10L).
- PM Vishwakarma: 18 traditional artisan trades with βΉ15,000 toolkit grants and 5% concessional enterprise loans.
- e-Shram Portal: Unorganized worker national database with βΉ2 Lakh accidental insurance.
- PMSYM: Old-age social security pension scheme providing βΉ3,000/month after age 60.
- Vector Retrieval with Lexical Boosting: TF-IDF vector index combined with cosine similarity and domain intent keyword boosting (
eligible,documents,subsidy,apply). - Dual-Engine Synthesis: Deterministic, hallucination-free extractive synthesis engine that extracts exact criteria, documents, and portal links, plus optional LLM client integration.
- Analyzes vendor business attributes (product type, daily budget, location) to automatically surface optimal government initiatives with match reasons and direct application steps.
- Instant Trilingual Switching: Seamless toggle between English, ΰ€Ήΰ€Ώΰ€ΰ€¦ΰ₯ (Hindi), and Hinglish (conversational Romanized Hindi, e.g., "Aaj kitna banana chahiye?").
- Speech-to-Text (STT): Browser-native Web Speech recognition (
webkitSpeechRecognition) adapting dynamically betweenhi-INanden-INwith zero server latency. - Text-to-Speech (TTS): Integrated audio narration (
SpeakerButton) reading recommendations and scheme details aloud in an Indian accent. - Voice Intent Parser: Backend NLP endpoint mapping spoken phrases to actionable platform actions.
- Prometheus Metrics (
/api/metrics): Exposes request counters, response latency summaries (p50/p90/p99), in-flight requests, database connectivity, and ML/RAG execution timings. - Distributed Tracing: Generates and propagates
X-Request-IDacross every client request, server log, and database interaction. - Structured JSON Logging: Emits machine-parsable access logs with request timestamps, client IPs, endpoints, status codes, and latencies.
- Kubernetes Probes: Standard
/api/health/live,/api/health/ready, and/api/health/detailedhealth endpoints.
| Layer | Technologies |
|---|---|
| Frontend | React 19, Vite, Tailwind CSS, Lucide Icons, React Router v7, Axios |
| Backend | Python 3.11/3.13, FastAPI, Gunicorn, Uvicorn, Pydantic v2, SQLAlchemy 2.0, Alembic |
| Database | PostgreSQL 16 (Relational DB with ACID transactions and Alembic migrations) |
| Machine Learning | Scikit-learn, Pandas, NumPy, Joblib (Random Forest Demand Regressor) |
| RAG & GenAI | TF-IDF Vector Retrieval, Cosine Similarity, Grounded Extractive Synthesizer, LLM API Client |
| Observability | Prometheus (/api/metrics), Grafana Dashboards, Structured JSON Logging, X-Request-ID Tracing |
| Containerization & CI/CD | Docker Multi-Stage, Docker Compose, Kubernetes (K8s), Google Cloud Run, Nginx Alpine, GitHub Actions |
| External APIs | OpenWeatherMap API (5-day forecasts & current weather) |
| Testing | Pytest, FastAPI TestClient, Starlette, AnyIO (48 automated tests) |
flux/
βββ .github/
β βββ workflows/
β βββ ci.yml # Automated tests, linting & Docker builds
β βββ deploy.yml # Automated release & container publishing (GHCR)
β
βββ frontend/ # React Single-Page Application
β βββ src/
β β βββ components/ # UI Components & ErrorBoundary
β β βββ pages/ # Route pages (HomePage, VendorPage)
β β βββ services/ # Axios client with tracing & latency tracking
β β βββ utils/performance.js # Web Vitals & performance telemetry
β β βββ translations/ # English, Hindi, Hinglish dictionaries
β β βββ hooks/ # Custom React state hooks
β βββ public/
β β βββ _headers # Cloudflare Pages / CDN cache headers
β β βββ robots.txt # Search engine crawler configuration
β β βββ sitemap.xml # Site URL manifest
β βββ Dockerfile # Multi-stage production container
β βββ nginx.conf # Nginx reverse proxy & cache configuration
β βββ package.json
β
βββ backend/ # FastAPI Backend
β βββ app/
β β βββ main.py # App factory with tracing & metrics middlewares
β β βββ core/
β β β βββ config.py # Pydantic Settings & environment config
β β β βββ metrics.py # Prometheus metrics collector & registry
β β β βββ middleware.py # Request ID tracing & structured JSON logging
β β βββ api/ # REST route controllers
β β β βββ health.py # Liveness, readiness, detailed & Prometheus endpoints
β β β βββ vendors.py # Vendor profile CRUD
β β β βββ sales_records.py # Sales history logging & bulk upload
β β β βββ predictions.py # Demand forecasting endpoint
β β β βββ recommendations.py # Stock prep & weather recommendation
β β β βββ schemes.py # Government scheme RAG & recommendations
β β β βββ voice.py # Voice intent parsing & language catalog
β β βββ models/ # SQLAlchemy ORM models
β β βββ schemas/ # Pydantic request/response schemas
β β βββ services/ # Core business & AI logic
β β βββ data/schemes_data.json # Curated scheme knowledge base
β βββ alembic/ # Database migration versions
β βββ tests/ # 48 Pytest unit, integration & monitoring tests
β βββ Dockerfile # Multi-stage production container
β βββ docker-entrypoint.sh # DB migration runner & server starter
β βββ gunicorn_conf.py # Production Gunicorn ASGI worker config
β βββ requirements.txt
β
βββ deploy/ # Cloud & Production Deployment Manifests
β βββ k8s/ # Kubernetes Manifests (Deployments, Services, HPA, Ingress)
β βββ cloudrun/ # Google Cloud Run service definition & deploy script
β βββ monitoring/ # Prometheus scrape config & Grafana dashboard JSON
β βββ render.yaml # Render.com infrastructure blueprint
β βββ docker.env.example # Docker Compose production environment template
β
βββ docs/ # Comprehensive System Documentation
β βββ PRODUCTION_DEPLOYMENT.md # Step-by-step production deployment & runbooks
β βββ CDN_AND_EDGE_GUIDE.md # CDN edge caching, SSL & performance guide
β βββ MONITORING_AND_OBSERVABILITY.md# Metrics, structured logs, and alert rules
β
βββ ml/ # Machine Learning Pipeline
β βββ data/ # Synthetic data generation
β βββ preprocessing/ # Feature engineering
β βββ training/ # Training & evaluation
β βββ inference/predict.py # Model loading & inference wrapper
β βββ models/demand_model.joblib # Serialized Random Forest model
β
βββ docker-compose.yml # Local development database
βββ docker-compose.prod.yml # Full production compose stack
βββ LICENSE # MIT License
βββ README.md
- Node.js: v18.0 or higher
- Python: v3.11 or higher
- Docker & Docker Compose (for PostgreSQL database)
# 1. Clone repository
git clone https://github.com/lowkeyd3v/flux.git
cd flux
# 2. Configure environment
cp deploy/docker.env.example .env
# 3. Start full production stack (PostgreSQL, Backend, Frontend, Prometheus, Grafana)
docker compose -f docker-compose.prod.yml up -d --build- Frontend Application:
http://localhost - Backend API:
http://localhost/api(orhttp://localhost:8000) - Prometheus Metrics:
http://localhost:9090 - Grafana Dashboard:
http://localhost:3000
docker compose up -dStarts PostgreSQL on localhost:5432 with user flux_user, password flux_password, and db flux_db.
cd backend
python -m venv venv
# Activate virtual environment
# On Linux/macOS:
source venv/bin/activate
# On Windows (PowerShell):
.\venv\Scripts\Activate.ps1
# Install dependencies and apply migrations
pip install -r requirements.txt
cp .env.example .env
alembic upgrade headFrom the repository root (with virtual environment active):
python -m ml.data.generate_synthetic_data
python -m ml.training.train_demand_modelcd backend
uvicorn app.main:app --reload --port 8000- API Docs:
http://localhost:8000/docs - Health Check:
http://localhost:8000/api/health
In a separate terminal:
cd frontend
npm install
cp .env.example .env
npm run dev- Web Dashboard:
http://localhost:5173
The test suite covers database persistence, ML model inference, stock preparation logic, weather fallbacks, government scheme vector RAG retrieval, multilingual voice intent parsing, and production observability probes:
cd backend
# With virtual environment activated
pytest -vTest Suite Summary (48/48 Tests Passing):
tests/test_health.py: Health endpoint and PostgreSQL connectivity checks.tests/test_monitoring.py: Kubernetes liveness probe, readiness probe, system telemetry, Prometheus metrics, and distributed tracing (X-Request-ID).tests/test_vendors.py: Vendor CRUD operations and schema validation.tests/test_sales_records.py: Single and bulk sales logging with constraints.tests/test_predictions.py: ML prediction inference and uncertainty range bounds.tests/test_recommendations.py: Stock prep arithmetic, budget caps, risk scoring, and weather fallbacks.tests/test_schemes.py: Scheme listing, detail lookup, vector retrieval, vendor-context queries, and personalized matching.tests/test_voice.py: Multilingual intent parsing across English, Hindi, and Hinglish, and supported languages catalog.
All REST endpoints are prefixed with /api (configurable via API_V1_PREFIX). Interactive OpenAPI documentation is available at http://localhost:8000/docs.
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/health |
Service health and PostgreSQL database connectivity check |
GET |
/api/health/live |
Kubernetes liveness probe (checks process responsiveness) |
GET |
/api/health/ready |
Kubernetes readiness probe (verifies DB, ML model, and RAG data) |
GET |
/api/health/detailed |
Comprehensive system telemetry, memory stats, CPU, and components |
GET |
/api/metrics |
Prometheus metrics exposition format (version 0.0.4) |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/vendors |
Create a new vendor profile |
GET |
/api/vendors |
List all registered vendor profiles |
GET |
/api/vendors/{vendor_id} |
Retrieve specific vendor profile by UUID |
PATCH |
/api/vendors/{vendor_id} |
Partially update vendor attributes (budget, inventory, price) |
DELETE |
/api/vendors/{vendor_id} |
Delete vendor profile (cascades to associated sales records) |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/vendors/{vendor_id}/sales |
Log a daily sales record |
POST |
/api/vendors/{vendor_id}/sales/bulk |
Batch upload historical sales records |
GET |
/api/vendors/{vendor_id}/sales |
Retrieve historical sales logs for a vendor |
DELETE |
/api/vendors/{vendor_id}/sales/{record_id} |
Delete a specific sales record |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/vendors/{vendor_id}/predict |
ML demand forecast for a target date with weather context |
POST |
/api/vendors/{vendor_id}/recommend |
Preparation quantity, revenue forecast, risk score & weather summary |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/schemes |
List all government schemes (with optional ?category= filter) |
GET |
/api/schemes/{scheme_id} |
Get full scheme details, eligibility, required docs, and steps |
POST |
/api/schemes/query |
Natural-language RAG query with source-attributed answers |
GET |
/api/vendors/{vendor_id}/schemes/recommended |
Personalized scheme recommendations matching vendor profile |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/voice/parse-intent |
Parse spoken vendor query into structured action (schemes, predictions, sales) |
GET |
/api/voice/supported-languages |
List supported languages (en, hi, hinglish) and speech synthesizer models |
Ready-to-deploy cloud configurations and manifests:
- π³ Docker Compose Production: docker-compose.prod.yml
- βΈοΈ Kubernetes (EKS/GKE/AKS): deploy/k8s/ (
backend.yaml,frontend.yaml,postgres.yaml,ingress.yaml,hpa.yaml) - βοΈ Google Cloud Run: deploy/cloudrun/ (
service.yaml,deploy.sh) - β‘ Render.com Blueprint: deploy/render.yaml
- π Comprehensive Runbooks:
| Criteria | How FLUX Excels |
|---|---|
| Innovation | Integrates ML demand forecasting with live weather elasticity, constraint-based inventory arithmetic, trilingual voice assistants, and grounded government scheme RAG into a single unified copilot. |
| Technical Implementation | Production-ready stack: FastAPI backend, React 19 SPA, PostgreSQL with Alembic migrations, custom TF-IDF RAG engine with lexical boosting, Random Forest with tree variance uncertainty, and Prometheus telemetry. |
| Feasibility & Social Good | Designed for low digital literacy: trilingual support (Hindi/Hinglish/English), browser-native speech recognition and audio narration, and grounded welfare scheme eligibility for informal street vendors. |
| Scalability & Architecture | Multi-stage Docker containers, Nginx reverse proxy, Kubernetes Horizontal Pod Autoscalers (HPA), Prometheus metrics scraping, and edge CDN caching. |
| Code Quality & Testing | Modular architecture, strict separation of concerns, complete typing with Pydantic v2, and 48 automated unit and integration tests running on GitHub Actions CI. |
This project is licensed under the MIT License.