|Docs

railway dev

Run your Railway services locally using Docker Compose, with automatic environment variable injection and HTTPS support.

Note: This is an experimental feature. The API may change without notice.

Usage

railway dev [COMMAND] [OPTIONS]

Aliases

  • railway develop

Subcommands

SubcommandAliasesDescription
upstartStart services (default)
downstopStop services
cleanresetStop services and remove volumes/data
configureconfigConfigure local code services

Examples

Start local development

railway dev

Starts image-based services (databases, etc.) via Docker Compose and prompts you to configure code-based services.

Start with verbose output

railway dev --verbose

Stop services

railway dev down

Clean up (remove data)

railway dev clean

Configure Code services

railway dev configure

Interactively configure how your code services run locally (command, directory, port).

Options for

FlagDescription
-e, --environment <ENV>Environment to use
-o, --output <PATH>Output path for docker-compose.yml
--dry-runGenerate docker-compose.yml without starting
--no-httpsDisable HTTPS and pretty URLs
-v, --verboseShow verbose domain replacement info
--no-tuiDisable TUI, stream logs to stdout

Options for

FlagDescription
--service <SERVICE>Specific service to configure (by name)
--remove [SERVICE]Remove configuration for a service (optionally specify service name)

Configure examples

Configure a specific service:

railway dev configure --service backend

Remove configuration for all services:

railway dev configure --remove

Remove configuration for a specific service:

railway dev configure --remove backend

Requirements

  • Docker with Docker Compose
  • mkcert (optional, for HTTPS support)

How it works

  1. Fetches environment configuration from Railway
  2. Generates a docker-compose.yml for image-based services (databases, etc.)
  3. Starts containers with proper environment variables
  4. Optionally runs code services locally with injected environment variables
  5. Sets up a Caddy reverse proxy for HTTPS (if mkcert is available)