Badhiya AI
Independent Product — AI Business OS for Bharat
The Challenge
India has 60 million+ MSMEs — kirana stores, street vendors, small retailers — who run their entire business on paper, in their head, or in a WhatsApp notebook. They do not speak English. They do not use SaaS. They cannot afford enterprise software. But they need inventory management, credit tracking (khata), GST-compliant invoicing, ONDC commerce participation, embedded credit, competitor intelligence, and AI-powered forecasting — all of it, in Hindi, on a phone, offline-first, with a voice interface. No existing product comes close to delivering this. Western tools are too expensive and assume English literacy. Indian alternatives are fragmented — separate apps for inventory, credit, payments, and catalog — none of them integrated.
The Approach
Built Badhiya as a complete Business Operating System spanning 3 independent repositories. Engineered a NestJS + Fastify backend with a 7-layer AI pipeline (intent classification → Redis exact cache → semantic cache via pgvector → prompt compression → LLM cascade via OpenRouter → CRAG retrieval → cache storage) that costs a fraction of GPT-4 calls while maintaining quality. Built a Next.js 16.2 + React 19 premium dashboard with 33 pages, next-intl for 10+ Indian languages, and zero mock data — every number comes from a real backend call. Built an Expo SDK 55 + React Native 0.83 mobile app with 62 screens, 18 feature modules, and a Hindi-first voice UI powered by Bhashini. Wired in ONDC Beckn BPP for government e-commerce participation, Razorpay for UPI payments, FlexiLoans + Account Aggregator for embedded NBFC credit, and WhatsApp Cloud API for the primary communication channel Indians actually use.
Three-Repository Ecosystem
Each repo is independently deployable with its own CI/CD, but they share a common API contract and design language. Backend runs on Fastify for max throughput, frontend on Next.js 16.2 with Turbopack, mobile on Expo with the New Architecture + Hermes V1.
NestJS 11 + Fastify API
NestJS 11 running on Fastify with TypeScript 6, PostgreSQL 16 + pgvector, and Redis 7. Exposes 175 REST endpoints across 20 controllers. Includes a proprietary 7-layer AI pipeline, ONDC Beckn BPP protocol implementation, Razorpay payment integration, WhatsApp Cloud API webhook handler, 3-tier rate limiting, 13 database migrations, and Swagger-documented API at /api/docs.
Next.js 16.2 + React 19
Premium 33-page dashboard built on Next.js 16.2 with Turbopack, React 19, Tailwind CSS v4, Zustand 5, and TypeScript 5. Real-time KPIs with Recharts analytics, next-intl for 10+ Indian languages, 8 Playwright E2E test suites, and — critically — zero mock data. Every number on every chart comes from a real backend API call.
Expo SDK 55 + React Native 0.83
62 screens across 18 feature modules (206 TypeScript files) built on Expo SDK 55 + React Native 0.83 with the New Architecture and Hermes V1. Offline-first using Drizzle ORM + SQLite, Legend State for reactive state management, MMKV for fast key-value storage, Reanimated 4 for 60fps animations, and a Hindi-first voice UI. Maestro E2E tested, EAS Build deployed.
The Solution
- Built a 7-layer AI pipeline: Intent Classification → Redis Exact Cache → Semantic Cache (pgvector) → Prompt Compression → LLM Cascade → CRAG Retrieval → Cache Storage
- Integrated ONDC Beckn BPP protocol for government e-commerce with 28 endpoints for catalog sync, order management, and seller registration
- Delivered 18 end-to-end features with full parity across backend + web + mobile (zero mock data anywhere)
- Embedded NBFC lending via FlexiLoans + Account Aggregator (AA) consent flow — 8 endpoints for loan lifecycle
- Team management with attendance, payroll, and shift scheduling — 38 endpoints
- Admin panel with separate auth, impersonation, and 29 endpoints for support operations
- AI Chat with voice UI powered by Bhashini for native Hindi interaction
- Gamification layer with spin wheel, streaks, and coin rewards to drive daily engagement
- Competitor price intelligence across 7 e-commerce platforms
- Prophet ML forecasting tied to Indian festival calendar for demand prediction
- WhatsApp credit reminders (Khata) — the way small Indian businesses already operate
- 10+ Indian language i18n powered by next-intl and Bhashini language AI
Feature Breakdown
Core Business OS
- Business Dashboard (8 endpoints) with 0-900 health score
- Transactions (5 endpoints) — offline-first sync + P&L by date
- Inventory / Dukan (4 endpoints) — barcode scan + low-stock alerts
- Credit / Khata (7 endpoints) — WhatsApp reminders
- Analytics (7 endpoints) — revenue chart, P&L, GST invoice
- Payments (8 endpoints) — Razorpay + UPI + subscriptions
AI & Intelligence
- 7-layer AI pipeline with semantic cache (pgvector)
- AI Chat with Hindi-first voice UI (Bhashini)
- Competitor Intelligence across 7 e-commerce platforms (9 endpoints)
- Prophet ML forecasting tied to festival calendar (6 endpoints)
- LLM cascade routing via OpenRouter
- CRAG (Corrective RAG) for accurate retrieval
ONDC & Commerce
- ONDC Beckn BPP protocol implementation (28 endpoints)
- Seller registration and catalog sync
- Order lifecycle: accept, prepare, deliver
- ONDC KPI dashboard for participation tracking
- GST-compliant invoice generation
- Product catalog with multi-image support
Team & Lending
- Team management (38 endpoints) — attendance, payroll, shifts
- Weekly shift grid with drag-and-drop scheduling
- Bulk attendance marking with facial recognition option
- Monthly payroll auto-calculation
- Embedded NBFC lending (8 endpoints) via FlexiLoans
- Account Aggregator (AA) consent flow for credit underwriting
Scale & Scope
The Impact
Tech Stack
“Badhiya is what happens when you decide the 60 million shopkeepers running India deserve software as good as the enterprise SaaS their urban counterparts get. Three repositories, 175 endpoints, 62 mobile screens, a 7-layer AI pipeline that speaks Hindi, ONDC protocol integration, and an embedded NBFC lender — all in one Business OS. Not one piece of it is mock data. Every feature works end-to-end across backend, web, and mobile. This is what it takes to digitize Bharat, not just India.”