skip to content
meistyr.tech/~luke
case study/002/archived

Royalty Series

The platform behind Royalty Series, a competitive Rocket League league: a NestJS API, a Discord bot and a Nuxt website, run in production for seven seasons.

role
Founder & Full Stack Engineer
period
Jan 2024 — May 2026
status
Archived case study
01 — overview

How the league ran

The league ran in Discord and Google Sheets. Match results came from exported replay data and player submissions, staff approved or denied them, and other staff built and maintained the sheets. The platform connected all of it through one API: the Discord bot sent staff and team actions to it, sheet data was imported into it, and the website read from it. A teammate focused on the bot while I focused on the API and the website.

02 — the platform

The website

royalty.meistyr.tech/circuits — teams
Royalty Series circuit page showing team cards with seed, series record, game record and differential
royalty.meistyr.tech/circuits — standings
Royalty Series standings table, sortable by seed, series record, game record and differential
royalty.meistyr.tech/circuits — stats
Royalty Series circuit page on the Stats tab: a sortable table of player rating, games, MVPs, score, goals, assists and shots
Royalty Series match-day view on a phone, listing weekly matchups with team logos and series scores
engagement by device
Desktop49% of users
6m 18s
Mobile49% of users
1m 52s
Users split almost evenly between desktop and mobile, but desktop engagement ran more than three times longer.
03 — architecture

How the system was set up

production architecture

Select a part to see what it did and how it connected.

Ubuntu · PM2 · Cloudflare · DigitalOcean
04 — decisions

The decisions behind it

League data keyed by Discord server

It was built for more than one league from the start, because the plan was to let other leagues run on it too. Divisions, schedules, settings and stats were stored per Discord server, while players were shared across leagues. A second league ran on it for one season. When Royalty Series closed, we chose not to start another league and took what we’d learned into Project Signal.

cost

Tokens weren’t tied to a league, so the API used whatever server ID the caller sent. Keeping leagues apart depended on the bot and the site sending the right one, which held because both were ours.

The API as the only way in

The bot, the website and the sheet’s Apps Script all went through the API, and only the API talked to the database. The website called it from its own server routes, so its API key never reached the browser. Every write went through the same validation, whichever client sent it.

cost

Every bot feature needed an API endpoint first, the bot was down whenever the API was, and the website’s server routes added a hop in front of every request.

05 — the API

What the API had to handle

Auth required by default

Every route needed a valid token unless it was marked @Public(), and only login, token refresh and the health check were. A new endpoint was protected automatically. The API also checked roles, so the website’s key could only read, and each token carried a version number, so logging out invalidated all of that account’s tokens.

cost

Every request from the bot loaded its account to check the token version, which added a database read to each call. The website’s key skipped that check. A route meant to be public stayed locked until someone marked it.

Discord IDs stored as strings

Discord IDs are 64-bit numbers. JavaScript rounds numbers above 2⁵³, and a rounded ID points to the wrong record. The API only accepted IDs as strings of digits, queries returned ID columns as text, and a global interceptor converted any BigInt values to strings.

cost

Every new query had to return ID columns as text. The interceptor only caught BigInt values that slipped through, not numbers that were already rounded.

Imports could be re-run safely

Results and stats came in as bulk imports. Each import used INSERT … ON DUPLICATE KEY UPDATE, so sending the same week again updated the existing rows instead of creating duplicates.

cost

A re-import overwrote every column with the sheet’s values, so a fix made directly in the database was lost on the next import. The sheet always won.

Roster changes checked before saving

Roster changes with several steps ran in a transaction. For a captain swap, the API demoted the old captain, promoted the new one, then checked the team had exactly one captain. If not, the whole change was rolled back.

cost

The check ran after the writes, so a bad change was written and then rolled back instead of being rejected up front.

06 — the migration

Moving from Express to NestJS

The API started out in Express and was rebuilt in NestJS with the same 54 routes, so the bot and website could switch over without changes. We chose NestJS because it's opinionated. Every feature follows the same pattern of modules, guards and validation, so the API could grow cleanly as more leagues came on. The rebuild split the code into modules by domain, added validation and types to every request, and tightened authentication. Before launch, the new API ran in dev on the current season’s data alongside the Express API, and it replaced Express between seasons. An AI agent (Codex) wrote the tests with human guidance, and every issue it found was checked by hand before it was fixed.

07 — the archive

Keeping the site up after shutdown

When the platform shut down, the API and database went offline but the site stayed up. I saved the API’s responses and removed anything that linked a player’s name to an outside account, like tracker links with Steam and Epic IDs and Discord avatars with user IDs. I also copied the team and sponsor logos off the CDN. The site’s server routes now serve that saved data in the same format the API used, so no pages or components had to change. That’s the live demo linked above.

royalty.meistyr.tech
The archived Royalty Series homepage: the Royalty Series wordmark, the headline Competition for the crown, and the Season VII welcome banner
08 — lessons learned

What I’d do differently

Two things lived outside the API that should have been in it. Nobody logged into the website, so the Discord bot created people’s accounts and checked whether someone was a team’s captain or manager before acting. The API only knew the bot was asking, not who. Results and stats were built in Google Sheets and imported, so the sheet always won and a fix made in the database didn’t last. I carried these lessons over to my work on Car Soccer City.

next

Threat Intelligence Ingestion Pipeline

Security engineering: PDF, Excel, CSV and JSON intake, normalization, and detection-ready content in a SIEM.