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

@steamlab/steam-web

v0.0.1

Published

A Node.js library for interacting with steamcommunity.com, providing unofficial APIs.

Readme

steam-web

steam-web is a small Node.js client for Steam Community account workflows that do not have a convenient public API surface.

It focuses on JWT-based login, session reuse, inventory/profile helpers, and badge-page parsing for trading-card farming data.

Requirements

  • Node.js 22+

Installation

npm i @steamlab/steam-web

Features

  • Login with Steam web JWTs
  • Reuse an authenticated Steam web session across processes
  • HTTPS and SOCKS5 proxy support
  • Trading card farming detection from the badges page
  • Trading card inventory fetching
  • Avatar upload, alias-history clearing, privacy updates, and avatar-frame parsing

Usage

Login

import { SteamWeb } from "@steamlab/steam-web";

const token = "REFRESH_TOKEN or ACCESS_TOKEN";

const steamWeb = new SteamWeb();
const session = await steamWeb.login(token);

login() accepts either:

  • a refresh token, which finalizes a fresh Steam web session and stores the returned cookies
  • an access token, which skips the extra finalization step but may expire sooner

This package does not acquire Steam tokens for you. It is intended to be used with a separate Steam authentication client.

Reuse an existing session to skip login flow

import { SteamWeb, type SteamWebSession } from "@steamlab/steam-web";

const session: SteamWebSession = { ... };

const steamWeb = new SteamWeb();
steamWeb.setSession(session);

const inventory = await steamWeb.getCardsInventory();

setSession() rejects restored sessions whose steamLoginSecure.expires timestamp is already in the past. A value of 0 is still allowed for sessions whose cookie expiry is unknown, such as access-token-based sessions.

logout() only clears the in-memory session state held by the client instance.

Use a proxy

steam-web currently supports these proxy URL schemes:

  • https://
  • socks5://
import { SteamWeb } from "@steamlab/steam-web";

const steamWeb = new SteamWeb({
  proxyUrl: "socks5://user:password@proxy-host:1080",
});

Read farming data and profile helpers

const farmableGames = await steamWeb.getFarmableGames();
const avatarFrame = await steamWeb.getAvatarFrame();
const inventory = await steamWeb.getCardsInventory();

Update profile state

await steamWeb.changeAvatar("https://example.com/avatar.png");
await steamWeb.clearAliases();
await steamWeb.changePrivacy("friendsOnly");

Handle library errors

import { ERRORS, SteamWeb, SteamWebError } from "@steamlab/steam-web";

try {
  await new SteamWeb().login(token);
} catch (error) {
  if (error instanceof SteamWebError && error.message === ERRORS.TOKEN_EXPIRED) {
    // refresh or reacquire the token
  }
}

API

new SteamWeb(options?: {
  proxyUrl?: string | URL;
});

login(token: string): Promise<SteamWebSession>;
logout(): Promise<void>;
setSession(session: SteamWebSession): void;
getFarmableGames(): Promise<FarmableGame[]>;
getAvatarFrame(): Promise<string | null>;
getCardsInventory(): Promise<Item[]>;
changeAvatar(avatarURL: string): Promise<string>;
clearAliases(): Promise<void>;
changePrivacy(privacy: "public" | "friendsOnly" | "private"): Promise<void>;

setSession() throws SteamWebError(ERRORS.TOKEN_EXPIRED) when the restored steamLoginSecure.expires value is non-zero and already expired.

Also exported:

  • SteamWebError for library-specific failures
  • ERRORS for the library's standard error message constants
  • SteamWebSession, Session, Options, FarmableGame, Item, and ProfilePrivacy for public TypeScript types

Development

  • npm run build builds the distributable package with tsdown.
  • npm run check runs Biome.
  • npm run test runs the unit test suite.
  • npm run test:coverage runs the unit suite with coverage.
  • npm run test:fetch runs the live proxy fetch integration tests and requires Docker.
  • npm run test:live runs the authenticated Steam integration tests and reads STEAM_WEB_REFRESH_TOKEN from tests/.env (see tests/.env.example).