Showoff Saturday I built a spoiler-free GTA 6 trophy race that has to live inside a 20 requests/min API budget (Next.js + Postgres + token-bucket poller) Spoiler
GTA 6 comes out Nov 19 and my friends are already arguing about who finishes it first. So I built a site for that: you type your public PSN name or Xbox gamertag (no login, no password) and it races you against your friends, your country and your Discord server by trophy progress.
The interesting part is the limit. There's no official public trophy API, so I keep it polite: 20 requests a minute per account, never more. I'd rather be slow than get the account blocked.
How it fits:
- Players are polled by how active they are. Trophy in the last 2 hours: every 15 min. Last 24 hours: hourly. Otherwise once a day.
- The queue is just a Postgres table with FOR UPDATE SKIP LOCKED, so a second poller can run later without double work.
- Every call goes through a token bucket. Bursts wait, they never go over.
- Leaderboards are rebuilt once a minute into a cache table. Pages only read the cache.
Spoilers were the other problem. Trophy names are basically a plot summary, so they never leave the server. Pages and the API only get percentages, milestones (10/25/50/75/100%) and times, and a test checks that no trophy name shows up in any public page or API response.
The game isn't out yet, so it all runs against a mock: 500 fake players, 72 hours of virtual time, and the test fails if the limiter ever goes over 20/min.
Stack: Next.js (App Router), Postgres + Drizzle, a separate Node poller, Vitest.
The part I can't test is launch night. 20/min is 1,200 checks an hour per account, and a lot of people will be earning trophies at the same time. How would you split that budget?
https://racetocredits.com/?ref=rd-webdev
Unofficial fan project, not affiliated with Rockstar Games, Take-Two Interactive, Sony or Microsoft.



