-
-
LandingPage
-
How ShopPilot works?
-
Sign in/ Login in image
-
Home tab where the user reviews the order and pays
-
Approvals tab where the user can approve/reject a swap
-
Pantry tab where the user's restocking editable rules are stored
-
BrowseProducts tab where the user can surf around products
-
Activity tab where the user's recent activity (like any approval/rejection or payment) can be seen
-
Settings tab where the user can configure overall restock rules like monthly cycle and budget
-
Profile tab where the user is allowed configure its profile
-
Home tab showing that the order is paid and confirmed
-
Approvals tab ( scrolled down) where the user can see and edit their upcoming order
-
Paypal sandbox integration image
-
paypal sandbox test account login
-
Image showing successful payment via paypal sandbox integration
Inspiration
Households frequently run out of everyday grocery staples at unpredictable hours, resulting in hurried late-night convenience orders and repetitive delivery and handling fees across quick-commerce apps. We wanted to explore whether an autonomous AI agent could solve this problem responsibly.
Instead of placing unverified, automated orders that drain bank accounts, an effective household assistant needs clear boundaries: it must forecast pantry depletion from actual consumption rates, respect monthly budgets, optimize multi-store baskets to eliminate unnecessary fees, and require explicit human approval before any transaction occurs.
What it does
ShopPilot AI monitors household pantry stock and predicts run-out dates based on daily burn rates. It groups depleted staples into scheduled weekly replenishment cycles to eliminate piecemeal orders.
Key capabilities include:
- Pantry depletion forecasting: Tracks burn rates for daily staples (milk, eggs, bread, coffee) and calculates days of inventory remaining.
- Multi-store basket optimization: Analyzes an authentic catalog of 88 products across Zepto, Blinkit, and Instamart. It evaluates four fulfillment strategies (single-store fee consolidation, split-store item savings, speed-optimized, and balanced) to find the lowest total cost including platform and delivery fees.
- Household policy governance: Enforces per-order spending caps, weekly cycle budgets, delivery addresses, and restricted item categories.
- AI-assisted substitutions: Uses Google Gemini to translate plain-English household rules into structured policies and recommend in-stock brand alternatives with confidence scores when preferred items are unavailable.
- PayPal Sandbox checkout: Settles approved restock baskets through PayPal Orders v2 using standard PayPal JavaScript SDK buttons or mobile-scannable QR codes.
- Verified replenishment: Restocks pantry inventory automatically inside an atomic database transaction only after receiving verified payment capture confirmation.
How we built it
ShopPilot AI is engineered as a full-stack TypeScript monorepo:
- Backend: Built with Node.js and Express. Persistence is powered by SQLite via
better-sqlite3operating in Write-Ahead Logging (WAL) mode across 16 relational tables. - Frontend: Developed with React 19, Vite, and Tailwind CSS. It features a Time Machine simulation drawer for testing depletion, real-time basket editing, delivery address selection, and dynamic QR code generation.
- Monetary precision: All internal financial calculations are executed in integer paise (1 INR = 100 paise) to prevent floating-point rounding errors across item lines, delivery fees, and taxes.
- PayPal integration: Implements server-side OAuth 2.0 client credential management, Orders v2 creation with
PayPal-Request-Ididempotency headers, Orders v2 capture verification, and cryptographic webhook signature verification (/v1/notifications/verify-webhook-signature). - AI architecture: Uses Google Gemini (
gemini-3.5-flash-lite) via REST integration. AI outputs are strictly constrained by Zod schema validation and server-side candidate allow-lists; deterministic regex and heuristic algorithms serve as zero-dependency local fallbacks.
Challenges we ran into
- Multi-store checkout limitations: While our basket optimizer models multi-store splits to demonstrate potential savings, executing concurrent checkouts across multiple distinct merchants simultaneously is not supported in our checkout flow right now. The PayPal Orders v2 flow currently requires consolidating the order into a single merchant transaction.
- US Sandbox accounts vs. Indian Rupee (INR): Our application is built for Indian households displaying prices in INR, but PayPal Orders v2 does not accept INR, and all available PayPal Sandbox accounts are US-based (USD only). While we implemented a currency conversion layer, it relies on a fixed, manually configured demo rate rather than live dynamic FX, resulting in conversion approximations between the domestic INR catalog total and the USD charged in the sandbox.
- Local webhook verification: PayPal cannot dispatch webhook callbacks directly to private local development ports. We engineered client-side status polling for local development while maintaining official PayPal webhook signature verification for production deployments.
- Cart consistency: Keeping basket totals and delivery fees synchronized between the optimization engine, interactive UI cards, and the backend database required centralizing all fee formulas in a pure, shared TypeScript service.
- Production bundling: Compiling an ESM bundle for Node 20 with
esbuildwhile preserving native C++ binary addons (better-sqlite3) required marking native packages external while bundling the rest of the application.
Accomplishments that we're proud of
- Built a complete, autonomous replenishment loop: depletion forecasting, multi-store fee optimization, approval workflows, and verified payment capture.
- Enforced a strict architectural separation where AI proposes but deterministic server code decides, preventing hallucinated items or unapproved orders from ever reaching checkout.
- Implemented an immutable audit log that chronologically records every clock advance, policy modification, approval decision, and payment event.
- Maintained a clean test suite consisting of 97 passing backend tests across 15 suites (covering policy evaluation, idempotent capture, user isolation, and rate limits) alongside an autonomous frontend verification suite.
What we learned
- Multi-store delivery and platform fees frequently exceed unit price savings. In quick-commerce, single-store consolidation often beats splitting items across multiple stores.
- Autonomous agents require strict human-in-the-loop boundaries: schema validation, candidate allow-lists, and manual approval gates are essential for building reliable consumer financial agents.
- Handling cross-border payments with regional sandbox accounts requires careful currency conversion and rounding strategies to keep local cart totals and processor receipts reconciled.
What's next for ShopPilot AI
- True multi-store split payments: Implement multi-capture or parallel marketplace disbursements to check out from multiple separate grocery stores in a single buyer session.
- Live dynamic currency conversion: Integrate real-time FX exchange feeds and support native localized PayPal payment methods once INR is supported.
- Real store integrations: Transition from simulated catalog adapters to live quick-commerce APIs as direct merchant integrations become available.
- Receipt OCR: Allow users to photograph physical grocery receipts or paper invoices to update pantry inventories automatically.
- PayPal Vault integration: Use saved payment methods and PayPal Vault to support zero-click, pre-authorized recurring restocks within strict spending limits.
- Multi-user households: Introduce shared household accounts with granular per-member approval tiers and individual item requests.
Built With
- ai
- api
- autonomus
- bcrypt
- better-sqlite3
- esbuild
- fullstack
- google-gmail-oauth
- llm
- lucide
- node.js
- nodemailer
- oauth
- paypal
- paypal-js-sdk
- paypal-rest-api
- react
- render
- rest
- sqlite
- tailwind
- typescript
- vite
- webhooks
- zod