<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hashir Khattak</title>
    <description>The latest articles on DEV Community by Hashir Khattak (@hashir_sebt).</description>
    <link>https://dev.to/hashir_sebt</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3593855%2F2b820a0e-37cf-4798-bed7-384935d8b803.png</url>
      <title>DEV Community: Hashir Khattak</title>
      <link>https://dev.to/hashir_sebt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hashir_sebt"/>
    <language>en</language>
    <item>
      <title>Building a Simple and Fair Bill Splitting Web App (Without Logins, Databases, or Framework Overkill)</title>
      <dc:creator>Hashir Khattak</dc:creator>
      <pubDate>Mon, 03 Nov 2025 09:19:22 +0000</pubDate>
      <link>https://dev.to/hashir_sebt/building-a-simple-and-fair-bill-splitting-web-app-without-logins-databases-or-framework-overkill-1n27</link>
      <guid>https://dev.to/hashir_sebt/building-a-simple-and-fair-bill-splitting-web-app-without-logins-databases-or-framework-overkill-1n27</guid>
      <description>&lt;p&gt;Splitting bills during group activities seems simple — until it isn’t.&lt;br&gt;
A trip, dinner with friends, shared groceries, or roommate utilities can quickly turn into:&lt;/p&gt;

&lt;p&gt;“Wait… who paid for what?”&lt;/p&gt;

&lt;p&gt;“Didn’t I cover the last two things?”&lt;/p&gt;

&lt;p&gt;“Why am I paying more?”&lt;/p&gt;

&lt;p&gt;What we need isn’t a “wallet” app or budgeting suite — just a simple, transparent way to record shared expenses and settle up fairly.&lt;/p&gt;

&lt;p&gt;In this post, we’ll walk through how to build a minimal and practical bill-splitting app, similar to the one at:&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://BillSplitOnline.com" rel="noopener noreferrer"&gt;billsplitonline.com&lt;/a&gt;&lt;br&gt;
 (live working demo, no login required)&lt;/p&gt;

&lt;p&gt;The focus is:&lt;br&gt;
Simplicity, usability, and clarity.&lt;/p&gt;

&lt;p&gt;No accounts.&lt;br&gt;
No friction.&lt;br&gt;
No “invite your friends” onboarding.&lt;br&gt;
Just open → add expenses → get settlement results.&lt;/p&gt;
&lt;h2&gt;
  
  
  Core Problem to Solve
&lt;/h2&gt;

&lt;p&gt;The fair way to split group expenses is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Track who paid → Track who participated → Calculate who owes who at the end.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We maintain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;people = { Alice, Bob, Charlie }

expenses = [
  { whoPaid: "Alice", amount: 40, sharedBy: ["Alice", "Bob"] },
  { whoPaid: "Bob", amount: 60, sharedBy: ["Bob", "Charlie"] },
  { whoPaid: "Charlie", amount: 30, sharedBy: ["Alice", "Charlie"] }
]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From there we compute:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each person’s total paid&lt;/li&gt;
&lt;li&gt;Each person’s fair share&lt;/li&gt;
&lt;li&gt;The net balance (positive = owed money, negative = owes others)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Settlement Algorithm (Minimal Version)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function settleUp(people, expenses) {
  const balance = {};

  // initialize balance
  people.forEach(p =&amp;gt; balance[p] = 0);

  // compute costs
  expenses.forEach(e =&amp;gt; {
    const splitAmount = e.amount / e.sharedBy.length;
    e.sharedBy.forEach(p =&amp;gt; balance[p] -= splitAmount);  // each owes their share
    balance[e.whoPaid] += e.amount;                      // payer gets credit
  });

  // convert to payers and receivers
  const owes = [];
  const owed = [];

  for (const p in balance) {
    if (balance[p] &amp;lt; 0) owes.push({ person: p, amount: -balance[p] });
    if (balance[p] &amp;gt; 0) owed.push({ person: p, amount: balance[p] });
  }

  const settlements = [];

  // match payers to receivers
  while (owes.length &amp;amp;&amp;amp; owed.length) {
    const o = owes[0];
    const r = owed[0];
    const amount = Math.min(o.amount, r.amount);

    settlements.push(`${o.person} pays ${r.person} $${amount.toFixed(2)}`);

    o.amount -= amount;
    r.amount -= amount;

    if (o.amount === 0) owes.shift();
    if (r.amount === 0) owed.shift();
  }

  return settlements;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This produces clean human-friendly results like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Bob pays Alice $20.00
Charlie pays Bob $15.00

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Live Example of &lt;a href="https://BillSplitOnline.com" rel="noopener noreferrer"&gt;Bill Splitting App&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;It’s built following the exact principles discussed in this post:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No login&lt;/li&gt;
&lt;li&gt;Works offline&lt;/li&gt;
&lt;li&gt;Clear settlement output&lt;/li&gt;
&lt;li&gt;Mobile-first UI&lt;/li&gt;
&lt;li&gt;Uses the algorithm above&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feel free to inspect the network requests — there aren’t any.&lt;br&gt;
Everything runs client-side.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Sometimes we overcomplicate software.&lt;br&gt;
Not every app needs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OAuth&lt;/li&gt;
&lt;li&gt;Microservices&lt;/li&gt;
&lt;li&gt;IndexedDB&lt;/li&gt;
&lt;li&gt;Multi-tenant SaaS architecture&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sometimes the most useful tools are the ones that just work quickly with zero cognitive load.&lt;/p&gt;

&lt;p&gt;A small, thoughtful UI + a transparent algorithm solves a real social problem here:&lt;br&gt;
money awkwardness among friends.&lt;/p&gt;

</description>
      <category>billsplittingapp</category>
    </item>
  </channel>
</rss>
