# Coming from Railway

> Move services and attached resources incrementally

Railway treats each deployed service and attached resource as a platform unit. In Encore, the APIs, services, and infrastructure declared with the TypeScript or Go SDK form an [application model](/docs/application-model). Encore uses that model to run the application locally and determine what each environment needs.

You can migrate one service at a time. Railway and Encore may remain behind the same frontend or gateway while traffic is moved.

## How the concepts map

| Railway | Encore |
|---|---|
| Project and environment | Encore application and [environment](/docs/platform/deploy/environments) |
| Service | One or more Encore services; the boundary is defined in code |
| Deployment | A rollout of the Encore application |
| PostgreSQL template | SQL database |
| Redis template | Cache, when its API fits the workload, or an external Redis service |
| Variables and references | Secrets, code constants, or an external configuration service |
| Cron service | Cron job calling an Encore API endpoint |
| Volume | No direct primitive; use object storage, a database, or externally managed persistent storage |
| Public networking (Railway-provided domain) | Environment API URL or [custom domain](/docs/platform/integrations/custom-domains) |

These primitives are declared in application code using [TypeScript](/docs/ts) or [Go](/docs/go).

An Encore service is not a Railway deployment unit. Encore builds the service graph as one application and chooses the deployment layout from the environment configuration.

## Migrate services

Move an HTTP service by defining its routes as Encore API endpoints. Existing TypeScript or Go business logic can remain in place. For a larger server, first expose the existing router through a catch-all endpoint, then convert routes incrementally; see [Migrating an existing system](/docs/platform/migration/migrate-to-encore).

**Encore.ts:**

Railway worker services do not have a single equivalent. Model event-driven work with [Pub/Sub](/docs/ts/primitives/pubsub), scheduled work with cron jobs, or keep a continuously running worker outside Encore if its lifecycle requires one.

**Encore.go:**

Railway worker services do not have a single equivalent. Model event-driven work with [Pub/Sub](/docs/go/primitives/pubsub), scheduled work with cron jobs, or keep a continuously running worker outside Encore if its lifecycle requires one.

Railway build and start commands, health-check paths, replicas, and restart policies do not carry over directly. Encore builds from the application model, and deployment-specific compute settings belong in [infrastructure configuration](/docs/platform/infrastructure/configuration).

## Migrate data and configuration

Encore SQL databases use Postgres migrations stored with the application. A Railway PostgreSQL database cannot be imported directly into Encore Cloud. Create a target database and transfer its schema and data, accounting for extensions, roles, connection cutover, and downtime. A self-hosted deployment can map an Encore database declaration to an existing compatible Postgres server through its infra config.

For Redis, check which commands and data structures the application uses before choosing Encore caching. The cache primitive is not a general-purpose Redis connection. Unsupported uses can remain on Railway temporarily and be accessed with the normal client library.

Move sensitive Railway variables to Encore secrets and set a value for each environment. There is no general primitive for non-secret environment variables. Keep invariant values in code; use an external configuration service when values must change independently of a deployment.

**Encore.ts:**

Railway volumes are attached to a service and are not an Encore resource. Move shared files to [object storage](/docs/ts/primitives/object-storage), structured state to a database, or retain external storage. Do not copy a live volume without an application-specific consistency plan.

**Encore.go:**

Railway volumes are attached to a service and are not an Encore resource. Move shared files to [object storage](/docs/go/primitives/object-storage), structured state to a database, or retain external storage. Do not copy a live volume without an application-specific consistency plan.

## Deployments, domains, and cutover

Connecting GitHub lets branch pushes trigger Encore deployments; Pro plans can create [preview environments](/docs/platform/deploy/preview-environments) for pull requests. Railway configuration such as watch paths and per-service deployment triggers must be recreated using the Encore deployment workflow or your CI system.

Create and verify the Encore environment before changing DNS. Add the domain in Encore, update DNS as described in [Custom Domains](/docs/platform/integrations/custom-domains), and keep the Railway deployment available during verification. For a staged migration, route only selected paths or callers to Encore.

## Migration plan

1. Inventory Railway services, databases, variables, volumes, domains, and private-network connections.
2. Select one stateless HTTP service and move it to Encore without changing its external contract.
3. Replace Railway variable references with secrets or explicit external configuration.
4. Migrate stateful resources separately and test data compatibility.
5. Validate the service locally and in an Encore development or preview environment.
6. Shift traffic, monitor errors and traces, then remove the corresponding Railway service.

Railway-specific features without an Encore equivalent can remain external. Store their credentials as secrets and manage them through Railway until they are replaced.

For the concepts common to all hosted platforms, see [Coming from a PaaS](/docs/platform/migration/from-paas). Railway behavior referenced here is documented in its guides for [services](https://docs.railway.com/services), [variables](https://docs.railway.com/variables), [volumes](https://docs.railway.com/volumes), [PostgreSQL](https://docs.railway.com/databases/postgresql), and [cron jobs](https://docs.railway.com/cron-jobs).
