EasyPay

Client project, for a card-to-cash business. More client work

Money control for a card-to-cash business. Card machines, retail customers, wholesale dealers, cash, expenses and profit, with margins under one percent.

Source is private
Status
In use
My part
Contributor on a three-person team
Started
21 Sept 2026
My part
Cash handling, customer statements, expense files
Lines I added
About 8,200
Money
Exact decimals, never floating point
Runs on
Railway, Singapore

A customer swipes a card. The shop hands over the amount less its charge. Days later the bank credits the shop the amount less the bank’s own charge. The gap between those two charges is the profit, and it runs between 0.3% and 0.9%.

At margins that thin, a rounding error is real money. EasyPay is the system the business runs on: every card machine, every customer visit, every dealer, every movement of cash, and what was actually made.

I am one of three people who built it. The repository belongs to the team lead and is private, so this page describes my part.

What I built

  • Cash handling and dealers. Where cash comes from and goes to: the shop’s own till, cash provided by dealers, withdrawals, and what the shop owes someone out of their own money. “Add cash” and “Give cash” ask what the cash is for, so the books say why it moved.
  • The customer page and statement. What a customer swiped, the charge on each swipe, the cash paid out and any advance not yet collected. Entries that were undone stay out of the way in the activity log.
  • Statement PDFs. One export per customer or staff member: every swipe of a visit, its percentage, the card’s last four digits and the dates.
  • A charge rate per card type. Each card type carries its own customer percentage, and any card the owner adds gets one too.
  • Files on expenses. Invoices, deposit slips and receipts attached to the expense they belong to.
  • Cash flow. Till shortages by month, and salary payments that can take in charges and other amounts, each ticked by choice.

How it runs

EasyPay is in daily use and runs on Railway in Singapore: one Docker container for the app and one PostgreSQL database. Database migrations run before every deploy, and a health check only answers when the database is reachable, so a release that can’t reach its data never takes traffic. Receipt pictures go to a storage bucket rather than the container’s disk, which is wiped on every deploy.

Getting the money right

No amount in EasyPay is ever a JavaScript number. Every figure is an exact decimal from the form field to the database and back, with one place where rounding happens and tests around it.

Moving a charge is capped: a swipe’s charge can be at most 10% of the swipe, so a slip of the finger cannot turn a fee into a fortune.

Who sees what

There are three roles. The owner sees everything, including profit and rates. Staff enter figures but have no profit page and cannot change the machines, banks or rates. Viewers can only read.

How it is built

Next.js with server actions, Prisma and PostgreSQL, deployed as one container with one database. Receipts and slips are stored in a private bucket. A health endpoint answers only when the database is reachable, and migrations run before each deploy.