velho

Introduction

velho is a TypeScript-first toolkit for authenticating with Twitch, calling Helix APIs, subscribing to EventSub, and chatting over WebSocket.

velho wraps authentication, Helix REST, EventSub, and chat utilities into one cohesive toolkit. Every module is exported on its own, so you can start small and add capabilities over time.

Quick start

The snippet below authenticates with Twitch and fetches the first stream using the Helix client. The auth helper automatically caches and refreshes tokens.

import { HelixClient, TwitchAuth } from "velho";

const auth = new TwitchAuth({
  clientId: process.env.TWITCH_CLIENT_ID!,
  clientSecret: process.env.TWITCH_CLIENT_SECRET!,
});

const helix = new HelixClient({
  clientId: process.env.TWITCH_CLIENT_ID!,
  auth,
});

const { data } = await helix.get("/streams", { query: { first: 1 } });
console.log(data);

By default, Helix requests use an app access token. Pass token to override the strategy for a specific request.

Modules

Design & DX highlights

  • Type safety everywhere — validate responses at runtime while benefiting from rich TypeScript definitions.
  • Dual builds — ESM and CJS bundles with source maps and types ship by default.
  • Extensible fetch — swap in custom fetch implementations for observability, testing, or alternative runtimes.
  • Bun 1.3+ — uses Bun's native fetch, Web Streams, and WebSocket support.

On this page