<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Areen Agrawal</title>
    <description>The latest articles on DEV Community by Areen Agrawal (@areen_agrawal).</description>
    <link>https://dev.to/areen_agrawal</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4166157%2Fedb9ab3c-4da9-4a77-84a5-ec6740c7a2d3.png</url>
      <title>DEV Community: Areen Agrawal</title>
      <link>https://dev.to/areen_agrawal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/areen_agrawal"/>
    <language>en</language>
    <item>
      <title>Solving India's Biggest SMB Problem That 99% of People Don't Know About: Meet Quatern</title>
      <dc:creator>Areen Agrawal</dc:creator>
      <pubDate>Sun, 18 Oct 2026 14:15:09 +0000</pubDate>
      <link>https://dev.to/areen_agrawal/solving-indias-biggest-smb-problem-that-99-of-people-dont-know-about-meet-quatern-k0c</link>
      <guid>https://dev.to/areen_agrawal/solving-indias-biggest-smb-problem-that-99-of-people-dont-know-about-meet-quatern-k0c</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week2-2026-10-12"&gt;Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Illusion of Digitization: 94% UPI vs. 74% Paper Ledgers
&lt;/h3&gt;

&lt;p&gt;Walk down any street in India and you will see QR codes and soundboxes at every storefront. According to the Ministry of Finance's &lt;a href="https://www.pib.gov.in/PressReleasePage.aspx?PRID=2228651&amp;amp;reg=48&amp;amp;lang=2" rel="noopener noreferrer"&gt;Socio-Economic Impact Analysis of BHIM-UPI Transactions&lt;/a&gt;, &lt;strong&gt;94% of small businesses in India have adopted UPI&lt;/strong&gt;. With annual volumes exceeding 241 billion transactions, Indian retail appears fully digitized from the outside.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Under the surface, it isn't.&lt;/strong&gt; Digital payments are merely the payment rail—not operational digitization.&lt;/p&gt;

&lt;p&gt;Across India's 7.47 crore MSMEs and 12–13 million neighborhood retail stores, &lt;strong&gt;roughly 74% still rely on handwritten paper ledgers (&lt;em&gt;bahi-khata&lt;/em&gt;) and manual cash memos&lt;/strong&gt; (&lt;a href="https://www.zoho.com/en-in/pos/pos-buying-tips.html" rel="noopener noreferrer"&gt;Zoho POS Survey&lt;/a&gt;). Because three out of four neighborhood shops operate on paper:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero Repeat-Customer Visibility:&lt;/strong&gt; A customer pays ₹250 via a static QR code, but the shopkeeper captures no SKU metadata and no customer profile. Regular households quietly defect to 10-minute quick-commerce delivery without the owner ever knowing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cash Leaks on Untracked &lt;em&gt;Udhaar&lt;/em&gt; (Credit):&lt;/strong&gt; The Confederation of Indian Industry estimates small retailers lose an average of &lt;strong&gt;₹18,000 per month&lt;/strong&gt; due to forgotten credit entries, torn ledger pages, and disputed balances, waiting an average of 45 days to collect dues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uncalculated Margins:&lt;/strong&gt; Owners routinely confuse markup on cost with gross margin on selling price, overlook transport in landed costs, and mix collected GST with daily cash flow.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Passive Word-of-Mouth:&lt;/strong&gt; Without customer CRM or purchase interval tracking, stores have no mechanism to send automated restock reminders, festival greetings, or clearance offers over WhatsApp.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  The Math: Why Small Retailers Reject Legacy POS
&lt;/h3&gt;

&lt;p&gt;Why haven't these stores adopted POS software? In the Zoho survey, &lt;strong&gt;95% wanted software&lt;/strong&gt;, ranking "ease of use (like WhatsApp)" and cost-effectiveness as their top priorities.&lt;/p&gt;

&lt;p&gt;They reject legacy systems because the unit economics are unsustainable for a neighborhood shop. A typical store generates ₹2,00,000 to ₹5,00,000 in monthly sales at 12%–15% gross margin, leaving the owner with a median net profit of &lt;strong&gt;₹30,000/month (₹3,60,000/year)&lt;/strong&gt; (&lt;a href="https://www.superk.in/blogs/franchise-hub/kirana-store-cost-india-2026" rel="noopener noreferrer"&gt;SuperK Retail Benchmarks&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Traditional POS solutions demand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Upfront Hardware:&lt;/strong&gt; Touch terminal, printer, scanner, and UPS cost ₹28,000 to ₹45,000+ ($350–$500).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dedicated Billing Operator:&lt;/strong&gt; Complex legacy software requires a dedicated data entry operator averaging ₹14,500 to ₹16,800/month ($200/mo), totaling over ₹2,00,000/year (&lt;a href="https://in.indeed.com/career/computer-operator/salaries" rel="noopener noreferrer"&gt;Indeed India&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SaaS Renewals &amp;amp; AMC:&lt;/strong&gt; Annual software licenses and maintenance add another ₹15,000+/year.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Year 1, legacy POS consumes &lt;strong&gt;over 70% of the shopkeeper's entire annual income&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Legacy Enterprise POS&lt;/th&gt;
&lt;th&gt;Handwritten &lt;em&gt;Bahi-Khata&lt;/em&gt;
&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Quatern (Local AI POS)&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Upfront Hardware&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;₹42,000 (~$500)&lt;/td&gt;
&lt;td&gt;₹0&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;₹0&lt;/strong&gt; (Runs on existing PC/laptop + mobile browser)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Operator Labor&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;₹16,800/mo (~$200/mo)&lt;/td&gt;
&lt;td&gt;₹0&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;₹0&lt;/strong&gt; (3-click UI + Hinglish AI Copilot)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Software &amp;amp; AI Cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;₹12,000–₹25,000/yr&lt;/td&gt;
&lt;td&gt;₹0&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;₹0 Core (FOSS)&lt;/strong&gt; / ₹149/mo optional Cloud Backup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Year-1 TCO Burden&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;₹2,59,200 (72% of profit)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Bleeds ~₹2.16L/yr in leaks&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;₹0 to ₹1,788/yr (&amp;lt;0.5% of profit — 145x cheaper)&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Analytics &amp;amp; Retention&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Complex tabular menus&lt;/td&gt;
&lt;td&gt;0% visibility&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Real-time SQLite telemetry + Gemma 4 E2B Copilot&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  Enter Quatern: Local POS + On-Device Gemma 4 E2B Copilot
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Quatern&lt;/strong&gt; is an offline-first, single-node retail POS, inventory ledger, &lt;em&gt;udhaar&lt;/em&gt; tracker, consent-guarded WhatsApp CRM, and &lt;strong&gt;on-device Gemma 4 E2B AI Business Copilot&lt;/strong&gt; built with &lt;strong&gt;PyWebView + FastAPI + SQLite + React 19 + Tailwind CSS v4&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero-Operator Desktop &amp;amp; Mobile UI:&lt;/strong&gt; Packages into a standalone Windows executable (&lt;code&gt;Quatern.exe&lt;/code&gt;) that runs on standard shop hardware without requiring Python or Node installed. It also serves a responsive interface over the local network so owners can bill and inspect metrics directly from their phone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic Integer-Paise Billing:&lt;/strong&gt; Barcode/SKU checkout powered by integer-paise arithmetic (&lt;code&gt;src/lib/money.ts&lt;/code&gt;), automated CGST/SGST splits, native 58mm/80mm ESC/POS thermal printing, and 1-click WhatsApp receipts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Offline Gemma 4 E2B AI Copilot:&lt;/strong&gt; Shopkeepers ask questions in &lt;strong&gt;Hinglish, Hindi, or English&lt;/strong&gt; (&lt;em&gt;"Aaj ki bikri aur payment breakdown dikhao"&lt;/em&gt;, &lt;em&gt;"Kaunse product par sabse zyada margin hai?"&lt;/em&gt;, &lt;em&gt;"Kitna udhaar baaki hai?"&lt;/em&gt;) and receive verified answers computed from their local SQLite database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Autonomous Retention Engine:&lt;/strong&gt; Scans customer purchase cycles to identify three high-value cohorts: &lt;em&gt;Monthly Ration Refill Overdue&lt;/em&gt;, &lt;em&gt;Inactive Customers (20–60 days)&lt;/em&gt;, and &lt;em&gt;Slow-Moving Stock&lt;/em&gt;, drafting ready-to-send WhatsApp messages.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  The Side-Hustle Business Model (Who Pays For It)
&lt;/h4&gt;

&lt;p&gt;While the core Quatern desktop app and local Gemma 4 E2B inference are &lt;strong&gt;100% free and open-source&lt;/strong&gt;, local shopkeepers gladly pay for three high-utility value-added services:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Backup &amp;amp; Remote Sync (₹149/month or ₹1,499/year — ~₹4/day):&lt;/strong&gt; Automated encrypted offsite backups of &lt;code&gt;quatern.db&lt;/code&gt; with remote mobile dashboard access when away from the counter.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;White-Glove Ledger Migration (₹999 one-time):&lt;/strong&gt; Digitizing existing rate sheets and customer ledgers using Quatern's fuzzy-header Excel importer (&lt;code&gt;src/lib/importer.ts&lt;/code&gt;) and local invoice OCR (&lt;code&gt;backend/ocr.py&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Managed WhatsApp &amp;amp; SMS Gateway Bundle (₹299/month):&lt;/strong&gt; Pre-configured Meta Cloud API and Indian DLT SMS credits for automated campaign broadcasts.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/3hXZp9ARprE" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Download Standalone App:&lt;/strong&gt; &lt;a href="https://github.com/Areen-09/quatern/releases/download/v1.0.0/Quatern-Windows-x64.zip" rel="noopener noreferrer"&gt;Quatern v1.0.0 (Windows x64 ZIP)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Source Code:&lt;/strong&gt; &lt;a href="https://github.com/Areen-09/quatern" rel="noopener noreferrer"&gt;github.com/Areen-09/quatern&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Workflow in Action
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;60-Second Setup &amp;amp; Catalog Import:&lt;/strong&gt; Set store name, GSTIN, and an optional 4-digit SHA-256 Owner PIN (locking cost prices and audit logs from cashiers). Drop any Excel/CSV price list into the fuzzy importer or scan paper supplier bills with local OCR.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;3-Click Checkout &amp;amp; WhatsApp Bill:&lt;/strong&gt; Search or scan items, select payment mode (Cash, UPI, Card, or Udhaar credit), print thermal receipts, and share formatted WhatsApp invoices with an instant UPI payment link.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consulting the Local Gemma 4 E2B Copilot:&lt;/strong&gt; Download the quantized &lt;code&gt;google_gemma-4-E2B-it-Q4_K_M.gguf&lt;/code&gt; model directly within the app, select Hinglish/Hindi/English, and ask about top margins, month-on-month growth, or overdue debtors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1-Click Retention Campaigns:&lt;/strong&gt; Review automated cohorts (e.g. &lt;em&gt;14 households overdue for grocery refill&lt;/em&gt;) and dispatch personalized, consent-compliant WhatsApp messages.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Areen-09" rel="noopener noreferrer"&gt;
        Areen-09
      &lt;/a&gt; / &lt;a href="https://github.com/Areen-09/quatern" rel="noopener noreferrer"&gt;
        quatern
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Quatern&lt;/h1&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/Areen-09/quatern/public/icon.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2FAreen-09%2Fquatern%2FHEAD%2Fpublic%2Ficon.png" alt="Quatern Logo"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Modern, Offline-First Desktop POS &amp;amp; Retail Management System&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;PyWebView (WebView2) · FastAPI · SQLite · React 19 · Tailwind CSS v4&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/Areen-09/quatern/releases/latest" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/8b735641a08f68da04c188f72302bf57e198aa05465000df07d16bb4f5d80a55/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f417265656e2d30392f7175617465726e3f636f6c6f723d313661333461266c6162656c3d52656c65617365" alt="GitHub Release"&gt;&lt;/a&gt;
&lt;a href="https://github.com/Areen-09/quatern#download-and-installation" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/a9e8085c0eb8b282b45270e8fba835ca8026e58233b0f7ef98a6d92491ad400f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506c6174666f726d2d57696e646f77732532307836342d303238346337" alt="Platform"&gt;&lt;/a&gt;
&lt;a href="https://github.com/Areen-09/quatern#license" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/ba15ba90be5b4ecb0ca3dd241959e8d524d5cfcf61dfd3ce9f57fe5f9409d54f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d616d626572" alt="License"&gt;&lt;/a&gt;
&lt;a href="https://github.com/Areen-09/quatern#architecture" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/80920d7823313a27bd17f04171c84ad47df0b54703e9cd1d14feac0b716c4cf8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4f66666c696e652d3130302532352532304c6f63616c25323053514c6974652d346634366535" alt="Architecture"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/Areen-09/quatern/releases/latest" rel="noopener noreferrer"&gt;&lt;strong&gt;Download Latest Release (Windows x64)&lt;/strong&gt;&lt;/a&gt; · &lt;a href="https://github.com/Areen-09/quatern#features" rel="noopener noreferrer"&gt;&lt;strong&gt;Features&lt;/strong&gt;&lt;/a&gt; · &lt;a href="https://github.com/Areen-09/quatern#developer-quickstart" rel="noopener noreferrer"&gt;&lt;strong&gt;Quick Start&lt;/strong&gt;&lt;/a&gt; · &lt;a href="https://github.com/Areen-09/quatern#architecture" rel="noopener noreferrer"&gt;&lt;strong&gt;Architecture&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Overview&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Quatern&lt;/strong&gt; is a modern, high-speed retail desktop application designed for retail shops, grocery stores, boutiques, chemists, and general merchants.&lt;/p&gt;
&lt;p&gt;Unlike traditional bulky cloud POS systems that require costly subscriptions, continuous internet connectivity, and external servers, Quatern is &lt;strong&gt;100% offline-first&lt;/strong&gt;. All store data — products, transactions, customer records, and credit ledgers — resides securely on the local computer in an encrypted SQLite database.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Highlights&lt;/h2&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;⚡ &lt;strong&gt;High-Speed Checkout&lt;/strong&gt;: Lightning-fast barcode/SKU scanning, keyboard-first navigation, and real-time total calculations.&lt;/li&gt;
&lt;li&gt;💰 &lt;strong&gt;Paise-Accurate Accounting&lt;/strong&gt;: Zero floating-point drift. All financial arithmetic is performed in integer paise with automatic rounding.&lt;/li&gt;
&lt;li&gt;🧾 &lt;strong&gt;Flexible Receipt Generation&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;ESC/POS thermal printing (58mm and 80mm format toggle).&lt;/li&gt;
&lt;li&gt;Canvas-based visual bill images for direct clipboard…&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Areen-09/quatern" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Repository Architecture
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;quatern/
├── backend/
│   ├── main.py        # FastAPI endpoints for POS, sync, AI, and messaging
│   ├── ai.py          # Gemma 4 E2B runner (llama-cpp-python) &amp;amp; SQLite BI grounding
│   ├── db.py          # WAL-mode SQLite schema, migrations &amp;amp; SHA-256 PIN guard
│   ├── escpos.py      # 58mm &amp;amp; 80mm ESC/POS thermal receipt byte-stream driver
│   ├── messaging.py   # WhatsApp (wa.me, Meta Cloud) &amp;amp; Indian SMS dispatch
│   └── ocr.py         # Local Tesseract supplier bill invoice parser
├── src/
│   ├── lib/
│   │   ├── money.ts   # Deterministic integer-paise GST &amp;amp; discount arithmetic
│   │   ├── forecast.ts# Moving average &amp;amp; exponential smoothing engine
│   │   ├── importer.ts# Fuzzy-header Excel/CSV catalog &amp;amp; ledger mapper
│   │   └── store.ts   # Offline-first state hydrated from local SQLite
│   └── views/         # Billing, Invoices, Udhaar Ledger, Inventory, AI Assistant, Forecast
├── desktop.py         # Native PyWebView container + background FastAPI daemon
└── build_desktop.py   # PyInstaller bundler -&amp;gt; standalone Quatern.exe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Grounding Gemma 4 E2B on Live SQLite Telemetry
&lt;/h3&gt;

&lt;p&gt;To eliminate financial hallucinations, &lt;code&gt;backend/ai.py&lt;/code&gt; never asks the LLM to do mental arithmetic. Instead, &lt;code&gt;get_business_intelligence_snapshot()&lt;/code&gt; queries the local SQLite database in real time—calculating exact DoD/WoW/MoM growth, product margins, low-stock warnings, and aged debts—and injects this verified snapshot into the local &lt;strong&gt;Gemma 4 E2B&lt;/strong&gt; context window:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# backend/ai.py: Local Gemma 4 E2B GGUF Inference via llama-cpp-python
&lt;/span&gt;&lt;span class="n"&gt;DEFAULT_MODEL_FILENAME&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;google_gemma-4-E2B-it-Q4_K_M.gguf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;DEFAULT_MODEL_URL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://huggingface.co/bartowski/google_gemma-4-E2B-it-GGUF/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;resolve/main/google_gemma-4-E2B-it-Q4_K_M.gguf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_local_llm&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="n"&gt;_cached_local_llm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_cached_local_llm_path&lt;/span&gt;
    &lt;span class="n"&gt;cfg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_ai_config&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;model_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;model_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;model_path&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="nf"&gt;get_default_model_path&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;model_path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;model_path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stat&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;st_size&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;100_000_000&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;_local_llm_lock&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;_cached_local_llm&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;_cached_local_llm_path&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model_path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;_cached_local_llm&lt;/span&gt;
        &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;llama_cpp&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Llama&lt;/span&gt;
        &lt;span class="n"&gt;_cached_local_llm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Llama&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;model_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model_path&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="n"&gt;n_ctx&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2048&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;n_threads&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;verbose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;_cached_local_llm_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;_cached_local_llm&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Deterministic Integer-Paise GST Math
&lt;/h3&gt;

&lt;p&gt;Every transaction is represented and computed as &lt;strong&gt;integer paise&lt;/strong&gt; (&lt;code&gt;100 paise = ₹1.00&lt;/code&gt;), preventing floating-point rounding errors from corrupting GST filings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/lib/money.ts: Deterministic Integer-Paise GST Arithmetic&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;calcLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;LineInput&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;LineCalc&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;gross&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;qty&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;discount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;gross&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;discountPct&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;taxable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;gross&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;discount&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tax&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;taxable&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;gst&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;gross&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;discount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;taxable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;tax&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;total&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;taxable&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;tax&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;Quatern is engineered around a four-part open-source architecture designed for the hardware constraints of Indian retail:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;On-Device Open-Weight LLM (&lt;code&gt;Gemma 4 E2B Q4_K_M&lt;/code&gt;):&lt;/strong&gt; Downloadable directly inside the app with background chunk polling. Runs via &lt;code&gt;llama-cpp-python&lt;/code&gt; across 4 CPU threads (&lt;code&gt;n_ctx=2048&lt;/code&gt;, &lt;code&gt;temperature=0.2&lt;/code&gt;), enabling any standard dual-core or quad-core PC with 4–8 GB RAM (and no dedicated GPU) to serve as a fluent Hinglish/Hindi/English retail analyst.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Privacy-Preserving RFM Cohort Engine:&lt;/strong&gt; Computes inter-purchase intervals from SQLite invoice records. When an interval exceeds regular buying frequency by 3+ days, customers are automatically grouped into the &lt;em&gt;Replenishment Overdue&lt;/em&gt; bucket, while inactive shoppers (20–60 days) enter the &lt;em&gt;Win-Back&lt;/em&gt; cohort.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Statistical Demand Forecasting &amp;amp; Heuristic Fallback:&lt;/strong&gt; Uses moving averages and single exponential smoothing (&lt;code&gt;alpha = 0.3&lt;/code&gt;) for rapid demand projections. On low-memory machines where GGUF weights aren't downloaded, Quatern seamlessly falls back to a deterministic multilingual heuristic engine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lightweight Native Desktop Distribution:&lt;/strong&gt; &lt;code&gt;desktop.py&lt;/code&gt; runs FastAPI on a background thread and renders via PyWebView using the OS-native Microsoft WebView2 runtime (avoiding Electron's heavy 200 MB Chromium footprint).&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;Building Quatern on closed proprietary APIs would have rendered this solution economically unviable:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Zero Token Tax Enables a ₹4/Day ($1.75/Month) Model:&lt;/strong&gt; Neighborhood store owners will never pay $30/month for cloud AI. At ₹149/month ($1.75/mo), querying commercial cloud APIs 25+ times daily would consume the entire margin. On-device Gemma 4 E2B drops incremental inference costs to &lt;strong&gt;$0.00&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Absolute Data Sovereignty:&lt;/strong&gt; Kirana owners are fiercely private about daily cash sales, landed wholesale margins, and customer credit balances. Running SQLite locally and executing inference on-device guarantees &lt;strong&gt;no financial data ever leaves the counter&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uncompromised Offline Reliability:&lt;/strong&gt; Internet connections frequently fluctuate in semi-urban and Tier-2/3 markets during peak evening billing hours (6 PM – 9 PM). Quatern operates entirely offline without interruption.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom Hinglish Grounding:&lt;/strong&gt; Open weights allow seamless pairing of verified local database metrics with tailored Hinglish prompts (&lt;code&gt;Namaste {owner_name} ji&lt;/code&gt;) without third-party API restrictions.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  My First User
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Field Survey Across 64 Local Small Businesses
&lt;/h3&gt;

&lt;p&gt;I took a working build of Quatern on a laptop and conducted live counter walkthroughs across &lt;strong&gt;64 local small businesses&lt;/strong&gt; in my area:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Cohort (n = 64 Local Shops)&lt;/th&gt;
&lt;th&gt;Stores&lt;/th&gt;
&lt;th&gt;Share&lt;/th&gt;
&lt;th&gt;Primary Feedback&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ready to Adopt (with Mobile Access)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;12&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;18.8%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Wanted 3-click POS, WhatsApp bills, and Hinglish AI; requested dual mobile access alongside desktop.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Data Conscious (Want Cloud Backup)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;19&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;29.7%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Eager to replace paper ledgers, but required an automated encrypted backup before committing.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Trade-Specific Workflows Needed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;33&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;51.5%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Requested industry-specific fields (medicine expiry alerts, clothing size/color matrices, loose-weight bulk billing).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total Surveyed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;100%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;100% confirmed legacy POS (₹40,000+ hardware + ₹15,000/mo operator) is unaffordable.&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  First Active Pilot Store
&lt;/h3&gt;

&lt;p&gt;Out of the 12 ready-to-adopt stores, a neighborhood provision and general store became Quatern's first active pilot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Onboarded in 25 Minutes:&lt;/strong&gt; Imported 180 fast-moving SKUs and 45 regular customer accounts using the fuzzy Excel importer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Immediate Cash Flow Result:&lt;/strong&gt; Using the &lt;strong&gt;Pending Udhaar&lt;/strong&gt; screen, the owner sent polite 1-click WhatsApp payment reminders in Hinglish to 8 overdue customers—&lt;strong&gt;recovering ₹4,200 in pending balances that same evening&lt;/strong&gt; without awkward confrontation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Willingness to Pay:&lt;/strong&gt; When shown that automated encrypted offsite backup + mobile sync would cost just ₹149/month (~₹5/day), &lt;strong&gt;11 of the 31 interested stores offered to pre-pay ₹1,499 for an annual plan&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of Gemma:&lt;/strong&gt; Quatern integrates Google's open-weight &lt;strong&gt;Gemma 4 E2B (&lt;code&gt;google_gemma-4-E2B-it-Q4_K_M.gguf&lt;/code&gt;)&lt;/strong&gt; natively via &lt;code&gt;llama-cpp-python&lt;/code&gt; with an in-app Hugging Face downloader. It grounds Gemma 4 E2B on real-time SQLite financial snapshots to answer merchant questions in Hinglish, Hindi, and English completely offline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of GitHub Copilot:&lt;/strong&gt; Developed with agentic architecture standards established in &lt;code&gt;AGENTS.md&lt;/code&gt; and packaged end-to-end via &lt;strong&gt;GitHub Actions&lt;/strong&gt; (&lt;code&gt;.github/workflows/release.yml&lt;/code&gt;), compiling the React 19 UI, FastAPI backend, and &lt;code&gt;llama-cpp-python&lt;/code&gt; CPU engine into a standalone Windows executable release on every tag.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
      <category>gemma</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
