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

twitchgate

v1.1.7

Published

A REST proxy that silently handles authentication with the Twitch Kraken and Helix APIs.

Readme

TwitchGate

TwitchGate is a proxy to the Twitch services. It can authenticate and proxy requests for Kraken (v5) or Helix (New Twitch API). It also proxies Twitch WS connections with authentication silently handled, including PubSub and IRC/WS.

This is useful if you create and maintain a lot of apps for a single user/channel and need a central place to manage an OAuth token so you don't have to set up code and a Twitch app for every application you make.

This is designed to be ran in a local network that is not accessible to the Internet. If your apps are hosted on separate servers, consider setting up a VPN between them to use this gate.

Getting started

Clone this repository and run yarn or npm install to install the necessary dependencies.

Configuration

Rename config.example.json to config.json and then add the following fields:

  • Your Twitch App's Client ID
  • Your Twitch App's Client Secret
  • Leave access_token and refresh_token blank
  • The Redirect URI for the app which is the domain and port followed by /gate/auth/return
  • state_code : A long random string to prevent other people authorising onto your gate accidentally (OPTIONAL - Leave empty to disable)
  • Scopes, try and make this as broad as you need for all your apps, but not too much.

Starting the proxy

Run node index

The app will be hosted at your specified host and port in the config. The OAuth app will be hosted at port + 1.

Setup

Whilst logged in with the channel/user you wish to add to TwitchGate, head to /gate/auth (including the state as a query param if you have set this in the config).

Authorise on the Twitch OAuth screen, and you'll be redirected back to the gate which should show a success message.

Repeat with as many channels/users as you need.

Usage

REST APIs

Replace https://api.twitch.tv with your Twitch Gate URL. That's it!

e.g. https://api.twitch.tv/helix/streams => http://gate.local:2571/helix/streams

You must specify the Twitch user you wish to authenticate as by including a Basic Authorization header with the request, with the Twitch ID as the basic auth username.

If omitted, Gate will authenticate as the first Twitch user added during Setup.

IRC/WS

Connect to /chat with a WS client. Like the REST APIs, pass the Twitch ID of the user you want to connect as in the username of a Basic Authorization header with the connection request.

Gate will send a {"type":"connect", "channel_id": "....."} JSON payload before it connects to Twitch.

Gate will send a {"type":"handover"} JSON payload when it has sent IRC credentials to Twitch. After this, continue as normal with the IRC/WS protocol.

PubSub

Connect to /pubsub with a WS client. Gate will send a {"type":"connect", "channel_id": "....."} JSON payload before it connects to PubSub.

Gate will send a {"type":"handover"} JSON payload when it has connected to PubSub. After this, continue as normal with the PubSub protocol.

When subscribing to privileged topics, an auth_token field is required as per the PubSub protocol.

By entering !CHANNEL_TOKEN.000000! in this field, where 000000 is the Twitch ID of the channel you want to authenticate as, TwitchGate will replace this with a valid token for that channel.

This is different to the REST and IRC method since the Twitch PubSub endpoint is channel-agnostic.