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 🙏

© 2026 – Pkg Stats / Ryan Hefner

steam-typescript

v1.0.0

Published

Type-safe Steam Web API SDK with automatic API key management

Readme

steam-typescript

A type-safe TypeScript SDK for the Steam Web API with automatic API key management, built with OpenAPI and Zod validation.

Features

  • 🔒 Type-safe - Full TypeScript support with generated types
  • Validated - Request and response validation with Zod schemas
  • 🔑 Auto API Key - Automatically reads STEAM_API_KEY from .env
  • 🚀 Modern - ESM-first, built on native fetch
  • 📦 Zero config - Works out of the box

Installation

npm install steam-typescript zod
# or
yarn add steam-typescript zod
# or
bun add steam-typescript zod

Quick Start

1. Get your Steam API Key

Get your API key from Steam Web API Key

2. Set up environment variable

Create a .env file in your project root:

STEAM_API_KEY=your_api_key_here

3. Use the SDK

import { createSteamClient, getISteamUserGetPlayerSummariesV0002 } from 'steam-typescript';

// Create client - automatically uses STEAM_API_KEY from .env
const client = createSteamClient();

// Fetch player summaries
const result = await getISteamUserGetPlayerSummariesV0002({
  client,
  query: {
    steamids: '76561197960435530'
  }
});

if (result.data) {
  console.log(result.data);
}

Usage

Automatic API Key (Recommended)

The SDK automatically reads STEAM_API_KEY from your .env file:

import { createSteamClient, getISteamUserGetPlayerSummariesV0002 } from 'steam-typescript';

const client = createSteamClient();

const result = await getISteamUserGetPlayerSummariesV0002({
  client,
  query: {
    steamids: '76561197960435530'
  }
});

Manual API Key

You can also set the API key programmatically:

import { createSteamClient, setApiKey } from 'steam-typescript';

// Set API key before creating client
setApiKey('YOUR_STEAM_API_KEY');

const client = createSteamClient();

Using the default client

For simple use cases, you can use the SDK functions without creating a client:

import { getISteamNewsGetNewsForAppV0002 } from 'steam-typescript';
import { setApiKey } from 'steam-typescript';

// Set your API key
setApiKey('YOUR_STEAM_API_KEY');

// Use SDK functions directly
const news = await getISteamNewsGetNewsForAppV0002({
  query: {
    appid: 440, // Team Fortress 2
    count: 5
  }
});

Available Endpoints

News

  • getISteamNewsGetNewsForAppV0002 - Get latest news for a game

Users

  • getISteamUserGetPlayerSummariesV0002 - Get public Steam profile data
  • getISteamUserGetFriendListV0001 - Get friend list for a Steam user

Achievements & Stats

  • getISteamUserStatsGetGlobalAchievementPercentagesForAppV0002 - Get global achievement percentages
  • getISteamUserStatsGetPlayerAchievementsV0001 - Get achievements for a user in a game
  • getISteamUserStatsGetUserStatsForGameV0002 - Get user stats + achievements

Player Service

  • getIPlayerServiceGetOwnedGamesV0001 - Get owned games (public profiles only)
  • getIPlayerServiceGetRecentlyPlayedGamesV0001 - Get recently played games

Examples

Get Player Profile

import { createSteamClient, getISteamUserGetPlayerSummariesV0002 } from 'steam-typescript';

const client = createSteamClient();

const result = await getISteamUserGetPlayerSummariesV0002({
  client,
  query: {
    steamids: '76561197960435530'
  }
});

if (result.data) {
  const player = result.data.response?.players?.[0];
  console.log(`Player: ${player?.personaname}`);
}

Get Owned Games

import { createSteamClient, getIPlayerServiceGetOwnedGamesV0001 } from 'steam-typescript';

const client = createSteamClient();

const result = await getIPlayerServiceGetOwnedGamesV0001({
  client,
  query: {
    steamid: '76561197960435530',
    include_appinfo: true
  }
});

if (result.data) {
  const games = result.data.response?.games ?? [];
  console.log(`Found ${games.length} games`);
}

Get Game News

import { createSteamClient, getISteamNewsGetNewsForAppV0002 } from 'steam-typescript';

const client = createSteamClient();

const result = await getISteamNewsGetNewsForAppV0002({
  client,
  query: {
    appid: 440, // Team Fortress 2
    count: 5,
    maxlength: 300
  }
});

if (result.data) {
  const news = result.data.appnews?.newsitems ?? [];
  for (const item of news) {
    console.log(`${item.title}: ${item.url}`);
  }
}

Error Handling

The SDK returns both data and error, following the throwOnError pattern:

const result = await getISteamUserGetPlayerSummariesV0002({
  client,
  query: {
    steamids: 'invalid'
  }
});

if (result.error) {
  console.error('API Error:', result.error);
} else {
  console.log('Success:', result.data);
}

To throw errors instead:

const result = await getISteamUserGetPlayerSummariesV0002({
  client,
  throwOnError: true, // Will throw on error
  query: {
    steamids: '76561197960435530'
  }
});

// result.data is guaranteed to exist here
console.log(result.data);

TypeScript Support

All API responses are fully typed:

import type { GetISteamUserGetPlayerSummariesV0002Responses } from 'steam-typescript';

const result = await getISteamUserGetPlayerSummariesV0002({
  client,
  query: {
    steamids: '76561197960435530'
  }
});

// TypeScript knows the structure
const players = result.data?.response?.players;

Environment Variables

| Variable | Required | Description | |----------|----------|-------------| | STEAM_API_KEY | Yes | Your Steam Web API key from steamcommunity.com/dev/apikey |

License

MIT

Contributing

Contributions are welcome! This SDK is generated from an OpenAPI specification. To modify or extend:

  1. Update steam-web-api-openapi.yaml
  2. Run bun openapi-ts to regenerate the SDK
  3. Test your changes

Links