← All projects

NBA Stocks

Dec 2025 – May 2026 • Solo project

A fantasy stock market where every NBA player is a stock. You start with $100,000 in virtual cash, buy and sell shares of players, and their prices move every night based on how they actually played.

Next.js TypeScript PostgreSQL Prisma Auth.js Claude API Vercel

Your portfolio

The home page tracks your account like a brokerage app: total portfolio value over time, each position with its gain or loss, your recent trades, and a "top of the day" card for the player who had the best game last night.

NBA Stocks portfolio page with a value chart, list of player positions, and recent trades
Portfolio value, open positions, and recent activity.

How prices are calculated

The pricing engine is designed to reward consistency over one-off explosions. It works in three steps:

A Vercel cron job runs every morning. It scrapes the previous night's box scores from ESPN, stores each player's game log, and reprices every active player. Historical prices were seeded from a CSV of every game log since the 1996–97 season.

Page explaining the stock price formula, stat multipliers, and price tiers
The in-app explainer for the pricing formula.

Player pages and AI trend analysis

Each player has a price chart, season and career stats, and a buy button. The "Get AI Trend Analysis" button sends the player's recent game-by-game prices and stats to Claude, which writes a two-to-three sentence read on where the stock is heading and why.

Player page for Shai Gilgeous-Alexander with price chart, market price, and season averages
A player's price history, market price, and stats.

Compare players

The Players page lets you search and filter every player by team and price, then chart up to eight of them against each other across 1-month to all-time ranges.

Comparison chart of three players' stock prices over three years
Comparing three players' prices over three seasons.

Friends

Add friends by email to see their overall gain or loss and every position they hold, which turns the game into a running competition.

Friends page showing a friend list and one friend's positions
Friend requests, the friends leaderboard, and a friend's holdings.

Trade from the terminal

NBA Stocks also ships as a command-line app. Running npx nbastocks logs you in and opens an interactive prompt where you can quote a player by ticker, buy and sell shares, and check your positions and balance. It talks to the same backend through a separate set of token-authenticated API routes.

Terminal Exchange page listing CLI commands such as QUOTE, BUY, SELL, and POSITIONS
The in-app guide to the CLI and its commands.

Under the hood

Screenshots are from a local copy of the app running on a demo account, with real NBA stats and made-up users.