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
Authentication
OAuth 2.0 authorization code, client credentials, and refresh token flows.
Helix client
Typed REST wrapper with Zod validation and rate-limit awareness.
Chat client
Twitch IRC over WebSocket with typed events and reconnect.
EventSub
Webhook signature verification and a WebSocket gateway client.
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
fetchimplementations for observability, testing, or alternative runtimes. - Bun 1.3+ — uses Bun's native
fetch, Web Streams, and WebSocket support.