03 / Fintech · savings ledger
KoinSave
Naira-to-USD savings — wallets, a double-entry ledger, banking, bills and KYC — rebuilt as a NestJS v2 where every kobo is traceable.
- Role
- Backend engineer · v2 author
- Status
- Fintech platform
- Period
- 2025 — 2026
- Type
- Fintech · savings ledger
- p99 conversion & settlement, zero data loss
- <200ms
- transaction-history queries, from 420ms
- 95ms
- savings execution, from 4 minutes
- <40s
- v2 backend commits
- 117/117
A / Architecture
Modular monolith built around a ledger
One NestJS service with hard boundaries between the parts that touch money — ledger, wallet, transactions, fees — and the parts that talk to the outside world: banking partner, bills, airtime, KYC and webhooks. Slow work runs on BullMQ workers.
00 Clients
- Mobile app
- Admin dashboard
- Website
01 Edge
- Fastify
- Rate limiting
- Signed webhooks
- OpenAPI docs
02 Money core
- Ledger
- Wallet
- Transactions
- Fees
03 Integrations
- Banking partner
- Bills · airtime
- KYC
- Email delivery events
04 Data
- PostgreSQL · Prisma
- Redis
- BullMQ workers
- Object storage
Before
v1: an Express service with Prisma and Bull.
After
v2: NestJS on Fastify with ledger, wallet, fee, KYC and bank modules, BullMQ workers and a documented API — every commit mine.
WHY · Explicit module boundaries, idempotency and a full audit trail make money paths easier to reason about and to scale. Savings execution dropped from 4 minutes to under 40 seconds.
Engineering notes
- 01
Ledger first
Ledger, wallet, transactions and fees are their own modules. Every movement is a balanced double entry — atomic, traceable and reconcilable.
- 02
No double-spends
Concurrency control on simultaneous wallet operations guarantees a balance can only ever be spent once.
- 03
Slow work off the request path
Savings execution moved onto BullMQ workers backed by Redis, cutting the end-to-end run from four minutes to under forty seconds.
- 04
Integrations that can be trusted
A banking-as-a-service partner, bills, airtime and KYC behind signed, idempotent webhooks; email through AWS SES with delivery events fed back in.
- 05
Built for the regulator
An audit trail records every transaction state change, so any balance can be explained line by line.
B / Infrastructure & delivery
How it ships, scales and stays up.
- Cloud
- AWS S3 for documents and SES for email with delivery-event webhooks.
- CI/CD
- GitHub Actions: lint, tests, Prisma migrations, container build and automated deploy.
- Observability
- Sentry, structured pino logs, Bull Board for queue health.
- Correctness
- Double-entry ledger; concurrency control on simultaneous wallet operations; settlement at p99 under 200ms with zero data loss.
- Audit
- Every transaction state change recorded for regulatory traceability.
- Performance
- Transaction-history queries from 420ms to 95ms under peak load.