Overview
Rotations.lol is five services that share one PostgreSQL database: a React + TypeScript web app, an hourly ingestion pipeline, a public REST API, an AWS SES email worker, and a monitoring service. Together they come to 20,000+ lines of code and 45 test files.
- Registered users
- 2,500+
- Pageviews
- 190,000+
- Countries
- 151
- Uptime
- 99.9%
The problem
League of Legends cosmetics go on sale on a rotating basis, and the prices live inside the Riot Client. A player waiting for a specific item has to open the client and check by hand, and a sale can come and go before they notice.
I wanted players to be able to wishlist the items they care about and get an email when one goes on sale. That meant reading live pricing for every cosmetic, every hour, and doing it reliably enough that people would trust the alerts.
Architecture
Five services, one PostgreSQL database, each service in its own repository.
- Riot Client Headless under Wine, in Docker
- Ingestion Hourly, systemd timers · 17,000+ items
- PostgreSQL Supabase · shared by all services
-
- Public REST API In-memory snapshots
- Email worker AWS SES · after each good run
- Web app React + TypeScript
Hard problems
Getting the data at all
The ingestion pipeline collects live pricing for 17,000+ cosmetics every hour. To do that I reverse-engineered the Riot Client's internal auth flow:
- Loopback API via lockfile
- RSO authorization
- Entitlements
- Login queue
- League session token
- Storefront and Shoppe reads
The client runs headlessly under Wine in a Docker container on a Linux server. systemd timers schedule each run, and traffic is routed through Tailscale.
Never publishing bad data
- Each snapshot is validated across all shop inputs before an atomic swap. A failed run never overwrites the last good data.
- Retries are bounded.
- An HTTP 429 sets a cooldown. A 401 or 403 pauses ingestion for manual review instead of retrying.
Moving off a Raspberry Pi and a Windows PC
The first version used a Flask scheduler on a Raspberry Pi to wake a Windows PC with Wake-on-LAN and read the League client running on it. I migrated ingestion to the headless Linux runtime described above, with a documented switchover and rollback path.
Serving a public API without touching the database
The public REST API is anonymous and documented with OpenAPI. It serves in-memory snapshots, so requests make zero database reads.
- Pagination and filters.
-
Per-IP rate limiting at 60 requests per minute, returning 429
with
Retry-After. - ETags and 5-minute caching.
-
On failure it keeps serving the last valid snapshot.
/healthreturns 503 when data is more than 90 minutes stale. - Fingerprint change detection skipped 97% of cache rebuilds. Refresh p95 is under 1 second.
Sending each alert exactly once
The email worker runs only after a successful ingestion. PostgreSQL queue functions use a unique user-item-sale key, so nobody gets the same alert twice. Alerts are batched per recipient, and batches take exclusive locks. AWS SES handles delivery tracking, with bounces handled through SNS. It has sent 5,700+ alerts.
Staying up
A monitor on a separate host runs heartbeat, freshness, and uptime
checks and posts Discord alerts when a service changes state,
including a notice when it recovers. The database is backed up daily
with pg_dump, with retention. Uptime is 99.9%.
Getting found
The web app is a React SPA, so I added prerendered HTML that crawlers can read, Open Graph images, and a sitemap. The build fails if the meta templates drift. Monthly traffic grew 50x in seven months, from under 1,000 to 51,000+ pageviews, and the site ranks in the top 3 on Google for "lol mythic shop rotation".
Results
- Registered users
- 2,500+
- Wishlist entries
- 22,000+
- Sale alerts sent
- 5,700+
- Uptime
- 99.9%
- Pageviews from 151 countries
- 190,000+
- Monthly traffic growth in 7 months
- 50x
- Search clicks in 12 months
- 58,000+
- Google for "lol mythic shop rotation"
- Top 3
Links
- rotations.lol
- api.rotations.lol (docs)
- github.com/zandonella/rotations-lol · React + TypeScript web app
- github.com/zandonella/rotations-ingestion · Hourly ingestion pipeline
- github.com/zandonella/rotations-api · Public REST API
- github.com/zandonella/rotations-email · AWS SES email worker
- github.com/zandonella/rotations-monitoring · Monitoring service