Skip to main content

Accounting basics in ERPClaw

How the chart of accounts, journal entries, and GL posting work in ERPClaw. Double-entry, immutable submitted entries, the 12-step validation pipeline.

ERPClaw is a double-entry accounting system at its core. Every business document (invoice, payment, payroll run, stock transfer, payout) eventually produces general-ledger entries. This page covers the data model and the rules.

Chart of accounts

The default install seeds a US-style chart of accounts with 94 accounts grouped by type:

  • Assets: 1000-1999 (cash, AR, inventory, fixed assets)
  • Liabilities: 2000-2999 (AP, accrued expenses, payroll liabilities, deferred revenue)
  • Equity: 3000-3999 (retained earnings, common stock, owner draws)
  • Revenue: 4000-4999 (sales, service, other income)
  • Expenses: 5000-9999 (COGS, payroll, rent, utilities, depreciation, etc.)

You can customize the chart at any time:

add-account name="Marketing" parent="Expenses" account_number=5500
update-account id=<id> name="Paid Marketing"
list-accounts

The chart supports parent-child hierarchy (so subtotals roll up cleanly) and multi-company (each company has its own set of accounts). Account numbers are unique per company.

Journal entries

A journal entry is a set of debits and credits that must balance. Total debits must equal total credits. Submit a journal:

add-journal-entry posting_date=2026-04-15 entries='[
  {"account": "Cash", "debit": 1000.00},
  {"account": "Sales", "credit": 1000.00}
]'
submit-journal-entry id=<id>

The submit step runs the 12-step validation pipeline (see below). On success the entry is locked. There is no update-journal-entry after submit. To correct a mistake, post a reversing entry. Immutability after submit is the rule.

The 12-step validation pipeline

Every GL posting passes through this pipeline before it commits. Any failure rolls back the entire transaction; partial writes are impossible.

  1. Posting date is in an open accounting period
  2. Company is active and not in lockdown
  3. All referenced accounts exist
  4. All accounts allow the posting type (e.g. expense accounts cannot receive a credit-only posting in some configurations)
  5. Debit total equals credit total exactly (Decimal arithmetic, no float comparison)
  6. Currency is the company’s functional currency or has a valid exchange rate row
  7. Cost center references resolve
  8. Project references resolve
  9. Tax codes resolve
  10. Reference document exists if specified
  11. No conflicting concurrent transaction (FK and uniqueness checks)
  12. Final balance check after the write (running totals stay consistent)

The pipeline runs inside a single SQLite transaction with BEGIN ... COMMIT. If any step fails, the transaction rolls back and you get a clean JSON error.

How invoices post to GL

When you submit a sales invoice in ERPClaw, the GL posting is automatic. Example, a $1,000 invoice for one item in inventory:

AccountDebitCredit
Accounts Receivable$1,000.00
Sales Revenue$1,000.00
Cost of Goods Sold$400.00
Inventory$400.00

ERPClaw handles the COGS posting automatically based on the item’s costing method (FIFO or weighted average). The invoice voucher links to the four GL entries, so audit trail is one click.

When the customer pays:

AccountDebitCredit
Cash$1,000.00
Accounts Receivable$1,000.00

The AR balance reduces. The trial balance stays balanced.

Closing a period

Periods (typically months or quarters) are closed via:

close-accounting-period period="2026-Q1" reason="Q1 close"

Once closed, no further postings to that period are allowed. The pipeline’s step 1 catches them. To re-open a period (rare; auditor finding, etc.):

reopen-accounting-period period="2026-Q1" reason="auditor adjustment"

The reopen requires explicit reason and is logged.

Multi-currency

ERPClaw supports multi-currency. Each company has a functional currency (the currency the books are kept in). Foreign-currency invoices and payments stay in the transaction currency end to end; the books reflect the actual currency the transaction occurred in. See the multi-currency plan for the current rollout state.

Reports

The shipped accounting reports include:

  • Trial balance (trial-balance)
  • Balance sheet (balance-sheet)
  • Profit and loss (profit-and-loss)
  • Cash flow statement (cash-flow-statement)
  • AR aging (ar-aging)
  • AP aging (ap-aging)
  • General ledger by account (gl-by-account)
  • Journal register (journal-register)

All reports are exact down to the cent (Decimal arithmetic, no float rounding errors).

What is next

  • Purchasing — purchase orders, goods receipt, vendor invoices, payments.
  • Install guide — get to a working ERPClaw in 5 minutes.
  • Stripe docs — payment integration that posts directly to your GL.