Deploy Centrifugo
Centrifugo 6.9 real-time WebSocket/SSE messaging server with Redis engine.
centrifugo
Just deployed
Redis
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
| Service | Image | Networking | Storage |
|---|---|---|---|
| centrifugo | centrifugo/centrifugo:v6.9.6 | public domain on port 8000; private API | none |
| Redis | Railway Redis 8.2 | private only | volume |
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();
| Variable | Default | Purpose |
|---|---|---|
CENTRIFUGO_CLIENT_TOKEN_HMAC_SECRET_KEY | generated secret | Verifies client connection JWTs |
CENTRIFUGO_HTTP_API_KEY | generated secret | Required for the server API |
CENTRIFUGO_ADMIN_PASSWORD | generated secret | Admin 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 on | Default 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. Runcentrifugo defaultenvin 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
centrifugo
centrifugo/centrifugo:v6.9.6Redis
redis:8.2