Private portfolio and goal tracking for Indian investors.
Track mutual funds and stocks, XIRR, SIPs and how close each goal is, in rupees.
Live NAVs from MFAPI and Yahoo Finance. Your data stays in your own database.
- 📈 Live portfolio: mutual funds via MFAPI scheme codes, stocks and ETFs via Yahoo Finance (NSE
.NSand BSE.BOare tried automatically). Current value, gain and XIRR per holding and overall. - 🎯 Goals: targets in today's money, grown with your inflation assumption, with the monthly SIP each goal needs and whether you are on track.
- 🔀 Allocations: split every investment across goals; goal progress is the allocated share of each holding's current value.
- 🧾 Ledger: buys and sells with amount, NAV and units (units are calculated from amount / NAV).
- ₹ Indian formatting:
₹12,34,567grouping and compact₹4.2L/₹1.2Crvalues, with the exact amount on hover. - 💾 Backups: export everything as JSON and import it back (replaces your data).
- 🌗 Light and dark mode, works on phones.
| Investments | Goals |
|---|---|
![]() |
![]() |
Requires Bun 1.4+ and a Google OAuth client.
git clone https://github.com/anandrajaram21/Corpus.git
cd corpus
bun install
cp .env.example .envFill in .env:
| Variable | Value |
|---|---|
BETTER_AUTH_URL |
http://localhost:3000 locally, your site URL in production |
BETTER_AUTH_SECRET |
a random string, e.g. openssl rand -base64 32 (required in production) |
BETTER_AUTH_GOOGLE_CLIENT_ID / _SECRET |
from Google Cloud Console → APIs & Services → Credentials → OAuth client ID (Web application) |
DATABASE_URL |
file:./db.sqlite for local SQLite, or libsql://… for Turso |
DATABASE_AUTH_TOKEN |
Turso token; leave empty for local SQLite |
Add this Authorized redirect URI to the Google OAuth client (one per environment):
http://localhost:3000/api/auth/callback/google
Create the tables and start the app:
bun run db:push # applies src/server/db/schema.ts to DATABASE_URL
bun run dev # http://localhost:3000Then follow the in-app Guide: set assumptions → add goals → add investments → record transactions → allocate.
- Import the repo in Vercel. Bun is detected from
bun.lock; no build settings are needed. - Add the environment variables above. Use a hosted libSQL database such as Turso (
DATABASE_URL=libsql://…plusDATABASE_AUTH_TOKEN), since the serverless filesystem is not persistent. - Set
BETTER_AUTH_URLto the production URL and addhttps://<your-domain>/api/auth/callback/googleas a redirect URI in Google Cloud. - Apply the schema to the production database from your machine:
DATABASE_URL=… DATABASE_AUTH_TOKEN=… bun run db:push.
Quotes are cached in the Next.js data cache (MFAPI NAVs for 30 minutes, Yahoo prices for 5 minutes), so page loads don't wait on the quote APIs.
| Path | What it holds |
|---|---|
src/app/(app)/ |
Signed-in pages (dashboard, investments, transactions, goals, allocations, assumptions, guide), shared layout, loading and error states |
src/app/page.tsx |
Public landing and sign-in page |
src/app/_components/ |
App shell, navigation, stat cards, tables and the create/edit forms (forms/) |
src/app/api/ |
Better Auth handler, tRPC endpoint, JSON backup export/import (/api/data) |
src/components/ui/ |
shadcn/ui primitives |
src/lib/ |
Pure, unit-tested logic: XIRR and goal math (portfolio.ts), INR formatting (format.ts), quote sources (quote-sources.ts), backup format (backup.ts) |
src/server/ |
Database (Drizzle schema), tRPC routers, auth, quote fetching, per-request data loaders |
src/env.js |
Validated environment variables |
| Command | What it does |
|---|---|
bun run dev |
Development server |
bun run check |
ESLint, TypeScript and Vitest (run before every commit) |
bun run test |
Unit tests only |
bun run build / bun run start |
Production build / server |
bun run format:write |
Prettier |
bun run db:push |
Apply the schema to DATABASE_URL |
bun run db:studio |
Drizzle Studio |
Stack: Next.js 16 (App Router, React 19), tRPC 11, Better Auth (Google), Drizzle ORM on SQLite/libSQL, Tailwind CSS 4 with shadcn/ui, Vitest. See AGENTS.md for architecture notes and project rules.

