Multi-Currency P&L Platform Built Solo in 18 Days

Client work · Sole engineer · delivered

A multi-store e-commerce business was reconciling its finances by hand across several payment processors, an ad platform and a fulfilment provider. Nobody could answer what an individual product actually earned. I built the internal platform that unified it, as the only engineer on the project.

  • ~4,500× faster attribution
  • 641 orphaned orders recovered

How it works

Signed continuation tokens let multi-year imports outlive the 300-second serverless limit.

  • 2 processors → Sync engine
  • Store API → Sync engine
  • Ad platform → Sync engine
  • Fulfilment → Sync engine
  • Sync engine → Postgres
  • Postgres → Daily rollup
  • Daily rollup → P&L dashboard
  • Postgres → P&L dashboard

The detail

Five live integrations sit behind one connector interface with encrypted credentials. The profit-and-loss engine handles refunds, chargebacks, processor fees, deduplication across processors, and multi-currency maths using arbitrary-precision decimals rather than floats. A three-phase sync pipeline uses signed continuation tokens so multi-year historical imports survive serverless timeouts.

Performance work, measured before and after: 10x faster ingestion, 100x faster currency backfill, 4,500x faster product attribution, and a 95% reduction in dashboard load time using composite indexes, database-side functions and a pre-aggregated rollup table.

About 71,000 lines, a 14-model schema, 24 migrations, 85 tests. Delivered on day 18 at full scope with no post-handover bug reports.

Next.js 15, TypeScript, PostgreSQL, Prisma, decimal.js, Vercel.

What I did

  • Sole engineer end to end - schema, integrations, business logic, dashboard, security and deployment
  • Designed a 14-model schema with 24 migrations and 40+ indexes
  • Built five platform integrations behind one connector interface with encrypted credential storage
  • Implemented the profit-and-loss engine including refunds, chargebacks, fees and cross-processor deduplication
  • Normalised two different order flows including time-window matching of upsell charges to parent orders
  • Delivered 10x, 100x and 4,500x speedups on ingestion, currency backfill and attribution respectively
  • Cut dashboard load by 95% using composite indexes, database functions and a pre-aggregated rollup
  • Detected a six-figure double-count, and reverted my own in-flight fix after proving it would erase legitimate revenue
  • Recovered 641 orphaned orders and 2,350 mis-attributed transactions
  • Wrote 85 tests including equivalence tests proving the fast and slow paths agree

Stack

Next.js, TypeScript, PostgreSQL, API Integration, Full-Stack Development, Prisma, Stripe, PayPal, Shopify, Vercel, Payment Integration, Data Migration, RBAC

Case study: https://www.siddhvasudev.com/projects/fintech-pnl