How to Add a Leaderboard to Your Unity Game for Free (No Monthly Fees)
Every game is better with a leaderboard. But the moment you go looking for a leaderboard backend, you hit a wall.
The Problem With Existing Options
The popular choices all have tradeoffs that don't suit indie developers well.
**Firebase now has dedicated leaderboard support, but you're still on Google's infrastructure with Google's pricing — and no control over what changes next.
LootLocker has a genuinely generous free tier and is worth looking at. But you're still trusting a third party with your player data, and you have no control over pricing changes down the road.
Nakama is open source and free to self-host — but it's a full game server platform. If all you need is a leaderboard, the setup complexity is significant. It's a serious piece of infrastructure built for serious use cases.
The underlying frustration is simple: a leaderboard is not a complicated thing. It's a sorted list of scores. Why does setting one up take an afternoon?
What If You Just Hosted It Yourself?
Self-hosting sounds scary but the actual requirements for a leaderboard backend are modest:
- A small server to run the API
- A PostgreSQL database to store scores
- A way to query rankings efficiently
That's it. No real-time sync, no complex state, no websockets. A leaderboard is fundamentally a read-heavy REST API backed by a database with a good index.
The total hosting cost for this on free infrastructure: $0/month.
Introducing RankDrop
RankDrop is an open source, self-hosted leaderboard backend built specifically for this use case.
- Free forever — Apache 2.0, no licensing fees, no usage limits
- Production ready — caching, connection pooling, atomic writes, health checks
- Tiny footprint — GraalVM native image, ~118MB Docker image, ~50ms startup
- Works with any HTTP client — Unity, Godot, mobile, web, desktop
- Multiple leaderboard types — all-time, daily, weekly, monthly with automatic resets
- Flexible scoring — high score wins, lowest time wins, or cumulative totals
- Player moderation — ban players, remove individual scores
- Webhook notifications — Discord or Slack alerts when top scores are beaten
You deploy it once, you own it forever.
How Long Does This Actually Take?
Here's an honest comparison:
| Path | Deploy | Unity integration | Total |
|---|---|---|---|
| Manual self-host (this tutorial) | ~20 min | 60 min | ~1.5 hours |
| RankDrop Unity Asset (coming soon) | included | included | 60 seconds |
This tutorial covers the manual path — it's straightforward and completely free. If you'd rather skip the hour entirely, the RankDrop Unity Asset handles both deploy and Unity integration in 60 seconds. Follow progress at turnkit.dev.
Deploying for Free on Koyeb + Aiven
The easiest zero-cost path is Koyeb (free app hosting) + Aiven (free managed PostgreSQL). Both have permanent free tiers — not trials.
Step 1 — Create a free PostgreSQL database on Aiven
- Sign up at aiven.io
- Create a new PostgreSQL service — select the free tier
- Once provisioned, copy the connection string from the service dashboard
It looks like:
postgres://user:password@host:port/defaultdb?sslmode=require
Step 2 — Deploy to Koyeb
- Sign up at koyeb.com
- Create a new app → select Docker → use the image
ghcr.io/brainzy/rankdrop:latest - Add your environment variables from
.env.example, substituting the Aiven connection string for the database URL - Deploy
Koyeb will give you a public URL like https://your-app.koyeb.app. That's your leaderboard API endpoint.
Note: Koyeb's free tier sleeps after 60 minutes of inactivity and wakes in about 3 seconds on the next request. For most indie games this is fine — your leaderboard loads on the main menu, which wakes it up before the player notices.
Step 3 — Verify it's running
Open your Koyeb URL + /swagger-ui/index.html in a browser. You'll see the full interactive API docs. Create a leaderboard, submit a test score, query the rankings — all from the browser before writing a single line of Unity code.
Calling the API From Unity
RankDrop exposes a standard REST API. From Unity you call it with UnityWebRequest — the same way you'd call any HTTP endpoint.
The key endpoints:
| What you want | Endpoint |
|---|---|
| Submit a score | POST /api/v1/leaderboards/{slug}/scores |
| Get top N scores | GET /api/v1/leaderboards/{slug}/top?limit=10 |
| Get a player's rank + neighbours | GET /api/v1/leaderboards/{slug}/players/{alias}?surrounding=3 |
| Top scores + player context in one call | GET /api/v1/leaderboards/{slug}/combined |
The combined endpoint is the one you'll use most — it returns both the top of the leaderboard and the current player's position in a single request, which is exactly what a leaderboard UI needs.
Full request/response schemas are in the Swagger UI once deployed.
This is also where the hour goes in the manual path — writing the UnityWebRequest wrappers, handling errors and timeouts, managing the game key, building a reusable service class. It's not hard, just time consuming. The Unity Asset ships all of this pre-built.
Multiple Leaderboard Types
One of the most useful features for games is automatic periodic resets. RankDrop supports:
- All-time — scores persist forever
- Daily — resets every day at midnight UTC
- Weekly — resets every Monday
- Monthly — resets on the 1st of each month
You can run multiple leaderboards simultaneously — one all-time, one weekly, one for a limited-time event — each with its own slug, scoring strategy, and reset schedule.
Scoring Strategies
Three modes out of the box:
Best only — only the player's highest score is kept. Perfect for high score games.
Multiple entries - Store every score submission as separate entries
Cumulative — scores add up over time. Perfect for daily challenge points or XP totals.
Define more parameters if you want
Sorting by lowest time or highest value
min and max scores
archive options and many others
If You Outgrow the Free Tier
Koyeb + Aiven handles the vast majority of indie games comfortably. If you do hit the free tier limits, the next step is any VPS with Docker — Hetzner, DigitalOcean, Fly.io. RankDrop is a single Docker container and runs anywhere.
For serious scale, Oracle Cloud's free tier gives you 4 OCPU and 24GB RAM permanently — but most indie games will never need it.
What's Next
RankDrop is the leaderboard foundation of TurnKit — a no-code multiplayer backend for turn-based games I'm building, including relay, matchmaking, and player economy. If you're making a card game, board game, or any turn-based multiplayer game, follow the build at turnkit.dev.
The RankDrop repo is at github.com/Brainzy/rankdrop. Stars, issues, and feedback all welcome.
If you run into any issues deploying, drop a comment below or join the TurnKit Discord — happy to help you get it running.
Tags: #gamedev #unity #opensource #java
Top comments (0)