Overview
A production-grade point-of-sale and business management system built for a meat retail operation in Sri Lanka. The platform replaces manual bookkeeping with a unified digital workflow spanning supplier receipts, customer sales, payment tracking, petty cash, and automated daily financial summaries, designed for non-technical staff and deployed into a live retail environment.
Problem
The shop ran entirely on paper. Receipts scribbled in notebooks, supplier balances tracked from memory, and daily reconciliation done by hand. Stock discrepancies went unnoticed for days. Outstanding customer balances were disputed. The owner had no consolidated view of business health, no audit trail, and no way to generate reports without sitting down for hours after close. The system needed to be fast enough for counter use, accurate enough for accounting, and simple enough that staff would actually use it.
Solution Architecture
Key Features
Data Model
15 tables in Supabase PostgreSQL with foreign key relationships, indexes, and 6 trigger functions:
| Domain | Tables |
|---|---|
| Identity | profiles |
| Supply Chain | suppliers, supplier_receipts, receipt_items |
| Sales | customers, sales, sales_items |
| Finance | payments_sent, payments_received, petty_cash, cash_ledger, daily_summaries |
| System | audit_logs, app_notifications |
Tech Stack
| Layer | Tools |
|---|---|
| Framework | Next.js 16.1 (App Router), React 19, TypeScript 5 |
| UI Components | shadcn/ui (13 components, New York), Radix UI (11 primitives) |
| Styling | Tailwind CSS 4, class-variance-authority |
| Database | Supabase PostgreSQL |
| Auth | Supabase Auth (role-based: owner, admin, employee) |
| Validation | Zod 4 (16+ schemas), React Hook Form 7 |
| Animation | Framer Motion 12 |
| Reporting | xlsx 0.18.5 (SheetJS) |
| Notifications | Sonner (toast system) |
| API | 14 RESTful route handlers + auth sub-routes |
| Deployment | Vercel |
API Surface
14 RESTful endpoints covering the full business domain:
Challenges & Solutions
1. Non-Technical User Adoption
Challenge: Staff had never used a digital POS. Any friction would push them back to paper. Solution: Minimal-step input flows, large touch-friendly dialog forms, sensible defaults, and immediate visual feedback via Framer Motion transitions confirming actions. Zod validation catches errors before submission, not after. Nine purpose-built dialog components cover every daily workflow without requiring navigation.
2. Financial Accuracy Under Real-World Conditions
Challenge: Currency handling (Sri Lankan Rupee) with partial payments, fractional quantities, running balances across suppliers and customers, and end-of-day reconciliation that must match physical cash. Solution: Zod schemas enforce numeric precision at every entry point. The cash ledger aggregates all payment channels into a single source of truth. Daily summaries auto-calculate expected vs. actual balances with configurable discrepancy thresholds (Rs 500 warning level). Transaction locking after daily closure ensures data immutability.
3. Auditability & Trust
Challenge: The owner needed confidence that every transaction was traceable and that staff couldn't silently modify records. Solution: Full audit logging with JSONB detail capture on every CRUD operation. Admin dashboard with transaction approval workflows. Daily summary system creates an immutable financial snapshot that locks the day's data from further modification.
4. Role-Based Data Boundaries
Challenge: Owner needs full visibility and approval authority; employees should only access operational screens. Solution: Supabase Row-Level Security policies enforce data isolation at the database layer. Auth roles (owner, admin, employee) map to distinct permission sets across all 14 API routes. Admin-only surfaces (audit logs, approvals, analytics) are gated at both the route and component level.
My Role
End-to-end delivery as sole Full-Stack Engineer on a freelance engagement:
Outcome
Deployed 23 October 2025 as a production system replacing the shop's manual bookkeeping entirely. The owner gained instant visibility into daily revenue, supplier balances, outstanding customer payments, and profit margins. Staff adopted the system within the first week, processing sales and receipts through dialog-driven workflows without reverting to paper. Daily reconciliation that previously took over an hour now completes in minutes with automated calculations and discrepancy detection.
Future Enhancements
---
A ground-up business system that replaced paper ledgers with real-time financial oversight, built for non-technical users in a live retail environment.
