Skip to content
All projects

Case study · Build · 2026

S P L I T

The developer sideThe design side

Scan a receipt and send one link. Friends tap what they had, and tax and tip split to the exact cent.

S P L I T splits a restaurant bill from one scanned receipt. Friends tap what they had on a shared link, and tax and tip split to the exact cent. It is built with Next.js, Supabase and the Claude API, with Frankfurter for exchange rates, and it is live at split.andrewlengly.com.

The Who had what step in S P L I T. Five names sit in a tray above a list of receipt items, and each item shows the names pinned to it
  • What it does

    Scans a receipt and sends one link. Friends tap what they had, and tax and tip split to the penny.

    See the developer side
  • The brief

    Let friends split a receipt from their phones, with names that drag or tap onto each item.

    See the designer side
  1. 01

    The idea

    Split the tab without the math. One person scans the receipt, and everyone else taps what they had from a link.

  2. 02

    What I did

    Built a receipt scanner and a shared bill page on top of split math that adds up to the total. Trips settle many receipts across currencies.

  3. 03

    Where it stands

    Live at split.andrewlengly.com. 18 tests cover what comes in from receipts and requests, and the split math has none yet.

One person scans, and everyone else taps what they had.

  1. Scan

    Take a photo of the receipt and Claude reads its line items and totals. You can also type the items in.

  2. Paste

    Copy the receipt text with Live Text or Google Lens and paste it in. It’s parsed on the device with no network call.

  3. Who had what

    Drag a name from the tray onto an item, or tap a name and then tap items. Split everything evenly covers the whole bill in one tap.

  4. One link

    Friends pick their name on the bill link and tap what they had. The bill page refreshes every 3 seconds, so everyone sees the same claims.

  5. Tax and tip

    Tax is a rate or an amount, and it falls only on taxed items. Tip is a percent or an amount, split by order or evenly.

  6. Paying back

    Each friend sees their amount on buttons for Venmo, Cash App, PayPal and Zelle. The Zelle button copies the handle to paste into a bank app.

  7. Trips

    A trip collects receipts in different currencies and converts them to one. It then lists the payments that settle everyone up.

  8. Running tab

    The home page keeps a running tab across your recent bills, along with saved groups. Both stay on your device.

Two browsers played host and friend, and every total matched the hand-checked math.

  1. 01

    First build

    Scan, paste, claims, pay buttons and trips

    Merged November 3, 2026

  2. 02

    Host and friend

    Two browser sessions in one Playwright run

    Claims, live updates, pay links and settle-up

    Left out A real Claude scan and live exchange rates

  3. 03

    Its own host

    One rewrite for every path

    Old /split links redirect there

    Checked Seven other hosts served the same pages as before

  4. 04

    Audit fixes

    Each scan logged before the model call

    Why Scans sent together all got past the old limit

  5. 05

    Settle-up copy

    Four places promised the fewest payments

    Now they say who pays whom

From the first pull request to the settle-up fix

The audit came about a week after launch. A new claim now has to name an item and people that are on the bill, and new bills and trips are capped per visitor. On the bill screen only one save is in flight at a time, so two saves can’t land out of order.

Every screen answers a question about who owes what.

  1. Who had what?

    Answered by
    Claims, one row for each person and item
    Shows on
    The bill page
  2. What does each person owe once tax and tip are in?

    Answered by
    Each item shared among the people who claimed it, with tax, fees, discounts and tip spread on top
    Shows on
    The bill page
  3. Do the shares add up to the bill?

    Answered by
    Largest remainder rounding to whole cents
    Shows on
    Every total
  4. Who pays whom after a whole trip?

    Answered by
    Net balances in one currency, then a greedy settle-up
    Shows on
    The trip page

Each browser does the math from one bill kept on the server.

  1. 01

    Receipt

    A photo, shrunk to 2,000 px on its long side

    Or text pasted from Live Text

  2. 02

    Scan route

    Posts to the Anthropic Messages API

    A Claude Haiku model by default

    Reply capped at 2,500 tokens

    Every field of the reply checked

    Limits 3 scans per visitor every 30 minutes, and 200 a day across everyone

  3. 03

    Supabase

    Five tables behind row-level security

    Reached only from server routes

  4. 04

    Bill page

    Shares computed in the browser

    Refreshed every 3 seconds

    Also reads ECB daily rates through Frankfurter, cached 12 hours

How a receipt becomes a split

Pasted text goes to a parser on the device first. It handles rows printed on one line, and the layout where Live Text reads every name before every price. When the result looks off, Have Claude sort it sends the text to the model.

The model’s reply never reaches the browser as is. It has to parse as JSON, and each field is read on its own. At most 200 items are kept. The code lives inside this site’s repo, which is private.

Shares round to whole cents and still add up to the bill.

Each person’s share

  • totalitems + tax + fees − discounts + tip

Fees and discounts follow each person’s part of the item total. A tip split evenly is the tip divided by the number of people.

Rounding

  • tax from a raterate × taxed items, rounded to the cent the way a register does
  • final sharesfloored to whole cents, then the leftover cents go one at a time to the largest remainders

A $10.00 pizza split three ways with 7.25% tax and a 20% tip comes to $12.73. One person pays $4.25 and the other two pay $4.24.

Trips

  • balancewhat a person is owed across the trip’s bills minus what they owe, in the trip’s home currency
  • settle-upthe biggest debt pays the biggest credit, repeated until every balance is zero

Only unpaid shares count, and balances settle in whole cents.

New US bills start at California’s statewide 7.25%. The picker holds 24 more city and county rates from the CDTFA table effective October 1, 2026, and a tax amount printed on a scanned receipt replaces the rate.

Source for the California rates: CDTFA sales and use tax rates

The shares add up to the cent, and a trip can take one payment more than it needs.

The two charts below come from running S P L I T’s own split code, the same functions the bill and trip pages call.

  1. Zankar$32.51
  2. Justin$31.94
  3. Nancy$26.87
  4. Andrew$24.66
  5. Bailey$17.68
Each share of the sample sushi bill. The app’s own sample bill, with Sacramento’s 8.75% tax and an 18% tip split by order. The five shares add up to the bill’s $133.66. Rounding to whole cents left 1 cent over, and it went to Andrew, whose unrounded share of $24.65345 had the largest fraction of a cent.
  1. Greedy, as the trip page lists them4
  2. Shortest possible3
Payments to settle an example trip. Two bills shared by five people. A paid the first, and C and D owe $30 each on it. E owes B $50 for the second. Greedy sends E’s $50 to A, so C has to pay both A and B. Paying back whoever covered each bill takes 3.

Receipt text shows up out of order.

  1. Live Text reads names and prices as separate columns

    Risk
    Items paired with the wrong prices
    Call
    The parser handles that layout, and the scan prompt tells the model to pair them up
  2. Pasted text could close its own tag

    Risk
    Whatever follows reads as instructions to the model
    Call
    Strip any copy of the tag before sending, and check every reply as data
  3. A long receipt can run past the reply cap

    Risk
    A reply cut off partway through the list
    Call
    Spot the cutoff and ask for the items by hand
  4. A burst of scans can outrun the counter

    Risk
    Requests slip past the limit before they’re counted
    Call
    Log each scan before the model is called, and stop when the log can’t be written
  5. Some currencies have no ECB daily rate

    Risk
    A trip total that mixes currencies
    Call
    Count those receipts at face value and say so on the trip page
  6. Venmo and Cash App only take dollars

    Risk
    A pay button that opens with the wrong amount
    Call
    Hide both buttons on any other currency

Nobody signs in, and a bill deletes itself.

  1. No accounts

    Starting a bill stores an edit key in that browser, and only that browser can edit the bill. Anyone with the link can claim items and mark themselves paid.

  2. Bills expire

    A bill goes 30 days after its last change, or 7 days after everyone has paid the payer back. An empty trip goes after 30 days.

  3. Cleanup with no cron job

    Expired bills are cleared when someone starts a new one, at most once an hour. Opening an expired link deletes that bill too.

  4. Polling

    The bill page asks the server for the bill every 3 seconds, and only while its tab is visible. Nothing holds a connection open.

  5. No raw IPs

    The limit log stores a SHA-256 hash of the visitor’s IP with the kind of request. Rows are deleted after a day.

  6. Caps on what a link can write

    A bill holds up to 200 items and 40 people. One visitor can start 30 bills and 10 trips an hour.

  7. Kept out of search

    Bill and trip pages are noindex and blocked in robots.txt.

A name drags onto an item, and a tap does the same job.

  1. Drag pins

    Names drag from the tray with a mouse or a finger. Drag a pinned name to another item to move it, or back to the tray to take it off.

  2. A short press on phones

    A name already pinned to an item needs a 260 ms press before it lifts, so a swipe down the list still scrolls.

  3. Scrolling mid-drag

    Hold a name near the top or bottom edge and the page scrolls under it.

  4. A tap path

    Tap a name, then tap items. It does what the drag does.

  5. A color for each person

    Names take one of 12 colors, in the tray and on every item they’re pinned to.

  6. Scoped styles

    Every rule sits under .tabsplit, so none of it reaches the rest of the site.

Live, with tests on what comes in and none on the math.

Tests passing
18
Tests passing
Tests on the split math
0
Tests on the split math
Currencies a bill can use
27
Currencies a bill can use
California tax rates built in
25
California tax rates built in
What the tests cover
ItemTests
Receipt text parser4
The model’s scan reply8
Claim requests6
Shares and rounding0
Trip settle-up0
What the tests cover. The tested code is the code that takes outside input. S P L I T was added to this site on November 3, 2026 and now runs on its own subdomain.

Tests on the money math come first, then an exact settle-up.

Next

  1. Math tests

    Cover the share math and the settle-up, starting with the examples on this page.

  2. Shortest settle-up

    Replace the greedy method with one that finds the shortest list of payments. The example trip above is the first test it has to pass.

  3. A real scan

    Run a real receipt through Claude and a trip on live ECB rates. The first test had neither.

  4. Quarterly rates

    Check the built-in California rates against the CDTFA table when each new quarter starts.

Known limits

  1. Untested math

    The share math and the trip settle-up have no tests. The examples on this page each come from a single run of the code.

  2. Greedy settle-up

    The list of payments is not always the shortest one. The method is greedy, and the example trip above takes 4 payments when 3 would do.

  3. Tax rates by hand

    CDTFA changes rates each quarter. The built-in list is dated October 1, 2026 and gets updated by hand.

  4. One browser holds the key

    The edit key lives in one browser’s storage, and there is no sign-in to get it back.

  5. Face value

    A receipt in a currency with no ECB rate counts at its printed number on a trip.

  1. Built

    A receipt scanner and bill link where friends tap what they had and tax and tip split to the cent.

  2. Found

    The sample bill’s five shares add up to its $133.66, and the example trip takes 4 payments where 3 would do.

  3. By the numbers

    Sample bill, split to the cent
    $133.66
    Tests passing
    18
    Tests on the split math
    0
  4. The catch

    The split math has no tests. Each example on this page comes from a single run of the code.

  5. Next

    Write tests for the share math and the settle-up, starting with the examples on this page.