The problem
Paper punch cards get lost, copied and stamped twice. A digital card has to be as quick as a punch at a busy counter, hard to abuse, and cheap enough for a café paying a few hundred rupees a month.
How it works
Each customer has a card showing N of M stamps. Staff scan the card, enter the invoice number and issue a stamp or redeem a reward. Owners set the programme rules and see activity, staff, card batches and reports on a dashboard.
Key decisions
- Latency first
- The budget is p95 under 800 ms from scan to confirmation. Free-tier servers sleep when idle, so the deployment is planned around cold starts at the counter.
- The audit trail is the product
- Every stamp is tied to an invoice number, with a constraint against reusing one, so a friend stamped for free or one bill stamped five times shows up.
- Cost rounds to zero per café
- Even 500 cafés means about ten writes a second, nothing for Postgres, so scale drives no decision and hosting stays on free tiers.
- Shared contracts
- The API and the web app share zod contracts, rejection reasons and programme rules from one package.
Status
Version 1 was deployed and proven end to end on real infrastructure: a printed QR at a café counter was stamped from an Android phone and the customer saw the stamp. Version 2 rebuilds the account model and passes 123 tests; it isn't launched yet.
