GST Compliance in Code — Building Accounting Software for Indian Distributors

GST Compliance in Code

India has millions of small distributors. Tea, FMCG, textiles — they move goods across states daily. Most of them do accounting in physical ledgers. When GST became mandatory, they were stuck between expensive Tally licenses and doing it wrong.

I built ChaiBooks — open source accounting software specifically for Indian distributors.

The GST Problem

GST in India isn't one tax. It's a matrix:

  • CGST + SGST when buyer and seller are in the same state
  • IGST when they're in different states
  • Reverse charge for certain goods and services
  • Composition scheme for small businesses under ₹1.5 crore turnover

Each product has an HSN code that determines the tax rate. A 4-digit HSN might be 5%, a 6-digit one might be 12%. Get the code wrong and you're filing incorrect returns.

function calculateGST(item: InvoiceItem, sellerState: string, buyerState: string) {
  const rate = getHSNRate(item.hsnCode);

  if (sellerState === buyerState) {
    return {
      cgst: item.amount * (rate / 2) / 100,
      sgst: item.amount * (rate / 2) / 100,
      igst: 0,
    };
  } else {
    return {
      cgst: 0,
      sgst: 0,
      igst: item.amount * rate / 100,
    };
  }
}

Simple logic, but getting it right for every edge case took weeks.

E-Way Bills

Any goods movement above ₹50,000 requires an e-way bill. The bill has a specific format, a validity period based on distance, and needs to be generated before the truck leaves.

function needsEwayBill(invoice: Invoice): boolean {
  const totalValue = invoice.items.reduce((sum, item) =>
    sum + item.amount + item.cgst + item.sgst + item.igst, 0
  );
  return totalValue > 50000;
}

The Dashboard

Built with React, Node.js, MongoDB, and Tailwind. The dashboard shows revenue, profit margins, stock levels, and pending invoices at a glance. 156 invoices processed, ₹12 lakh tracked, 99.9% GST accuracy.

PDF export was critical — distributors need to print invoices that match government formatting requirements. I used jspdf with a custom template that places GSTIN numbers, HSN codes, and tax breakdowns exactly where the format demands.

What I Learned

Indian tax software is a massive market with terrible competition. Most solutions are either expensive (Tally, Zoho) or poorly built (random apps on Play Store). There's space for modern, open-source alternatives.


Check out ChaiBooks on GitHub. Need custom business software? 4UGUSTA Systems builds it.

A

Augusta Bhardwaj

Full-stack & AI engineer. Building production AI systems at YC-backed startups. Founder of 4UGUSTA Systems — a web development and AI agency.

← Back to all posts