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

@rstreamlabs/rstream

v3.1.0

Published

JS/TS SDK for the rstream Control plane API and shared types.

Readme

@rstreamlabs/rstream

Managed Control plane SDK for rstream JavaScript and TypeScript integrations.

Use this package when code needs to call the hosted rstream API at https://rstream.io: account context, managed tunnel project discovery, project endpoint resolution, and managed TURN credential issuance. It does not open the tunnel runtime protocol itself.

For Engine HTTP API operations, use @rstreamlabs/tunnels. For Node.js tunnel creation and private dialing, use @rstreamlabs/runtime.

Managed tunnel projects also expose durable lifecycle events through the Control plane. This is the right surface when an integration needs to reconcile resource creation and deletion after the fact:

const events = await client.tunnels.projects.listEvents(projectId, {
  eventType: "tunnel.created",
  timeline: "24h",
});

Control plane webhook management is a separate surface. Use it to create destinations, rotate signing secrets, and inspect delivery attempts:

const webhook = await client.tunnels.projects.createWebhook(projectId, {
  name: "Lifecycle sink",
  events: ["tunnel.created", "tunnel.deleted"],
  config: { url: "https://example.com/rstream/webhook" },
});

console.log(webhook.signingSecret);

Webhook endpoint URLs must use HTTPS and must not contain credentials. Delivery history is intentionally separate from project events: events describe what happened in the project; deliveries describe one webhook endpoint's attempts, HTTP status codes, responses, and retry state.

Install

npm install @rstreamlabs/rstream

Authentication

The client accepts either a bearer token or application credentials.

import { RstreamClient } from "@rstreamlabs/rstream";

const client = new RstreamClient({
  credentials: { token: process.env.RSTREAM_AUTHENTICATION_TOKEN! },
});

Application credentials are signed locally into a short-lived app token before the Control plane request is sent:

import { RstreamClient } from "@rstreamlabs/rstream";

const client = new RstreamClient({
  credentials: {
    clientId: process.env.RSTREAM_CLIENT_ID!,
    clientSecret: process.env.RSTREAM_CLIENT_SECRET!,
  },
});

If credentials are not passed explicitly, the client reads RSTREAM_AUTHENTICATION_TOKEN from the process environment. RSTREAM_API_URL can override the default hosted API URL.

Account Context

const whoami = await client.whoami();

console.log(whoami.id);
console.log(whoami.email);

whoami() returns the authenticated user context for the configured token or application credentials.

Managed Tunnel Projects

List managed tunnel projects:

const projects = await client.tunnels.projects.list({
  pageSize: 20,
  q: "prod",
});

for (const project of projects.projects) {
  console.log(project.endpoint, project.plan);
}

Resolve a project endpoint when an integration stores stable project slugs instead of internal IDs:

const project =
  await client.tunnels.projects.resolveByEndpoint("project-endpoint");

console.log(project.id);
console.log(project.url);

Managed TURN Credentials

Managed TURN issuance is exposed through the Control plane API.

const turn = await client.tunnels.projects.createTurnCredentialsByEndpoint(
  "project-endpoint",
  { ttlSeconds: 600 },
);

console.log(turn.urls);

ttlSeconds is optional and must be an integer between 1 and 3600. The managed TURN runtime rejects usernames whose remaining lifetime is greater than one hour.

Use @rstreamlabs/tunnels when you need local TURN derivation from PAT or application credentials without calling the issuance endpoint.

Low-Level Requests

For routes that are available on the hosted API but not wrapped yet, use request() with a relative absolute API path:

const payload = await client.request<unknown>("/api/whoami", {
  method: "GET",
});

The client prevents absolute or cross-origin request paths from being used accidentally.

Environment Variables

| Variable | Purpose | | ------------------------------ | --------------------------------------------------------------- | | RSTREAM_API_URL | Control plane API URL. Defaults to https://rstream.io. | | RSTREAM_AUTHENTICATION_TOKEN | Bearer token used when credentials are not provided explicitly. |

Application credentials should normally be passed explicitly from backend configuration rather than read from ambient process state.

Development

npm --workspace @rstreamlabs/rstream run type-check
npm --workspace @rstreamlabs/rstream run lint
npm --workspace @rstreamlabs/rstream run build