Deploy Centrifugo

Centrifugo 6.9 real-time WebSocket/SSE messaging server with Redis engine.

Deploy Centrifugo

Just deployed

Just deployed

/data

Deploy and Host Centrifugo on Railway

Centrifugo is an open-source, scalable real-time messaging server. Browser and mobile clients subscribe to channels over WebSocket, SSE or HTTP streaming, and your backend publishes to them through a simple HTTP API. You can use it for chat, live notifications, dashboards, multiplayer features and streaming AI responses, with any backend language.

About Hosting Centrifugo

This template deploys Centrifugo v6.9.6 with a Railway Redis database as its engine. Because the engine is Redis, channel history survives restarts and you can run several Centrifugo replicas behind Railway's load balancer. Clients connect to the public domain at /connection/websocket using a JWT that your backend signs with the generated HMAC secret. Your backend publishes over the private network with the generated API key. The admin web UI is enabled on the public domain and protected by a generated password. Centrifugo is stateless and light, so the Hobby plan is enough. Before going to production, set the allowed origins to your frontend's domain.

Common Use Cases

  • Live chat, comments and notifications for web and mobile apps
  • Real-time dashboards and activity feeds pushed from any backend (Node.js, Python, Go, PHP, Ruby, and others)
  • Streaming LLM responses or job progress to many connected users

Dependencies for Centrifugo Hosting

  • centrifugo/centrifugo:v6.9.6 (official image)
  • Railway Redis (redis:8.2) with a volume, used as the Centrifugo engine
  • A backend that signs connection JWTs and calls the Centrifugo HTTP API

Deployment Dependencies

Implementation Details

ServiceImageNetworkingStorage
centrifugocentrifugo/centrifugo:v6.9.6public domain on port 8000; private APInone
RedisRailway Redis 8.2private onlyvolume

Useful variables to reference from your backend service:

CENTRIFUGO_API_URL=${{centrifugo.CENTRIFUGO_API_URL}}
CENTRIFUGO_API_KEY=${{centrifugo.CENTRIFUGO_HTTP_API_KEY}}
CENTRIFUGO_TOKEN_SECRET=${{centrifugo.CENTRIFUGO_CLIENT_TOKEN_HMAC_SECRET_KEY}}
CENTRIFUGO_WEBSOCKET_URL=${{centrifugo.CENTRIFUGO_WEBSOCKET_URL}}

Publish from your backend:

curl -X POST "$CENTRIFUGO_API_URL/publish" -H "X-API-Key: $CENTRIFUGO_API_KEY" \
  -d '{"channel": "news", "data": {"text": "hello"}}'

Connect from the browser with centrifuge-js, using an HS256 JWT (with sub set to the user ID) signed by your backend with CENTRIFUGO_TOKEN_SECRET:

const client = new Centrifuge(CENTRIFUGO_WEBSOCKET_URL, { token });
client.newSubscription("news").on("publication", (ctx) => console.log(ctx.data)).subscribe();
client.connect();
VariableDefaultPurpose
CENTRIFUGO_CLIENT_TOKEN_HMAC_SECRET_KEYgenerated secretVerifies client connection JWTs
CENTRIFUGO_HTTP_API_KEYgenerated secretRequired for the server API
CENTRIFUGO_ADMIN_PASSWORDgenerated secretAdmin web UI login at the public domain
CENTRIFUGO_CLIENT_ALLOWED_ORIGINS*Set to your frontend origin(s), space-separated, for production
CENTRIFUGO_CHANNEL_WITHOUT_NAMESPACE_*subscribe allowed for authenticated clients, history of 100 messages for 5 minutes, recovery onDefault channel behaviour

Notes:

  • Anonymous connections are not allowed. Every client needs a valid JWT, and clients cannot publish directly (only your backend, through the API).
  • The allowed origins default to * so the template works on first deploy. Because connections are authenticated with JWTs rather than cookies, this is lower risk, but restrict it to your domains in production.
  • Add channel namespaces, presence, or subscription tokens with more CENTRIFUGO_* environment variables. Run centrifugo defaultenv in the image to list them all.
  • To disable the admin UI, set CENTRIFUGO_ADMIN_ENABLED=false.

This is a community-maintained deployment package and does not imply affiliation with or endorsement by the Centrifugo project.

Why Deploy Centrifugo on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Centrifugo on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
smoothmq
A drop-in replacement for AWS SQS

poundifdef
7
View Template
Kafka UI
Kafbat UI — Open-source web UI to monitor and manage Apache Kafka clusters

codestorm
0
View Template
NEW
NATS + JetStream
An open source messaging system that promises at-most-once delivery.

Brayan Castaneda
1