Skip to content
KB.consultingKB.consulting

POS SaaS · Multi-tenant · Mobile + AI

kazir.co.id

kazir.co.id

A multi-tenant POS SaaS (database per tenant) with an offline-first Flutter mobile app + automatic sync, a Next.js web admin, and built-in Gemini AI for demand forecasting, reorder suggestions, anomaly detection, and receipt OCR. A subdomain per merchant + custom domains on the Pro tier — white-label ready for regional partners and industry verticals.

kazir.co.id
POS SaaS · Multi-tenant · Mobile + AI
kazir.co.id
live
DB-per-tenant
stancl/tenancy v3.8 + PostgreSQL
3 platforms
Next.js admin + Flutter mobile + API
6 AI features
forecast, reorder, anomaly, OCR, categorization, chat
01True database-per-tenant multi-tenancy (PostgreSQL via stancl/tenancy v3.8) — not row-level isolation
02Offline-first Flutter mobile with Drift SQLite — cashiers keep selling without internet, auto-sync once online
036 integrated Gemini AI features (demand forecast, reorder suggestions, anomaly detection, receipt OCR, categorization, chat insights)
04Real-time order broadcasting via Laravel Reverb WebSocket (orders.{outletId} channel)
01The story

Context

Internal R&D at KB Consulting — a product we built for ourselves as a POS reference architecture, so we can white-label it for Indonesian SME and retail clients. Existing players (Moka, Pawoon, Olsera) are good, but monthly per-outlet billing is too heavy for small shops; free apps like Kasir Pintar lack AI, multi-outlet, and serious multi-tenancy. The gap was clear: an affordable, AI-native local POS platform that can be forked as the starting point for client projects.

Architecture decisions

Multi-tenancy: database-per-tenant via stancl/tenancy v3.8 on PostgreSQL — not row-level. The trade-off is slightly higher infrastructure cost, but per-tenant compliance and auditing are much cleaner, queries never scan thousands of other tenants' rows, and we can offer specific data residency to enterprise clients. Offline-first mobile was non-negotiable: cashiers must keep selling through an 8-hour WiFi outage and sync cleanly once back online — Drift SQLite + a reconciliation queue that handles conflicts (out of stock on the server vs. sold on mobile, price changes, etc.). Hardware integration (Bluetooth ESC/POS thermal printers, barcode scanners) had to be reliable on IDR 1–2M Android devices, not just flagships.

Engineering depth

Laravel 11 backend: Sanctum auth (password + a PIN for cashier terminals), Horizon on Redis queues, Reverb WebSocket for real-time per-outlet order broadcasts, Meilisearch full-text search, a repository pattern (Controllers → Services → Repositories), and event-driven double-entry accounting (OrderCompleted → CreateSaleJournalEntry, OrderVoided → ReverseJournalEntry). AI subsystem: AIServiceManager + GeminiProvider with tiered models (fast/pro/lite), an AIUsageTracker with per-plan daily limits, prompt template classes, and an AICache to save tokens. Scheduled commands: GenerateDailyInsights, GenerateDemandForecast, GenerateReorderSuggestions, CheckAnomalies. A tenant-isolation safety-net middleware fires a critical alert if a DB connection leaks to the central database.

Results & status

Live at kazir.co.id — the apex Next.js app for marketing + login + dashboard, api.kazir.co.id for the Laravel API, ws.kazir.co.id for Reverb, wildcard *.kazir.co.id for tenant subdomains, plus on-demand certificates for Pro-tier custom domains. Deployed via GitHub Actions + Docker Compose + Caddy. Currently onboarding beta tenants while rolling out more advanced AI features. A reference architecture for clients who need a custom POS / multi-tenant SaaS — fork it as a starting point and save 6–10 weeks of setup versus building from scratch.

02Technical highlights

What made this
project interesting.

  • True database-per-tenant multi-tenancy (PostgreSQL via stancl/tenancy v3.8) — not row-level isolation
  • Offline-first Flutter mobile with Drift SQLite — cashiers keep selling without internet, auto-sync once online
  • 6 integrated Gemini AI features (demand forecast, reorder suggestions, anomaly detection, receipt OCR, categorization, chat insights)
  • Real-time order broadcasting via Laravel Reverb WebSocket (orders.{outletId} channel)
  • Hardware-ready: barcode scanners + Bluetooth ESC/POS thermal printers out of the box
  • Caddy wildcard TLS for *.kazir.co.id + on-demand certificates for Pro-tier custom domains
  • PIN login for cashier terminals + role permissions (owner/manager/cashier) via spatie/laravel-permission

Want to see your idea become something like kazir.co.id?

Let's talk about
your idea, 30 minutes.

Free Consultation

Start now

Got an idea?
Let's validate it first.

30 minutes, free, no commitment. If we click, we move on to a validation session. If not, we'll recommend someone who's a better fit — still at no cost.