Back to projects
Solo project

Rap Market Index

Rap Market Index is a fantasy stock market where people trade virtual shares in rappers and track portfolios, rankings, and news. I built the full application in Next.js and TypeScript, with Supabase authentication and PostgreSQL behind the trading system. It uses virtual cash, not real money.

  • Next.js
  • TypeScript
  • PostgreSQL
  • Supabase
Rap Market Index live dashboard showing market statistics, artist prices, momentum charts, and music news
Live application dashboard · captured October 11, 2026 · Open full-size image

Two requests, one balance

Two trades arriving together must not spend the same cash twice. I put the balance and holdings checks inside PostgreSQL functions that lock the account and market rows, then update balances and transaction records in one database transaction. The server checks the session, rate limit, and market status before calling those functions.

Implementation references

Keeping prices and market state consistent

Music-data sources can return stale, missing, or inconsistent observations. I retain source-quality information and version the pricing rules so changes are traceable. A pricing run only finishes when every active artist has a recorded close; incomplete runs can be retried, and trading pauses when market state cannot be verified.

Testing and recovery

I built automated tests for trading, pricing, and API behavior, plus Playwright browser coverage and GitHub Actions CI/CD. Backup and restore-verification workflows check that recovery works too. The figures below come from the documented project snapshot.

SQL migrations
45
API route handlers
38
Vitest test files
86