// personal

Leaderboard API

A REST API for game leaderboards in Laravel: token auth, games, score submission and ranked daily, weekly and all-time leaderboards.

Company
XLANT SOFT · Self-employed
Role
Solo developer
Period
2023 – present
Platform
REST API (PHP)

What I built

  • Token authentication with Laravel Sanctum: register, log in, log out (revoking the token) and a /me endpoint.
  • Games owned by their creator: a policy lets only the owner update or delete them, and slugs are generated uniquely.
  • Each game declares whether the highest or the lowest score wins (points or race times), and the ranking follows it.
  • Leaderboards rank each player's best score with standard competition ranking (ties share a rank), filtered by all time, week or day.
  • Submitting a score returns the player's new standing immediately. A separate endpoint returns their rank in every period.
  • FormRequests, PHP enums, API Resources and pagination, with consistent JSON errors (401, 403, 404, 422, 429).
  • Rate limits on login, sign-up and score submissions, and email addresses shown only to their owner.
  • OpenAPI documentation generated from the code with Scramble and served as interactive Swagger UI, so every endpoint can be tried from the browser.
  • 25 PHPUnit feature tests, a demo-data seeder and a Docker image.

Built solo. The demo data uses my own games: Run For Life, King of Hearts and Infinite XO.