American System

settling money between friends

Full-stack project · 2024 · Full-stack

Try it as a test user → Code on GitHub

The Wasuli Bhai dashboard with a score of 50, balances, and receipts that need action

The problem

Friends who split bills lose track of who owes what, and asking for money back is awkward.

Outcome

Live, with a one-click test user

Stack

  • Next.js
  • Chakra UI
  • TypeScript
  • Cloudflare Workers
  • D1
  • JWT

What I built

American System is a social network for going Dutch, and Wasuli Bhai is its app. Every pair of friends shares a tab. You send a receipt for someone’s share with a due date, they accept it, mark it paid, and you confirm. Your reputation follows how you pay, in tiers everyone can see: Nawab Sahib, Malik Riaz Jr, Kar len ge bro, Mufta, Karzai and Naya Murga.

How it works

  • One Cloudflare Worker serves the Next.js app as static files and the API under /api, on a D1 (SQLite) database with foreign keys and cascades.
  • A receipt lifecycle (sent, accepted, rejected, cancelled, paid, confirmed, pardoned) enforced on the server: only the right person can make each move.
  • Credit scores from payment history: on time counts in full, late counts half, overdue counts nothing.
  • Test users get four demo friends with their own habits, who accept your receipts and confirm your payments instantly. Hina always pays on time; Bilal turns down anything over Rs 5,000.
  • Security on Web Crypto alone: PBKDF2 password hashing, HS256 JWTs, rate-limited test users and a daily cleanup cron.

A 28-check smoke test walks the whole API, from the test user’s score moving from 50 to 83 to two real accounts settling a receipt, and checks that nobody can act on or read what isn’t theirs.