Skip to content
Case studyMulti-Tenant SaaS · POSIn production

Haazir Billing — GST Billing & Inventory Platform

Runs an Indian shop's billing, GST and stock across a desktop, a phone, a POS terminal and the web — from one shared codebase.

Multi-tenant GST billing, inventory, sales/purchase, returns and reporting for Indian businesses. One Fastify API serves a Flutter app family (Windows desktop, Android/iOS mobile, Android POS), a Next.js responsive web app and a super-admin panel — five surfaces from a single shared core.

Haazir Billing — GST Billing & Inventory Platform interface
Industry
Retail / SMB
Role
Architect & Full-Stack Engineer
Team
Solo — one author in the repository history
Type
SaaS Platform
Year
2025 — present

01

Overview

Haazir Billing is a multi-tenant billing and inventory platform for Indian retail, grocery, medical, hardware and wholesale businesses. It covers GST invoicing, estimates, purchases and receive-stock, credit and debit notes, party ledgers and discounts, bank accounts and transactions, expenses, staff permissions and reporting.

The architecture is what makes five surfaces maintainable by one person. The three Flutter apps — Windows desktop, Android/iOS mobile and Android POS — are thin shells over a single shared core package that holds every model, service, provider, screen and the theme; each app's entry point is one line. A Next.js web app replicates the desktop experience for the browser, and a separate Next.js super-admin panel manages the platform. All of them speak to one Fastify API over JWT plus a shop-id header, so a feature lands once and appears everywhere.

Multi-tenancy is per-shop: every request is scoped by shop id, with admin and staff roles carrying per-feature permissions. Sessions and hot data sit in Redis; MySQL via Sequelize holds the domain. Login is OTP over WhatsApp, and the same WhatsApp integration delivers invoices, with Firebase handling push.

The Windows build is published on the Microsoft Store, and the desktop and POS surfaces keep working through connectivity gaps — which for a counter is the difference between trading and not.

02

Business challenge

The same billing product was needed on a shop desktop, a phone, a touch POS terminal and the web. Building four applications separately would have meant four codebases drifting apart, and a feature request landing four times — while the business still needed GST compliance, stock and party ledgers to agree across all of them.

What discovery showed

Separated what is genuinely platform-specific — window chrome, printer access, touch target sizing — from what is not, and found almost everything else (models, services, state, screens, theme) was identical across the three Flutter targets.

Before this system

The same product was needed on a shop desktop, a phone, a touch POS terminal and the web.
Four separately built applications would have meant four codebases drifting apart.
GST calculations, stock and party ledgers had to agree across every surface.
Shop connectivity is unreliable, and billing cannot stop when it drops.

03

Solution

Put every model, service, provider, screen and the theme into one shared Flutter core package and reduced each of the three apps to a one-line entry point. A Next.js web app replicates the desktop experience for the browser, and all surfaces — plus a super-admin panel — talk to one Fastify API scoped per shop.

What it does

Five surfaces from one shared core — Windows, Android, iOS, POS and web
Multi-tenant: every request scoped by shop, with admin/staff per-feature permissions
GST billing, estimates, credit and debit notes
Inventory, receive-stock, purchases and returns
Party contacts with ledgers and per-party discounts
Bank accounts, transactions and expense tracking
Reporting across sales, purchases, stock and money
OTP login over WhatsApp; invoices delivered on the same channel
Redis-backed sessions and caching behind a Fastify REST API
Super-admin panel for platform-level shop management
Published on the Microsoft Store

04

My contribution

Role
Architect & Full-Stack Engineer
Team
Solo — one author in the repository history
Scope of my work
API, shared Flutter core, the three application shells, web application and super-admin panel
Engagement
Built at Mopa Global Services
Designed the shared-core architecture: every model, service, provider, screen and the theme in one Flutter package.
Reduced the Windows, mobile and POS applications to thin entry points over that package.
Built the Fastify API with tenant scoping carried in the request contract.
Built the offline layer: local SQLite storage, the connectivity watcher and the sync service.
Built the Next.js web application and the separate super-admin panel.
Integrated WhatsApp for one-time-password login and invoice delivery, and Firebase for push notifications.

05

Product screenshots

Screens from the application itself. Select any image to view it full size.

06

Architecture

Three thin Flutter shells, one shared core, one tenant-scoped APIWindows, mobile and POS Flutter apps are thin shells over a shared core package. The core package and the Next.js web and super-admin apps call a Fastify API, which uses MySQL through Sequelize, Redis for sessions and cache, the WhatsApp Business API and Firebase Cloud Messaging.Flutter shellsClient layerAPIData & integrationsWindows desktopMicrosoft Store buildMobileAndroid · iOSPOS terminalAndroid touch POSShared core packageModels · state · screensLocal SQLite · syncWeb · super-adminNext.js 16 · React 19Fastify 5 API/api/v1JWT + x-shop-idMySQLSequelizeRedisSessions · cacheWhatsApp BusinessOTP login · invoicesFirebase FCMPush notifications

Swipe sideways, or expand to zoom.

Three thin Flutter shells, one shared core, one tenant-scoped API

The desktop, phone and POS builds contain almost no code of their own — models, services, state, screens and theme all live in one shared package, so a screen is written once and ships to all three. The browser apps are separate Next.js projects against the same API. Every request carries a JWT and a shop id, so tenant scoping is enforced at the boundary rather than remembered query by query.

  • Interface
  • Service
  • Data store
  • External system

How it fits together

  1. 01Fastify 5 REST API at /api/v1 over MySQL (Sequelize) with Redis for sessions and cache
  2. 02JWT bearer auth plus an x-shop-id header — every request is tenant-scoped
  3. 03Three Flutter apps (Windows, Android/iOS, Android POS) as thin shells over one shared core package
  4. 04Next.js 16 responsive web app mirroring the desktop surface
  5. 05Separate Next.js super-admin panel for platform-level management
  6. 06WhatsApp Business API for OTP login and invoice delivery; Firebase FCM for push
  7. 07Consistent response envelope with top-level pagination on list endpoints

Data and API design

  1. 01REST API under /api/v1 with a consistent response envelope and top-level pagination on list endpoints.
  2. 02Every request carries a JWT and an x-shop-id header; the shop id scopes all data access.
  3. 03On the device, SQLite mirrors items, categories, contacts, sales and purchases, with a synced flag on each locally created row.
  4. 04Stock changes made offline are logged to a pending table and replayed in order.

07

Engineering challenges

01

One product, four places to run it

The difficulty
A shop bills on a desktop, a phone, a touch POS terminal and a browser. Built separately, every feature and every fix lands four times.
Why it mattered
The applications drift apart in the gaps, and a small team spends its time keeping them level instead of improving the product.
Options weighed
  • Four separately built applications
  • One shared Flutter core with a thin shell per platform
What was built
Everything that is not genuinely platform-specific — models, services, state, screens and theme — lives in one core package. Each of the three Flutter applications is a one-line entry point over it; only window chrome, printer access and touch sizing differ.
Why this approach
Separating what is truly platform-specific showed that almost nothing was.
Result
A screen is written once and ships to desktop, mobile and POS together.

02

Billing has to keep working when the connection drops

The difficulty
A shop cannot stop serving customers because the internet is down — and a device that reports “connected” may still be unable to reach the server.
Why it mattered
A sale that cannot be recorded is either lost or written on paper and re-entered later.
What was built
Sales are written to local SQLite first, with a local id and an unsynced flag. A connectivity watcher checks both the network state and whether the API host is actually reachable. When it reports online — and every five minutes while anything is pending — a sync service posts sales, then purchases, then stock changes, stores the server ids that come back, and refreshes the catalogue.
Why this approach
Writing locally first makes the network an optimisation rather than a dependency, and syncing in a fixed order keeps stock consistent with the sales that changed it.
Result
The counter keeps trading through an outage and the server catches up on its own. Each record is sent independently, so one rejected row cannot block the rest.

03

An offline catalogue has to be the whole catalogue

The difficulty
Barcode search and the inventory list filter the local cache in memory. The API returns products a page at a time, so a single fetch leaves a large shop with only its first hundred items.
Why it mattered
A product missing from the cache cannot be scanned at the counter while offline.
What was built
The sync service fetches every page of the catalogue, saves it locally and records that the cache is complete before the offline paths rely on it.
Why this approach
The offline paths are only correct if they can trust the cache to be complete, so completeness is tracked explicitly.
Result
Shops with catalogues of well over a thousand products can scan and bill any item offline.

04

Tenant isolation that does not rely on memory

The difficulty
Every shop’s sales, stock and ledgers live in one database.
Why it mattered
Scoping spread across handlers is one forgotten filter away from one shop seeing another’s sales.
Options weighed
  • Each handler adds its own shop filter
  • The shop id is a required part of the request contract
What was built
The shop id travels as a required header alongside the JWT, so scoping is applied at the boundary.
Why this approach
A rule enforced where requests enter cannot be forgotten in a new handler.
Result
New endpoints are tenant-scoped by default.

05

Signing in shopkeepers who do not use email

The difficulty
Many shopkeepers do not reliably have email, and password resets over SMS meant another vendor and another cost.
Why it mattered
An account a shopkeeper cannot get back into is a lost customer.
Options weighed
  • Email and password
  • One-time passwords over SMS
  • One-time passwords over WhatsApp
What was built
WhatsApp carries both one-time-password login and invoice delivery to customers.
Why this approach
It is the channel the users already live in, and one integration covers two needs.
Result
One fewer vendor, and fewer support requests about access.

08

Technology stack

Frontend
FlutterRiverpodNext.js 16React 19TypeScriptTailwind CSS 4TanStack Query
Backend
Fastify 5Node.jsSequelize
Data
MySQLRedis
Infrastructure
Docker

Why these choices

Flutter + Riverpod
One core package compiled for Windows, Android, iOS and POS terminals.
SQLite
Local storage that lets billing continue offline.
Fastify 5
The single REST API behind every surface.
MySQL + Sequelize
Server-side system of record for every shop.
Redis
Sessions and cache.
Next.js 16
Browser application and the super-admin panel.
WhatsApp Business API
Login codes and invoices on the channel shopkeepers already use.

09

Security & scale

Security

JWT bearer authentication on every request.
Tenant scoping through a required shop-id header.
HTTP security headers and rate limiting at the API.
One-time-password login over WhatsApp instead of stored passwords shared by SMS.
A separate super-admin panel for platform-level management.

Scalability

A stateless API with sessions and cache in Redis.
List endpoints are paginated with a consistent envelope.
Clients read from a local cache first, which takes read load off the server.

10

Business impact

Every figure is labelled with where it comes from: a measurement, an estimate, a design target, or a fact of the system as built.

5

Surfaces from one codebase

Windows, Android and iOS, POS terminal, web and super-admin.

System fact

1

Shared core package

Models, services, state, screens and theme written once.

System fact

Offline

Billing through outages

Sales are stored locally and synchronised when the server is reachable.

System fact

Listed

Microsoft Store

The Windows build is published on the Microsoft Store.

System fact

What changed

Adding a feature
BeforeBuilt and fixed separately for each platform.
AfterWritten once in the shared core, shipped to every Flutter target.
Losing connectivity
BeforeBilling stops, or moves to paper.
AfterSales are recorded locally and synchronised afterwards.
Stock and ledgers
BeforeHad to be kept in agreement across separate apps.
AfterOne API and one database behind every surface.

One codebase serves five surfaces, so a shop can bill on a desktop, a phone, a POS terminal or the browser and see the same stock and ledgers. The Windows build is on the Microsoft Store, and the counter keeps trading through connectivity gaps.

11

Project status

In production2025 — present
In production and maintained.
The Windows application is published on the Microsoft Store.
The backend, admin panel and Redis run as a Docker Compose stack.

What I took from it

  • A shared core with thin platform shells is what makes a four-surface product maintainable by a small team.
  • Putting the tenant key in the request contract beats trusting every handler to scope its own queries.
  • Choosing the channel users already use — WhatsApp — removed both a vendor and a support burden.

A billing platform that a small team can keep level across five surfaces because almost all of it is written once — and that a shop can rely on because the counter does not depend on the connection.

Next step

Need a similar solution for your business?

Tell me what you are trying to build or fix. I will come back with how I would approach it, what it realistically takes and where the risks are.

Related work

All projects