Investly — CSE Portfolio Tracker
(2025 - Present)
A real-time portfolio tracker for the Colombo Stock Exchange, built to replace spreadsheets with precision.
I invest in the Colombo Stock Exchange. The existing tools for tracking a CSE portfolio were either expensive, outdated, or required manually updating a spreadsheet after every session. So I built Investly — a real-time portfolio tracker that does the work the spreadsheet shouldn't have to. This project is different from my other work because I'm the user. Every decision — what data to surface, how to handle latency, what the dashboard prioritizes — was made by someone with real money and real portfolio decisions depending on it.
The Problem: Complexity Without Clarity
Existing CSE platforms give you raw data but no direction. I needed a tool that answered simple questions: What's my P&L right now? How much cash is free? What happens if I enter this stock at three different price points?
Spreadsheets worked until they didn't. Manual tracking meant stale data, calculation errors, and no visibility into sector allocation. I wanted a single dashboard that could do it all—live.
Building for Myself
Investly started as a personal tool, which shaped every design decision. The dashboard shows four core metrics at a glance: Wallet (available cash), Net Value (holdings at market price), Total P&L, and Active Positions. Data updates in real-time via Supabase Realtime subscriptions—no refresh needed.
I added a Portfolio Simulator where I can plan trades before committing capital. It supports tranche-based entries, calculates fees, rounds share quantities to CSE lot sizes, and shows me the exact cost breakdown before I execute.
Technical Architecture
The frontend is built with Next.js 16 and React 19, deployed on Vercel. Supabase handles authentication (Google OAuth), the PostgreSQL database, and real-time price broadcasting. Drizzle ORM provides type-safe database access with relational queries.
Market data is ingested by a separate collector service that updates the symbols table. Supabase Realtime then pushes these updates to all connected clients via WebSocket channels. The holdings are computed server-side using a Postgres view that aggregates BUY/SELL transactions automatically.
Key Features
Real-time dashboard with live CSE prices and instant P&L calculations. Full transaction history (BUY, SELL, DEPOSIT, WITHDRAWAL, DIVIDEND) with search, filtering, and CSV export. Portfolio Simulator with tranche support and fee calculations. Price Alerts to notify when a stock hits your target. Sector allocation visualization via Recharts. Guest Mode for instant demo access without signup.
Lessons Learned
Building for yourself changes everything. When your own money is on the line, you write better code. TypeScript with Zod validation became non-negotiable—one decimal error breaks your P&L. Handling stale data, market closures, and rate limits taught me defensive programming I'd never have learned from tutorials. And shipping early, even when it felt unpolished, gave me the feedback loop that shaped every feature since.

