Home » Customer Portals » Game Leaderboard

How to Build a Game Leaderboard and Player Profiles

A game leaderboard stores player scores, rankings, and profiles in a cloud database that your game client reads and writes through a webhook API. The NoSQL database on the platform provides fast key-value storage at 1-2 credits per operation, making it practical for games with frequent score submissions and leaderboard queries.

Why Use a Portal Backend for Games

Most indie and small-studio games need a simple backend for storing player data, leaderboards, and achievements, but do not need the complexity of a full game server. A portal backend with the NoSQL database gives you a REST API for reading and writing player data without managing servers, configuring databases, or writing backend code from scratch.

The NoSQL table stores data as key-value pairs with partition and sort keys, which maps perfectly to game data patterns. The partition key is the game ID or player ID, and the sort key identifies the type of record (profile, score, achievement, inventory). Reads and writes are fast and inexpensive.

Leaderboard Architecture

Storing Scores

When a player completes a level or match, your game client sends the score to the webhook API. The backend stores it in the NoSQL table with the player ID as the partition key and a sort key like "score-levelname" or "score-timestamp". You can store both the player's best score per level and their complete score history.

Querying Leaderboards

To display a leaderboard, your game queries all scores for a specific level or game mode. The API returns the records sorted by sort key, and your game client sorts them by score value to build the ranking. For global leaderboards across all players, store scores in a shared partition (like the game ID) with the sort key combining the score value and player ID for efficient retrieval.

Player Profiles

Each player gets a profile record storing their display name, avatar selection, total playtime, achievements unlocked, and any other persistent data. The game reads the profile on startup and writes updates when the player changes settings or earns new achievements. The same profile data can be displayed on the web portal if players want to view their stats in a browser.

Connecting Your Game to the API

Your game connects to the portal through HTTP requests to the webhook API. In Unity, use UnityWebRequest to POST score data and GET leaderboard results. In other engines, use the built-in HTTP client. The API accepts JSON payloads and returns JSON responses, so it works with any game engine or programming language.

Authentication uses an API key included in each request header. This prevents unauthorized score submissions while keeping the integration simple. For additional security, you can validate scores server-side using custom app logic that checks for impossible values before saving.

Web Portal for Player Stats

In addition to the in-game leaderboard, you can build a web portal where players log in and see their full statistics, compare with friends, and view all-time rankings. The web portal reads from the same database as the game, so data is always in sync. This is especially useful for competitive games where players want to check standings between play sessions.

Cost example: A game with 1,000 daily active players, each submitting 5 scores and querying the leaderboard 10 times per session, would use about 15,000 database operations per day. At 1-2 credits per operation, that is 15,000-30,000 credits per day, or roughly $15-30 per day.

Build a game backend with leaderboards, player profiles, and cloud save. No server management required.

Get Started Free