Skip to content
AccountancyPath

Accounting for DevelopersModule 4: Production financial systemsBeginner4 min read

Accounting for AI and No-Code App Builders

Build double-entry safety into Airtable, Google Sheets, Notion or Supabase apps: a 3-table minimum schema, balance validation formulas and AI prompt guardrails.

Lesson 16 of 16
Course outline (16 lessons)

Before this lesson:Why Software Developers Need Accounting KnowledgeDouble-Entry Accounting

You do not need a giant ERP to get accounting right—and using Airtable, Google Sheets, Notion or an AI app builder does not exempt you from accounting laws. If your app tracks invoices, retainers, payouts or credits, a 3-table double-entry model takes ten minutes to set up and eliminates the most painful bugs before they happen.

The 3-table minimum schema

Whether you build in Airtable, Google Sheets, Notion or Supabase, keep your books in exactly three linked tables—never one flat spreadsheet with a manually edited “Current Balance” cell:

Table Purpose Essential columns
1. Accounts Your chart of accounts account_code (1000), name (Cash), type (Asset/Liability/Equity/Revenue/Expense), is_active
2. Entries One row per business event entry_id, effective_date, description, source_ref, status, balance_check (formula!)
3. Lines Two or more lines per entry line_id, entry_id (link to Entries), account_code (link to Accounts), debit, credit

In this model, account balances are always calculated, never typed in. In Airtable or Notion, add a Rollup on Accounts summing debit and credit from linked Lines. In Supabase/PostgreSQL, this maps straight onto accounts, journal_entries and postings from journal and general ledger database design.

Validation formulas to reject unbalanced rows

Double entry only protects you if unbalanced entries are caught immediately. Add a balance_check column on Entries and filter all dashboards to balance_check = "BALANCED":

  • Google Sheets (on Entries row 2, where A2 is entry_id, and Lines has entry_id in col B, debit in col D, credit in col E):
=IF(
  COUNTIF(Lines!B:B, A2) < 2,
  "NEEDS_2_LINES",
  IF(ROUND(SUMIF(Lines!B:B, A2, Lines!D:D) - SUMIF(Lines!B:B, A2, Lines!E:E), 2) = 0,
     "BALANCED",
     "UNBALANCED")
)
  • Airtable (create two Rollup fields on Entries: Total Debits = SUM(values) of Lines.debit, Total Credits = SUM(values) of Lines.credit, plus Line Count = COUNTALL(values), then a Formula field):
IF({Line Count} < 2, "NEEDS 2+ LINES",
  IF(ABS({Total Debits} - {Total Credits}) < 0.005, "BALANCED", "UNBALANCED"))
  • Notion: use two Rollups (Sum Debits, Sum Credits) from the Lines relation and a Formula property: if(round((prop("Sum Debits") - prop("Sum Credits")) * 100) == 0, "Balanced", "ERROR").

Worked example

Worked example

Sprout Studio (fictional) — 3-table no-code ledger in action

Sprout Studio, a two-person design shop, tracks three April events in its 3-table Airtable/Sheets base:

  1. 2 April (E-01): Client pays a $1,500 upfront project retainer (cash received before work is done → liability).
  2. 5 April (E-02): Studio pays $240 for a design software subscription.
  3. 20 April (E-03): Studio delivers Milestone 1, earning $1,000 of the retainer.
E-01 (2 April): Retainer received upfront
AccountDebit (Dr)Credit (Cr)
1000 Cash$1,500
2100 Unearned Revenue$1,500
Total✓ Balanced$1,500$1,500
E-02 (5 April): Software subscription paid
AccountDebit (Dr)Credit (Cr)
5100 Software Expense$240
1000 Cash$240
Total✓ Balanced$240$240
E-03 (20 April): Milestone 1 revenue earned
AccountDebit (Dr)Credit (Cr)
2100 Unearned Revenue$1,000
4000 Design Revenue$1,000
Total✓ Balanced$1,000$1,000

Rollups on the Accounts table now compute the live trial balance automatically:

Code Account Total Debits Total Credits Net Balance
1000 Cash (Asset) $1,500 $240 $1,260 Dr
5100 Software Expense (Expense) $240 $0 $240 Dr
2100 Unearned Revenue (Liability) $1,000 $1,500 $500 Cr
4000 Design Revenue (Revenue) $0 $1,000 $1,000 Cr
Total $2,740 $2,740 Dr $1,500 = Cr $1,500

Try building these exact entries interactively in the Accounting Playground.

Common LLM-generated billing bugs—and how to prompt safely

When you ask an AI coding tool to “add billing, credits and refunds to my Supabase app,” it often generates fragile shortcuts that look fine in a demo and fail with real money:

  1. Storing money as floats (numeric/float8 or JS Number dollars): causes 0.1 + 0.2 = 0.30000000000000004 drift.
  2. Mutable users.balance updates: UPDATE users SET balance = balance - 20 loses history and breaks under concurrent clicks.
  3. Deleting rows on cancel/refund: destroys your audit trail and breaks tax reporting.
  4. Skipping idempotency on Stripe webhooks: Stripe retries webhooks; without a unique key, customers get credited twice.
  5. Booking tax or upfront retainers straight to Revenue: inflates profit and hides liabilities.

Copy-paste AI prompt guardrail

Paste this block into your specification whenever prompting an LLM to generate financial code or Supabase tables:

Implement financial records using a 3-table immutable double-entry ledger (accounts, journal_entries, postings). Store all amounts as signed integer minor units (bigint, never floats) with an explicit ISO 4217 currency. Enforce SUM(amount_minor) = 0 per entry and currency inside a single database transaction. Require a unique idempotency_key on journal_entries for every webhook or payment action. Never UPDATE or DELETE posted entries—implement refunds and corrections as new reversing or offsetting entries. Book sales tax and upfront prepayments to liability accounts, not revenue.

Real-world application

Agencies, lean startups and indie SaaS founders routinely start with a 3-table Airtable, Notion or Supabase ledger before migrating to dedicated accounting software. Because the data already follows Accounts → Entries → Lines with balanced entries and clean account codes, exporting to an accountant or upgrading to a full double-entry engine later is a straightforward 1-to-1 mapping instead of a painful forensic cleanup.

Recap

  • Build every no-code or AI-assisted financial tracker around three linked tables: Accounts, Entries and Lines.
  • Add a formula or database check on Entries verifying at least two lines and Total Debits = Total Credits, and exclude unbalanced rows from reports.
  • Never edit or delete posted rows; reverse mistakes and calculate account balances via rollups or SUM queries.
  • Explicitly prompt AI coding tools for integer minor units, immutable entries, idempotency keys and proper liability accounts for tax and retainers.

Try it yourself

Active recall

Quick check · Test yourself

Work out each answer in your head first, then reveal the explanation and mark whether you got it right.

  1. 1An AI coding assistant generates a wallets table with a single mutable balance column updated via balance = balance - amount. What are two bugs this causes?

    Show worked answer

    First, concurrent requests can overwrite each other (lost updates) or drop money if one side succeeds and the other fails. Second, there is no audit trail explaining how the balance reached its current number, making disputes and reconciliations impossible.

  2. 2In a 3-table no-code ledger (Accounts, Entries, Lines), how does a rollup or SUMIF formula catch an unbalanced entry?

    Show worked answer

    On the Entries table, sum all linked Lines' Debit amounts and Credit amounts. If Total Debits minus Total Credits does not equal 0 (or within 0.005 for decimal spreadsheets), flag the entry as UNBALANCED and exclude it from reports.

  3. 3A design studio collects a $1,500 retainer upfront, pays $240 for software, and completes $1,000 of the retainer work. What are its Cash, Unearned Revenue and Design Revenue balances?

    Show worked answer

    Cash is $1,260 Dr ($1,500 − $240), Software Expense is $240 Dr, Unearned Revenue is $500 Cr ($1,500 − $1,000), and Design Revenue is $1,000 Cr. Total Debits ($1,500) equal Total Credits ($1,500).

Key terms in this lesson

Lesson 16 of 16 · Accounting for Developers

Finished this lesson?

Mark it complete to track your progress through the course. Progress is saved in this browser only.

Previous lesson: Payment Processor Reconciliation and Clearing Accounts

Subject GuideAccounting Systems & Personal Finance

Mei-Ling Chen(陈美玲)

Turns accounting invariants into clean code—and everyday personal money clarity.

  • Double-Entry Ledger Engineering
  • SQL Schemas & Financial APIs
  • Multi-Currency & Billing Code

More lessons with Mei-Ling

Published:

Educational content only—not accounting, tax, legal or investment advice. See our editorial policy or report an error via our corrections policy.

Search