Inspiration

Every time we go out to eat with friends, the same three problems come up. Nobody can agree on where to go, somebody always goes over budget, and at the end the bill gets split evenly even though one person had a salad and someone else had a steak and two drinks. We wanted one app that handles the whole night, from picking the place to paying each other back.

What it does

Split is a phone app for eating out with friends:

  1. Group: everyone puts in their budget, cuisine, distance and diet. Split uses AI to search for real restaurants, ranks them by how many people they actually work for, and recommends places like ones your group has loved before. Then you vote.
  2. Planner: snap a photo of the menu, enter how many people and your budget, and get an order that fits after tax and tip.
  3. Fair Split: snap the receipt, everyone taps what they ate, and tax, tip and discounts get split by what you ordered, not evenly. Payment requests go out by e-Transfer, PayPal or Venmo.
  4. Ledger: past meals, who owes who, and how much you've spent.

It's a web app you add to your home screen, so there's no app store, and it works on iPhone and Android.

How we built it

  • Plain HTML, CSS and JavaScript. No framework and no build step, so everyone on the team could jump in and edit right away.
  • Google Gemini reads menus and receipts from photos and searches the web for restaurants.
  • Cloudflare Worker holds our Gemini API key. Our repo is public, so the key can't go on GitHub. The app sends its AI requests to the Worker, the Worker adds the key and asks Gemini, and users never see the key.
  • Firebase Realtime Database syncs the group live between phones, so when someone taps an item on their phone it shows up on everyone else's right away.
  • GitHub Pages hosts the app, so anyone can open it from a link.

The math behind the fair split

Instead of splitting evenly, each person pays for their own food plus their share of the extras (tax, tip, service charges, minus discounts), based on how much they ordered:

$$ \text{you pay} = s_i + \frac{s_i}{\sum_j s_j}\,(T + P - D) $$

where $$s_i$$ is what you ordered, $$T$$ is tax, $$P$$ is tip and $$D$$ is discounts. So the salad person pays less tax and tip than the steak person.

Money is done in whole cents, and leftover pennies go to the biggest remainders, so everyone's shares always add up to the bill exactly. No missing or extra penny.

For the planner, the order has to fit the budget $$B$$ after tax rate $$\tau$$ and tip rate $$\rho$$, so the food can cost at most:

$$ \text{food} \le \frac{B}{1 + \tau + \rho} $$

Challenges we ran into

  • Keeping the API key secret. At first the key only worked on our laptops through a .env file. GitHub Pages can only serve files, so it can't hide a key, and the live site was stuck in demo mode. We fixed it by putting the key on a Cloudflare Worker.
  • Four people pushing to the same repo. We kept running into each other's changes, merge conflicts in the same file, and someone accidentally undoing someone else's work. We got a lot better at git stash, git pull and fixing conflicts.
  • Phones showing old versions. After pushing, our phones kept showing the old app because GitHub Pages lets browsers reuse files for about 10 minutes, plus the app keeps an offline copy. We learned to wait it out or clear the site data.
  • AI being busy. Gemini sometimes returned "high demand" errors, so we kept a demo mode with sample data as a backup for the presentation.

What we learned

  • Never put API keys in public code. Keep them on a server you control.
  • Static sites like GitHub Pages can't keep secrets, so pair them with a small backend like a Cloudflare Worker.
  • How to sync data live between phones with Firebase.
  • Splitting money fairly is harder than it looks, and you have to do it in cents or you lose pennies.
  • How to work as a team on git without wrecking each other's code.

What's next

Sign-ins and usage limits so the AI can't get overused, syncing "mark settled" between phones, and testing with way more real receipts.

Share this project:

Updates

Submission history