velho

Getting started

Install velho, gather your Twitch credentials, and wire up the modules that match your use case.

Prerequisites

Bun 1.3 or newer, a Twitch application with client ID & secret, and optionally refresh tokens for user-scoped operations.

Gather your Twitch credentials

Twitch issues the client_id, client_secret, and broadcaster_id values you will reference throughout this toolkit. Follow the official console steps so you have everything ready before coding:

  1. Open the Twitch Developer Console and register a new application (or reuse one you already manage).
  2. Provide an app name, select the target environment, and add a redirect URL you control. Save the configuration.
  3. From the app detail page, copy the Client ID, then click New Secret to generate a Client Secret. Store the secret securely because Twitch only shows it once.
  4. Look up the Broadcaster ID (aka broadcaster_id on Helix). You can:
    • Call /helix/users?login=<channel> with your app token and read the id field.
    • Run the Twitch CLI: twitch api get users -q login=<channel>.

Drop the values into your environment file so the SDK and your deployment platform can read them:

.env
TWITCH_CLIENT_ID=...
TWITCH_CLIENT_SECRET=...
TWITCH_BROADCASTER_ID=...

Include TWITCH_BROADCASTER_ID when you manage channel resources, subscribe to EventSub events, or call Helix endpoints that scope responses to a broadcaster.

Installation

Install with Bun:

bun add velho

Quick setup with the CLI tool

Get started instantly with the interactive OAuth setup:

# Set your Twitch credentials
export TWITCH_CLIENT_ID="your_client_id"
export TWITCH_CLIENT_SECRET="your_client_secret"

# Run the interactive setup
bunx velho-setup

This will automatically handle the OAuth flow and save credentials to your .env file.

Manual setup

Alternatively, create a .env file containing your Twitch credentials:

.env
TWITCH_CLIENT_ID=your_client_id
TWITCH_CLIENT_SECRET=your_client_secret
TWITCH_BROADCASTER_ID=your_broadcaster_id # optional for channel-scoped APIs

On this page