Skip to content
Hamza Patel

Shop Manager: Wholesale Sales & Stock App

A phone-first app for a seasonal watermelon wholesale business: sales, payments, dues, stock and daily reports, replacing a paper notebook.

Private repository
Shop app dashboard showing today’s sales, stock, payments collected and dues

150 automated database checks · ₹0 running cost

The problem

My brother runs a seasonal watermelon wholesale business. Sales, credit and stock lived in a notebook: who owes what, how much stock is left, and what today's total was took manual adding up, and mistakes were easy to miss.

What it does

  • Record a sale in seconds: customer, weight × rate per line, optional final price (the discount is worked out, never typed).
  • Payments in cash or UPI, partial or full. A lump-sum payment is split across a customer's oldest unpaid orders automatically.
  • Live stock from purchases, sales and wastage. A sale that would take stock below zero is refused.
  • Purchases with landed cost (goods plus transport, labour and other costs).
  • Daily and monthly reports, plus a today dashboard.
  • Bills shared on WhatsApp when the customer has a phone number.
  • Installs on the phone like an app (PWA) and updates itself with one tap.

How it's built

  • Every write goes through a database function. The app never edits tables directly. Each PostgreSQL function checks the input, updates stock and money together in one transaction, and returns a clear error code.
  • Security in the database, not just the app. Row Level Security and an allowlist mean only the two approved accounts can read or change anything, even with the public key.
  • Nothing is ever deleted. Orders are cancelled, payments voided, and every edit is kept as a version, so the history can always be checked.
  • Safe on a bad network. Each save carries a unique request ID, so a double tap or a retry can't create two orders.
  • Two people, one stock count. Stock changes take a lock, so two sales at the same moment can't sell the same stock twice. Tested with two simultaneous sessions.
  • Separate dev and production databases, a daily keep-alive job, and encrypted nightly backups through GitHub Actions.

Result

  • Live since October 2026, used daily by the owner and me.
  • 150 automated database checks covering money maths, stock rules, permissions and edge cases. All passing.
  • Runs entirely on free plans: ₹0 a month.

Private business tool, demo on request. My work covered requirements with the owner, data model and business rules, development, testing and deployment.

New sale form with weight, rate and an automatic discount calculationCustomer page showing outstanding dues and order historyDaily report with sales, payments collected, dues and stock in and out
Next projectAncrox International