Skip to content

nba2kAPI

Use the left and right arrow keys to move through the work stream.←→
ROLE
Design and engineering
TIMELINE
2024 to now
STACK
Next.js, Convex, Hono
SITE VISITS
31k
REQUESTS SERVED
73k
API KEYS ISSUED
397

WHAT IT IS

I wanted NBA 2K ratings as clean data I could build on, and nothing like it existed for free, so I made it. nba2kAPI serves ratings, attributes, and badges for every current, classic, and all-time team in the game, for anyone who wants to build on top of it, my own Blacktop Blitz included.

What you get

  • A REST API with filters for team, position, rating, attributes, and badge tier, plus past editions of the game as they’re archived.
  • A playground where you build a query in plain words and see the exact request it makes.
  • Tools for fans: team rosters, player pages, side-by-side comparisons, a badge explorer, and a lineup builder that grades how well five players fit together on the court.

Under the hood

A scraper built on Playwright pulls fresh ratings every week. When it finds changes, it tells the site exactly which players changed, so only those pages get rebuilt instead of the whole site. The API runs on Hono inside Convex, with every request validated by Zod. Each free key gets 100 requests an hour, and that limit is counted inside a database transaction so it holds even when requests arrive at the same moment. Expensive numbers like league averages are worked out once ahead of time instead of on every page view, which cut the database’s reads dramatically as traffic grew.

$curl https://api.nba2kapi.com/api/public/playersno key needed; free keys for the full API at nba2kapi.com
nba2kapi.com
nba2kapi.com

MOREEverything →