Paid before allocated
Gold is confirmed only after the backend reads the payment order back from the gateway and sees it paid; the app's word is never enough.
Gold in small amounts. Money moves checked at every step.
The NestJS backend behind the FinClimb investing app: phone sign-in, profiles and bank accounts, buying and selling digital gold, daily to monthly gold SIPs, payments, payouts and notifications.

Overview
FinClimb is an investing app for young salaried Indians who want to start small. Its Android app lets people buy digital gold for as little as a few rupees, sell it back to their bank account, or set up a gold SIP that buys automatically every day, week or month. I built the backend API that the app runs on. The mobile app, the website and the mutual-fund side of FinClimb were built by others; this project is the server.
The backend is a NestJS 11 API with 50 REST endpoints in 11 modules. It handles phone-number sign-in with one-time passwords, an MPIN for quick unlock, profiles and bank accounts, and the full gold lifecycle through the gold partner's API: user registration, live buy and sell prices, price history from hourly to yearly, buying, selling, balances, invested versus current value, and invoices.
Money flows are where the design matters most. A gold purchase is a three-way conversation between the app, the gold partner and the payment gateway, and the backend never takes the app's word for a payment. It locks the price with the partner's rate ID, verifies the order, creates a payment order for the exact amount, and confirms the gold only after it reads the order back from the gateway and sees it paid. A gold SIP is a payment-gateway subscription and mandate: each successful debit arrives as a webhook, is recorded as a SIP transaction, and triggers an automatic gold purchase for that amount, with an email to the user. Users can pause, resume or cancel, and every lookup is scoped to the signed-in user. When someone sells, the confirmed sale immediately gets a payout record marked pending; the gateway's payout webhook later marks it processed or failed, using the gold partner's transaction ID as the reference, so no sale goes untracked between the vault and the bank.
Sessions use short-lived JWT access tokens and 30-day refresh tokens that are stored only as SHA-256 hashes and rotated on every use, with the replacement chain recorded. OTP text messages and transactional emails go through BullMQ queues on Redis with three retries and exponential backoff, so a slow SMS or email provider never slows down a sign-in or a payment. Requests pass through Helmet, a CORS allowlist, strict whitelist validation, a timeout interceptor and one response envelope; users are exposed only by UUID public IDs, and payloads to the gold partner are encrypted with AES-256-CBC.
The code is tested at three levels: Jest unit tests with a 90% coverage gate, integration tests and end-to-end tests that run against real PostgreSQL 18 and Redis containers started by Testcontainers. Schema changes are hand-written TypeORM migrations, never auto-synced.
Topics
Highlights
Gold is confirmed only after the backend reads the payment order back from the gateway and sees it paid; the app's word is never enough.
Daily, weekly or monthly mandates: each debit arrives by webhook and buys gold automatically, with pause, resume and cancel.
A confirmed sale gets a pending payout record at once; the payout webhook marks it processed or failed.
Short-lived access tokens and single-use refresh tokens stored only as SHA-256 hashes, with the replacement chain recorded.
OTP texts and emails run on BullMQ with three retries and exponential backoff, off the request path.
Unit tests with a 90% coverage gate, plus integration and end-to-end tests on real Postgres and Redis containers.
Features
Screens
Tech stack
Architecture
Challenges
The app, the gold partner and the payment gateway each hold part of a purchase. The backend ties them together and allocates gold only after it checks the payment itself.
SIP debits arrive by webhook at any hour. Each one is recorded and turned into a gold purchase without the user opening the app.
A sale is confirmed by the gold partner before the money moves. Payout records close that gap so every sale can be traced to the bank.
OTP texts and emails depend on outside providers. Queues with retries keep sign-in and payments fast even when a provider is slow.
Results
What's next

Bishal SahaLet's build together
Tell me about the problem. You'll get a clear, honest view of the best way forward.