Skip to main content
Get your LoL Tracker Backend up and running in just a few minutes. This guide will walk you through cloning the repository, setting up your environment, and making your first API calls.

Prerequisites

Before you begin, make sure you have:
  • Node.js (v14 or higher) installed on your machine
  • npm package manager
  • A Riot Games Developer API Key (we’ll show you how to get one)
If you don’t have Node.js installed, download it from nodejs.org

Setup Process

1

Clone the Repository

First, clone the LoL Tracker Backend repository to your local machine:
git clone https://github.com/ValentinSetti/tracker-lol-backend.git
cd tracker-lol-backend
2

Install Dependencies

Install all required npm packages:
npm install
This will install:
  • express (v5.2.1) - Web server framework
  • axios (v1.13.5) - HTTP client for Riot API requests
  • cors (v2.8.6) - Enable cross-origin requests
  • dotenv (v17.3.1) - Environment variable management
3

Get Your Riot API Key

To access Riot Games data, you need a developer API key:
  1. Visit developer.riotgames.com
  2. Sign in with your Riot Games account
  3. Navigate to your dashboard
  4. Copy your Development API Key
Development API keys expire after 24 hours and have rate limits. For production use, you’ll need to apply for a production key.
4

Configure Environment Variables

Create a .env file in the root directory of the project:
touch .env
Add your Riot API key to the .env file:
.env
RIOT_API_KEY=your_riot_api_key_here
The .env file is gitignored by default to keep your API key secure. Never commit this file to version control.
5

Start the Server

Launch the development server:
node index.js
You should see:
Servidor corriendo en http://localhost:3000
The API is now running on port 3000!
6

Verify the Server

Test that the server is running by visiting the root endpoint:
curl http://localhost:3000
Expected response:
¡El servidor del LoL Tracker está vivo, Guillote!

Making Your First API Calls

Now that your server is running, let’s test the two main endpoints with real API calls.

Get Player Information

Retrieve a player’s rank, level, and profile information:
curl http://localhost:3000/api/jugador/HideOnBush/KR1
Example Response:
{
  "userTier": "CHALLENGER",
  "userRank": "I",
  "userLps": 1247,
  "userWins": 145,
  "userLosses": 98,
  "userLevel": 387,
  "userPic": 4568,
  "userId": "abc123-def456-ghi789..."
}
Replace HideOnBush/KR1 with any valid Riot ID in the format gameName/tagLine

Get Match History

Retrieve a player’s recent match history with pagination:
curl http://localhost:3000/api/historial/HideOnBush/KR1
Query Parameters:
ParameterTypeDefaultDescription
inicionumber0Starting index for pagination
cantidadnumber10Number of matches to retrieve
Example Response:
[
  {
    "duracion": "28:45",
    "cola": "Clasificatoria Solo/Dúo",
    "campeon": "Zed",
    "estado": true,
    "k": 12,
    "d": 3,
    "a": 8,
    "jugadoresPartida": [
      {
        "nombre": "PlayerOne",
        "tag": "NA1",
        "equipo": 100,
        "campeon": "Ahri",
        "estado": true,
        "k": 8,
        "d": 5,
        "a": 15,
        "items": [3089, 3157, 3116, 3135, 3020, 0, 3364]
      }
      // ... 9 more players
    ],
    "killsRed": 18,
    "deathRed": 32,
    "assistsRed": 45,
    "killsBlue": 32,
    "deathsBlue": 18,
    "assistsBlue": 68
  }
  // ... more matches
]

Response Field Reference

Player Endpoint (/api/jugador/:nombre/:tag)

FieldTypeDescription
userTierstringRank tier (IRON, BRONZE, SILVER, GOLD, PLATINUM, DIAMOND, MASTER, GRANDMASTER, CHALLENGER, or UNRANKED)
userRankstringDivision within tier (I, II, III, IV) - empty for UNRANKED
userLpsnumberLeague Points (LP) in current division
userWinsnumberTotal ranked wins in current season
userLossesnumberTotal ranked losses in current season
userLevelnumberSummoner level
userPicnumberProfile icon ID
userIdstringPlayer’s unique PUUID

Match History Endpoint (/api/historial/:nombre/:tag)

FieldTypeDescription
duracionstringMatch duration in MM:SS format
colastringQueue type (e.g., “Clasificatoria Solo/Dúo”, “ARAM”)
campeonstringChampion played by the queried player
estadobooleanWhether the queried player won (true) or lost (false)
knumberKills by the queried player
dnumberDeaths by the queried player
anumberAssists by the queried player
jugadoresPartidaarrayArray of all 10 players in the match
killsRednumberTotal kills by red team
deathRednumberTotal deaths by red team
assistsRednumberTotal assists by red team
killsBluenumberTotal kills by blue team
deathsBluenumberTotal deaths by blue team
assistsBluenumberTotal assists by blue team

Supported Queue Types

The API translates Riot’s queue IDs to human-readable names:
Queue IDDisplay Name
420Clasificatoria Solo/Dúo
400Normal Reclutamiento
430Normal Selección Oculta
440Clasificatoria Flexible
450ARAM
700Clash
OtherOtro Modo

Troubleshooting

This usually means your API key is invalid or expired. Development API keys expire after 24 hours.Solution: Get a fresh API key from developer.riotgames.com and update your .env file.
The player name and tag combination doesn’t exist.Solution: Verify the exact spelling and tag. Riot IDs are case-sensitive for the game name but tags are always uppercase.
You’ve made too many requests. Development API keys have strict rate limits:
  • 20 requests per second
  • 100 requests per 2 minutes
Solution: Implement request throttling or apply for a production API key with higher limits.
Another application is using port 3000.Solution: Either stop the other application or change the port in index.js by modifying the PORT constant (line 7).

Next Steps

API Overview

Explore detailed documentation for all endpoints

Configuration Guide

Learn about server configuration and environment variables

Authentication

Set up and manage your Riot API key

Rate Limits

Handle Riot API rate limits effectively

Build docs developers (and LLMs) love