João RamiresInstruction manual

Cartridges · At work

The accounting core

The double-entry engine, ERP sync and data pipeline that turn an e-commerce brand's orders, payments and refunds into books that tie out.

Where
Blue Onion
Status
Shipped
Year
2022–2026
My part
Senior software engineer: ledger, ERP sync, PostgreSQL performance, data pipeline, customer features

The problem

An e-commerce brand sells through many channels and gets paid through many processors. Each one has its own idea of an order, a refund, a fee and a payout. To close the books, every one of them has to become balanced journal entries in one chart of accounts, and every payout has to tie back to the orders it paid. A wrong sign or an unbalanced entry misstates a customer’s ledger.

What I built

For four years I worked across the web app, the data pipeline and the infrastructure, and the team trusted me with its most sensitive accounting and data systems.

  • The general ledger. I built and maintained the double-entry engine that turns sales, refunds, revenue recognition, cancellations, gift cards and fee deferrals into journal entries, with gains and losses across currencies, and checks that every entry balances.1Most bugs in financial software are sign errors and timing errors, not arithmetic.
  • The ERP sync. I owned the sync of those entries into NetSuite and QuickBooks. When it fails, a customer can’t close the books. So much of the job was finding why a sync failed, adding guardrails, and building the metrics and alerts that catch a failed export.
  • PostgreSQL at scale. I worked every day in hash-partitioned tables with hundreds of millions of rows. I designed the indexing strategy, merged redundant indexes, added targeted ones on the hottest queries and removed N+1 queries from the API. Pre-aggregated summary tables turned slow, heavily filtered reports into fast indexed reads.
  • Features from schema to screen. From the database and the GraphQL API to the React screen: an account-balance rollforward, a cost-of-goods-sold and unit-economics product line with cost uploads and margin analytics, and support dashboards that catch reconciliation problems before customers notice them. I also led the navigation and UI redesign.
  • The data pipeline. dbt, Airflow and BigQuery models that bring 16+ payment and commerce integrations, from Shopify and Amazon to Stripe, PayPal, Adyen, Klarna and TikTok Shop, into one double-entry schema. Snapshots of slowly changing data and deterministic IDs let the pipeline run incrementally and give the same result on every rerun.

Design before code

I wrote the architecture proposals and RFCs the team built against. One laid out a three-phase data architecture, compared a design owned by the pipeline with one owned by the app, and planned the migration. Another specified the data flow from end to end.

What it taught me

Four years of making numbers tie out is why Console, the agent I built next, answers only from these reconciled books, through the same rules as the app’s pages.

Integrations in one schema

Payment and commerce sources, one double-entry model.

Rows in the busiest tables

Hash-partitioned PostgreSQL, tuned by hand.

Years on the core

Before I moved to applied AI.