Skip to content

eric-wien/jetstream-relay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jetstream-relay

Connects to the Bluesky Jetstream WebSocket firehose and republishes post-create events to a Redis Pub/Sub channel. This allows multiple downstream consumers to subscribe to the Redis channel independently, without each needing its own Jetstream connection.

How it works

  1. Opens a WebSocket connection to one of the Jetstream endpoints (US-East / US-West, with automatic failover across four servers).
  2. Filters for app.bsky.feed.post events and validates them with Zod via @vinerima/jetstream-types.
  3. Publishes each validated post-create event as JSON to a configurable Redis Pub/Sub channel.

Prerequisites

  • Node.js (v18+)
  • A running Redis instance

Configuration

Variable Default Description
REDIS_URL redis://localhost:6379 Redis connection string
REDIS_CHANNEL jetstream:posts Pub/Sub channel name

Running the relay

1. Install dependencies

pnpm install

2. Start Redis

The relay requires a running Redis instance. If you don't have one, install and start it:

# macOS (Homebrew)
brew install redis
brew services start redis

# or run in the foreground
redis-server
# Docker
docker run -d --name redis -p 6379:6379 redis:7-alpine

To use a remote or non-default Redis instance, set REDIS_URL:

export REDIS_URL=redis://your-host:6379

3. Start the relay

# development
pnpm start

# production
pnpm build
node dist/index.js

You can verify events are flowing by subscribing to the channel in a separate terminal:

redis-cli SUBSCRIBE jetstream:posts

Dependencies

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors