npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@timmsy/riftjs

v1.5.0

Published

A lightweight Node.js wrapper for the Riot Games API, providing easy access to League of Legends game data.

Downloads

17

Readme

RiftJS

A lightweight Node.js wrapper for the Riot Games API, providing easy access to League of Legends game data.

npm version GitHub license

Overview

RiftJS simplifies interaction with the Riot Games API and DataDragon static data. It supports fetching account details, summoner info, match history, and game data using a modular endpoint structure. Built with axios and dotenv, it’s designed for developers building League of Legends tools or applications.

Features

  • RiotAPI: Fetch account data by Riot ID, summoner data by PUUID, match history, and match details.
  • DataDragon: Access static game data like champions and items.
  • Region Support: Handles platform (e.g., EUW1) and shard (e.g., europe) routing.
  • Modular Design: Endpoints are organized in an /endpoints/ directory for easy extension.

Installation

Install RiftJS via npm:

npm install @timmsy/riftjs

You’ll also need a Riot Games API key from developer.riotgames.com.

Setup

  1. Install Dependencies: Ensure you have Node.js installed, then run the install command above.

  2. Configure Environment: Create a .env file in your project root with your API key and region:

    RIOT_API_KEY=RGAPI-your-api-key-here
    REGION=EUW1
    • Replace RGAPI-your-api-key-here with your API key.
    • Use a short region code (e.g., EUW1, NA1). See Region Mapping for details.

Usage

Here’s a basic example to get started:

const { RiotAPI, DataDragon } = require('@timmsy/riftjs');

// Initialize RiotAPI
const riot = new RiotAPI();

// Fetch account, summoner, and match data
async function fetchPlayerData() {
  try {
    const account = await riot.getAccountByRiotId('Timmsy#BRUV');
    console.log('Account:', account);

    const summoner = await riot.getSummonerByPuuid(account.puuid);
    console.log('Summoner:', summoner);

    const matchlist = await riot.getMatchlistByPuuid(account.puuid, { start: 0, count: 5 });
    console.log('Matchlist:', matchlist);

    const match = await riot.getMatchById(matchlist[0]);
    console.log('Match:', match);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

// Initialize DataDragon
const dd = new DataDragon();

async function fetchStaticData() {
  try {
    const champions = await dd.getChampions();
    console.log('Champions:', champions.data);

    const items = await dd.getItems();
    console.log('Items:', items.data);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

// Run the examples
fetchPlayerData();
fetchStaticData();

API Reference

RiotAPI

  • getAccountByRiotId(riotId, [tagLine], [region]): Fetch account by Riot ID (e.g., Timmsy#BRUV).
  • getSummonerByPuuid(puuid, [region]): Get summoner data by PUUID.
  • getMatchlistByPuuid(puuid, [options], [region]): Get match history (options: { start, count }).
  • getMatchById(matchId, [region]): Get match details.

DataDragon

  • getChampions(): Fetch all champion data.
  • getItems(): Fetch all item data.

Region Mapping

RiftJS uses a region map to route requests correctly:

  • Platform Routing (e.g., Summoner V4):
    • EUW1euw1.api.riotgames.com
    • NA1na1.api.riotgames.com
  • Shard Routing (e.g., Account V1, Match V5):
    • EUW1europe.api.riotgames.com
    • NA1americas.api.riotgames.com

Supported regions: BR1, EUN1, EUW1, JP1, KR, LA1, LA2, NA1, OC1, TR1, RU, PH2, SG2, TH2, TW2, VN2.

Keywords

  • riot-api
  • league-of-legends
  • lol-api
  • datadragon
  • summoner
  • match-history
  • game-data
  • node-js
  • javascript
  • api-wrapper

Development

To contribute or run locally:

  1. Clone the repo:
    git clone https://github.com/timmsy1998/RiftJS.git
    cd RiftJS
  2. Install dependencies:
    npm install
  3. Create a .env file (see Setup).
  4. Test with node test.js (requires a valid API key).

License

MIT License © 2025 James Timms. See LICENSE for details.

Links