Skip to content

4. Realtime & deploy

Broadcast domain events to the browser and prepare for production.

WebSocket broadcasting

Since v0.13.0, Tyravel ships a native WebSocket hub (@tyravel/broadcasting-websocket) — no Socket.io or Pusher.

Follow the full Broadcasting & realtime guide for config, channel auth, Echo client setup, and nginx proxy notes.

Quick checklist:

  1. Scaffold with Redis: tyravel new my-app --redis
  2. Set BROADCAST_CONNECTION=websocket in .env
  3. Register WebSocketBroadcastServiceProvider in src/main.ts
  4. Define channels in routes/channels.ts (private channel prefixes ship in current scaffolds since v0.16)

examples/hello-world does not include broadcasting yet — use a --redis scaffold or the realtime Echo recipe for a minimal client.

Production checklist

TaskCommand / config
Route cachetyravel route:cache
View compile cachetyravel view:cache + config/views.ts compiled: true
Env validationPer-file schema in config/*.ts
Queue workertyravel queue:work under a process supervisor
Graceful shutdownSIGTERM handling is built into serve()

Deploy targets

Tyravel runs on any Node 26+ host (container, VM, bare metal). Standard Web APIs mean adapters stay thin — see serve() in @tyravel/core.

Platform walkthroughs

Copy-paste manifests live in examples/hello-world/deploy/.

GuideWhen to use
Deployment overviewShared checklist, env vars, process model
DockerSelf-hosted, compose stacks, any orchestrator
Fly.ioManaged Postgres + Redis at the edge
RailwayFast managed deploy with Postgres plugins

Minimum production boot:

bash
export NODE_ENV=production TYRAVEL_HOST=0.0.0.0 TYRAVEL_PORT=${PORT:-3000}
tyravel migrate && tyravel route:cache && tyravel view:cache
tyravel start

Run tyravel queue:work in a separate process when using the database queue.

Cookbook & reference

Released under the MIT License.