Skip to content

Deployment

Run Tyravel in production on Node.js 26+ (or Bun). Apps boot through src/main.tsserve() with graceful SIGTERM shutdown.

Before you deploy

Complete this checklist on every target:

bash
# 1. Production env
export NODE_ENV=production
export APP_ENV=production
export APP_DEBUG=false
export APP_URL=https://your-domain.example

# 2. Listen on all interfaces (required in containers)
export TYRAVEL_HOST=0.0.0.0
export TYRAVEL_PORT=${PORT:-3000}   # map platform PORT → TYRAVEL_PORT

# 3. Database — use Postgres or MySQL in production (not SQLite on ephemeral disks)
export DB_CONNECTION=postgres
# ... DB_HOST, DB_DATABASE, DB_USERNAME, DB_PASSWORD

# 4. Warm caches (run in CI release phase or container entrypoint)
tyravel migrate
tyravel route:cache
tyravel view:cache

With NODE_ENV=production, views default to compiled: true and requireCompiledCache: trueyou must run tyravel view:cache before boot or the app throws CompiledViewCacheMissError.

Keep @tyravel/cli available in the deploy environment for migrate, route:cache, and view:cache. Either install it as a production dependency or run those commands in a build/release step before pruning dev dependencies.

Process model

ProcessCommandNotes
Webtyravel startProduction server (no view watcher)
Queue workertyravel queue:workSeparate container/dyno when using queued mail, events, or broadcasts
Schedulertyravel schedule:runCron sidecar or platform scheduler hitting a protected route

Use tyravel serve for local development only — it enables TYRAVEL_VIEW_WATCH. New apps scaffold a deploy/ directory with Docker, Fly, and Railway manifests.

@tyravel/cli belongs in production dependencies so npx tyravel migrate, route:cache, and view:cache work inside containers (npm ci --omit=dev).

Platform guides

GuideBest for
DockerSelf-hosted, compose stacks, any container orchestrator
Fly.ioGlobal edge, managed Postgres + Redis
RailwayFast managed deploy, plugins for Postgres/Redis

Example manifests live in examples/hello-world/deploy/.

Environment variables

VariableProduction value
NODE_ENVproduction
APP_DEBUGfalse
APP_URLPublic HTTPS URL (signed links, mail)
TYRAVEL_HOST0.0.0.0
TYRAVEL_PORTPlatform PORT (Fly: 8080, Railway: injected)
SESSION_ENCRYPTtrue when using @tyravel/crypto
QUEUE_CONNECTIONdatabase or redis
BROADCAST_CONNECTIONwebsocket when using realtime (requires Redis)

See Configuration reference for the full config map.

Health checks

Scaffolded apps expose health routes when config/health.ts is enabled:

PathPurpose
/health/liveLiveness — process is running (no dependency probes)
/health/readyReadiness — database and optional Redis checks
/healthAlias for readiness (backward compatible)

Point load balancer readiness probes at /health/ready. Use /health/live only when you need a lightweight liveness signal during slow startup.

Released under the MIT License.