What
Sanchayam is a self-hosted multi-asset portfolio tracker. It tracks equity (Indian and US markets), mutual funds, crypto, bank balances, and real estate under one unified schema. It computes FIFO cost basis, realized P&L, and XIRR per holding and across the entire portfolio. It handles multiple currencies with automatic FX conversion. Multiple users can share a family portfolio view.
- Live: sanchayam.com - hosted version, request access and use it directly
- Backend: github.com/sagarnayak/sanchayamBackend-public
- Frontend: github.com/sagarnayak/sanchayamFrontend-public
Why
Most portfolio trackers are either too narrow (they handle equities but not real estate), too opinionated (they force a specific cost basis method), or they require handing your financial data to a third party. Sanchayam is self-hosted, schema-driven, and designed for the full breadth of assets a typical Indian investor actually holds: listed equities, unlisted holdings, mutual fund NAVs, crypto, bank balances across currencies, and illiquid real estate.
The core question it answers: what is my net worth today, what has each holding returned, and how has the total portfolio performed over time - across asset classes, across currencies, and across family members.
Asset Classes
Six data types, each with distinct behavior for pricing, quantity tracking, and cost basis:
| Data type | Examples | Price source | Cost basis |
|---|---|---|---|
equity_india | NSE/BSE stocks | Twelve Data API | FIFO lots |
equity_us | NASDAQ/NYSE stocks | Twelve Data / Yahoo Finance | FIFO lots |
mutual_fund_india | Any AMFI-registered fund | mfapi.in | FIFO lots |
crypto | BTC, ETH, USDT | Twelve Data | FIFO lots |
bank_balance | Savings accounts | Manual entry (1 unit = 1 currency unit) | Lot-based balance |
real_estate | Property, land | Manual valuation | Fixed or floating |
All six flow through the same assets catalog and holdings tables. The difference is in the schema flags that control pricing behavior, quantity tracking, and whether FIFO applies.
The Schema-Driven Design
Every asset in Sanchayam is a row in an admin-managed catalog table. The catalog specifies behavior: does this asset have discrete units or a single lump value, does price come from an API or manual entry, how is cost basis computed. User holdings reference catalog assets and inherit all of those behaviors.
Adding a new tradable instrument does not require code changes. The admin registers it in the catalog with the right flags and the system routes it correctly through pricing, snapshots, and XIRR.
Deliberately Slow-Paced
Sanchayam is not built for people who check their portfolio three times a day. If that is you, this is not your tool.
It is built for investors who have a lot to track but do not need to watch it constantly. You log your transactions when they happen - a buy, a sell, a deposit. Then you close the tab. The system runs its Friday snapshot, fetches the week’s prices, computes XIRR across all your holdings, and has everything ready. When you come back - maybe next week, maybe next month - the numbers are already there, warmed up.
The weekly cadence is a design choice, not a limitation. Daily snapshots would generate more data for a view nobody uses daily. A price feed that runs every minute would burn API quota on assets nobody is looking at. The 48-hour consumption window that gates price refreshes exists precisely because assets that nobody has checked in two days do not need fresh prices. The system is calibrated to be useful for the investor who shows up occasionally, not the one who refreshes obsessively.
If you plug in your numbers and come back in a week to find a clean portfolio chart, realized P&L, and XIRR across every asset class - that is the intended experience.
Stack
Backend: Node.js + TypeScript + Fastify
Frontend: React + Vite
Database: PostgreSQL
Price feeds: Twelve Data (equity, crypto, FX), mfapi.in (Indian mutual funds), Yahoo Finance (corporate actions, historical weekly prices)
Corporate action extraction: DeepSeek (parsing NSE announcement text into structured events)
Infrastructure: Backend as a systemd service, frontend on S3 + CloudFront via GitHub Actions
This Series
- The Asset Schema: One Table for Every Asset Type
- Auth: OTP Reset, Invite Signup, and Token Rotation
- FX Service: USD Pivot, Two-Layer Cache, Stale-While-Revalidate
- Price Feed Queue: Providers, Routing, and Rate Limits
- FIFO Cost Basis and Realized P&L
- XIRR from Scratch: Newton-Raphson on a Portfolio
- Friday Snapshots: Weekly Portfolio State with Historical Backfill
- Corporate Actions and the Backfill Pipeline
- Deploying Sanchayam