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

@skhashaev/steamapi-ts

v0.0.3

Published

Steam API powered by TypeScript

Readme

Steam API TypeScript Client

A fully typed TypeScript client for the Steam Web API with automatic type generation from the official API definition.

Note

This library is very young and not fully tested. By the idea and the implementation, it should work properly, but bear in mind that it may not work as expected right away. If you find any issues, please open an issue on the GitHub repository. If you find any open issues, resolve them :)

The library is a side project from the main one - we were in need some simple typed Steam API client, and I personally wanted to be able to call methods easily without copypasting the url string into some utility get() or post() functions. The changes to this library will be happening by the requests of the main project.

Features

  • 🔒 Fully Typed - All API methods and parameters are strongly typed
  • 🚀 Auto-generated Types - Types are generated directly from Steam's API definition
  • 🎯 Intuitive API - Clean, promise-based interface with method chaining
  • 🔑 Built-in Authentication - API key is automatically included in all requests
  • 📦 Zero Dependencies - Uses native fetch API

Installation

npm install @skhashaev/steamapi-ts

Quick Start

1. Set up your API key

Create a .env file in the project root:

API_KEY=your_steam_api_key_here

Get your Steam API key from: https://steamcommunity.com/dev/apikey

2. Use the client

import { createSteamClient } from '@skhashaev/steamapi-ts';
import 'dotenv/config';

const steam = createSteamClient(process.env.API_KEY!);

// Call API methods with full type safety
const appList = await steam.IStoreService.GetAppList_v1();
console.log(appList);

Usage Examples

Methods without parameters

For methods that don't require parameters, you can omit the argument entirely:

// Both are valid
const status = await steam.ICSGOServers_730.GetGameServersStatus_v1();
const status = await steam.ICSGOServers_730.GetGameServersStatus_v1({});

Methods with parameters

// Parameters are fully typed
const news = await steam.ISteamNews.GetNewsForApp_v2({
  appid: 440,
  count: 5,
  maxlength: 300,
});

Working with BigInt Parameters

Some Steam API parameters use 64-bit integers (like Steam IDs) that exceed JavaScript's safe integer range. For these parameters, you must use BigInt literals with the n suffix:

// ✅ Correct - Using BigInt literal
const friendList = await steam.ISteamUser.GetFriendList_v1({
  steamid: 76561199699144174n, // Note the 'n' suffix
});

// ✅ Also correct - Converting from string
const steamId = BigInt('76561199699144174');
const friendList = await steam.ISteamUser.GetFriendList_v1({
  steamid: steamId,
});

// ❌ Wrong - Number literal loses precision
const friendList = await steam.ISteamUser.GetFriendList_v1({
  steamid: 76561199699144174, // TypeScript error + precision loss!
});

[!IMPORTANT] Steam IDs and other 64-bit integers will lose precision if you use regular number literals. Always use BigInt (n suffix) or convert from strings using BigInt().

Error Handling

try {
  const result = await steam.ISomeInterface.SomeMethod_v1({ param: 'value' });
  console.log(result);
} catch (error) {
  console.error('API call failed:', error.message);
}

Type Safety

The client provides full IntelliSense support:

const steam = createSteamClient(apiKey);

// TypeScript knows all available interfaces
steam.IStoreService;
//    ^ IntelliSense shows all available interfaces

// TypeScript knows all methods for each interface
steam.IStoreService.GetAppList_v1;
//                  ^ IntelliSense shows all methods with their versions

// TypeScript knows the required parameters
steam.ISteamNews.GetNewsForApp_v2({
  appid: 440, // TypeScript knows this is required and should be a number
  count: 5, // TypeScript knows this is optional
});

Automated API Updates

This package includes an automated workflow that keeps Steam API types up to date:

  • Daily checks for Steam API changes
  • Automatic PR creation when updates are detected
  • Type regeneration and build verification

See .github/AUTOMATED_UPDATES.md for details.

Notes

  • The key parameter is automatically excluded from method signatures since it's provided when creating the client
  • Methods are named with their version suffix (e.g., GetAppList_v1, GetAppList_v2)
  • The API definition returned by Steam may vary based on your API key's permissions
  • Some Steam API endpoints may return 404 errors depending on the method or your API key's access level
  • BigInt parameters: Parameters typed as bigint (like Steam IDs) must use BigInt literals (76561199699144174n) or be converted from strings (BigInt('76561199699144174')) to prevent precision loss

License

ISC

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Make your changes
  4. Run npm run format to format your code
  5. Submit a pull request