Dev iconDevSep 11, 2026 ~3 min source read

Deploy a Node + TypeScript Express API to Railway in ~15 minutes with a worker-friendly layout

A concise, step-by-step walkthrough that shows how to deploy a minimal Node/TypeScript service to Railway, set required build/start commands and environment variables, and plan a second service for background workers like BullMQ.

Deploy a Node/TypeScript API to Railway in 15 minutes (with a worker-friendly setup)

Share this story

Send the public story page.

Useful takeaways from this story.

Configure build and start commands in Railway settings: build with your TypeScript compiler, start the compiled dist output.

Store secrets as Railway environment variables (NODE_ENV, DATABASE_URL, JWT_SECRET, etc.). Never commit.env.

Add a second Railway service for background workers (same repo, different start command) and give it Redis access and memory limits.

# Quick overview This guide shows a practical path to get a Node + TypeScript Express API running on Railway fast, with a clear upgrade path to add a separate worker service for background jobs. It focuses on the minimal code, the Railway project setup, essential environment variables, and operational tips for small teams or solo projects.

# What you start with

package.json scripts should include at least:

  • "build": "tsc"
  • "start": "node dist/index.js"
  • "dev": "tsx src/index.ts" (local development convenience)

Railway will set PORT for you, so don't rely on a hardcoded port in production.

# Railway project setup

  1. If your repo is a monorepo, point Railway at the correct root directory.
  2. In the service settings, set the Build command to your build script (npm run build / pnpm / yarn) and the Start command to npm run start.

Watch the first deploy logs. The process will confirm the app is listening on the PORT Railway provides.

# Environment variables and secrets Add at least these environment variables in Railway service settings:

  • NODE_ENV=production
  • DATABASE_URL (if your app uses a database)
  • JWT_SECRET or other app secrets

Do not commit a.env file. If you paste secrets into a shared place, rotate them.

# Public URL & health check

# Adding a worker service (recommended for background jobs) When you need background processing (BullMQ, Redis-based queues):

  • Create a second Railway service in the same project that points to the same repo.
  • Use the same build step, but change the Start command to run your worker (for example, node dist/worker.js).
  • Provision Redis as a plugin/add-on or use an external Redis instance and share the connection URL via environment variables.
  • Set memory limits and a restart policy for the worker. Constrain concurrency so a burst of jobs won't OOM the process.

Separating web and worker avoids a stuck job taking down your HTTP service.

# Cost and operational mindset for solo/small teams Start with the smallest viable setup and watch the usage dashboard after 24 hours. Keep the web and worker services separate so failure domains are isolated. Set memory limits and restart policies before assuming you need to optimize code for performance.

# Wrap-up Ship a simple health check first. Deploy the web service, confirm the public URL responds, then add a worker service with its own start command and Redis. Keep secrets in Railway env vars and monitor the usage dashboard.

More context around this story.

Why we moved our Backstage platform from Yarn to pnpm
Dev iconDevSep 12, 2026

Why we moved our Backstage platform from Yarn to pnpm

What Git worktrees, parallel coding agents, and a cache pointing at the wrong directory taught us about the assumptions hiding inside node_modules . I’m a developer at bol, where we have been building and running our internal developer platform on Backstage for more than five years. After that much time, a Backstage pl

Redora 0.3.1 — Redis for NestJS
Dev iconDevAug 23, 2026

Redora 0.3.1 — Redis for NestJS

There are already good Redis tools for NestJS. Most of them mainly help you connect NestJS to Redis and use the Redis client. That's useful, but as a project grows, you often need to build more things around Redis yourself: caching, TTL, cache invalidation, locks, rate limiting, sessions, monitoring, and more. That's w

Loading more related stories...

Keep reading in the app

Open the app view to save this story, compare related coverage, and continue from the same source.

Open in app