Hisaabak: AI-Assisted POS & Visual Inventory System
A real-time point-of-sale and inventory platform built for small-to-medium retail environments. Hisaabak bridges the gap between physical retail operations and instant digital checkout by combining WebRTC camera streaming, localized on-demand barcode decoding, and multimodal visual item recognition powered by Gemini Flash Lite.
Visit it: https://hisaabak.vercel.app/
1. The Core Problem & Friction Points
Traditional Point-of-Sale (POS) hardware and barcode infrastructure present steep operational bottlenecks for independent grocers, corner shops, and fresh-produce merchants:
- Unbarcoded & Fresh Goods Friction: Produce, baked items, and bulk retail goods lack static UPC/EAN barcodes. Cashiers spend excessive seconds navigating nested UI categories or manual SKU lookups during peak checkout hours.
- Prohibitive Hardware Overhead: Dedicated barcode scanners, proprietary receipt terminals, and ruggedized POS tablets impose significant upfront capital expenses.
Hisaabak eliminates these barriers by transforming any camera-enabled smartphone, tablet, or desktop browser into an autonomous, AI-assisted checkout terminal without requiring proprietary scanning hardware.
2. Technical Architecture & System Design
Hisaabak is engineered around a hybrid edge-and-cloud architecture designed to minimize latency, eliminate unnecessary API consumption, and guarantee atomic ledger consistency.

3. Key Engineering Highlights
Hybrid Edge-First Scanning Pipeline
- Zero-Latency Barcode Path: Standard barcode decodes run client-side using browser-native GPU/WASM APIs. Matches resolve against the locally cached inventory in under 10ms with zero network payload.
- Targeted Multimodal Classification: To prevent API quota exhaustion (15 RPM limits), continuous polling loops were discarded in favor of an interactive Tap-to-Scan reticle. High-resolution frames are captured and dispatched to
gemini-3.5-flash-liteonly when an unbarcoded item is framed and tapped. - Dynamic Structured Prompt Compression: Store catalogs are mapped into compact tabular token structures containing product IDs, barcodes, and SOSAD-generated
visual_descriptors, allowing sub-second visual classification with strict confidence scoring.
Atomic SQL Checkout Transactions (process_pos_checkout)
To eliminate concurrency issues and race conditions during high-volume checkout:
- Transaction records, line-item insertions, and stock decrements are executed inside a single Postgres PL/pgSQL function (
process_pos_checkout). - Row-Level Pessimistic Locking (
FOR UPDATE): Product inventory rows are locked during settlement, guaranteeing that shelf counts cannot drop below zero or drift across concurrent register sessions.
SOSAD (Snap Once, Store All Data) Product Onboarding
- Store managers onboard new inventory by snapping 1–3 multi-angle photos directly in-app.
- The multimodal ingestion pipeline extracts clean product names, infers localized store categories, parses visible packaging barcodes, and generates persistent visual descriptor tags for future camera recognition.
4. Database Schema & Multi-Tenant Access Control
The database is built on Supabase (PostgreSQL) with strict Row-Level Security (RLS) ensuring complete tenant isolation between store branches and merchant accounts.

5. Technology Stack & Implementation Choices
| Layer | Technology | Engineering Rationale |
| Framework | Next.js 15 (App Router, TypeScript) | Server Component hydration boundaries, strict async route parameter unwrapping, and edge runtime scalability. |
| Styling & UI | Tailwind CSS + Neobrutalist Design | High-contrast visual hierarchy optimized for fast recognition under harsh retail lighting and compact mobile screens. |
| Backend & DB | Supabase (PostgreSQL + RLS + Storage) | Declarative security policies, atomic relational RPC procedures, and multi-tenant asset bucket management. |
| Vision Model | Google Gemini 3.5 Flash-Lite | Sub-second visual classification latency, high token throughput, and native JSON schema output compliance. |
| State Sync | Zustand + Native MediaStream API | Real-time POS register ledger tracking, device camera stream lifecycle management, and instant multi-language switching. |
6. Challenges & Architectural Trade-Offs
- Mitigating Multi-Key Quota Bottlenecks: Initial tests distributed round-robin requests across an array of API keys under a single Google Cloud project. Because Cloud quotas apply per account/project rather than per key, a single 429 throttled the entire pool. Refactoring the workflow from indiscriminate interval polling to on-demand reticle capture reduced API load by 90% while improving scan accuracy.
- Mobile-First POS Ergonomics: Standard desktop dashboards collapse into unusable layouts on budget mobile devices. The checkout interface was refactored around a strict
100dvhviewport, thumb-accessible action clusters, and an auto-adjusting drawer layout for candidate ambiguity resolution.
7. What’s Next
- Local WASM Feature Extraction: Exploring on-device MobileNet/TensorFlow.js embeddings to classify frequent staple items completely offline, querying Gemini only when confidence falls below 60%.
- Polar Subscription Billing: Implementing Merchant-of-Record automated tier gating to manage branch allowances, staff accounts, and monthly scan quotas.
- Thermal Receipt Printer Integration: Direct ESC/POS Bluetooth and WebUSB printing for instant hard-copy receipts.