Migration guides/Railway to Modelence

How to Migrate from Railway to Modelence

Updated November 2026

Modelence runs your app and its databases on AWS in the region you choose. Moving from Railway mostly means describing your project in one config file, which your coding agent writes for you, while you sign in, paste your secrets and switch the domain.

If you are moving after Railway's October security incident, rotate the keys you kept in Railway variables before you copy anything over, so the new deployment starts with fresh values. The steps below include that.

If you would rather run AWS yourself, our guide to moving from Railway to AWS covers ECS, RDS and the other services it takes.

Paste this into your coding agent to start

Where each part of your Railway project goes

A Railway project’s services, databases and variables become entries in one config file.

On RailwayMoving it to Modelence
ServicesEach service in the project becomes an entry in modelence.config.json, and they deploy together. A service builds with the commands in the file, or from its Dockerfile if it has one.
Config as codeYour coding agent copies the build and start commands from railway.json or railway.toml into modelence.config.json, or from the service settings if the project has neither.
VariablesThe config file declares the variables the app needs, and the deploy asks you for any value that is missing. Secrets are stored encrypted and stay hidden in the dashboard.
Reference variablesWhere Railway fills in ${{Postgres.DATABASE_URL}}, the variable in modelence.config.json takes its value from a database declared in the same file.
PostgresCreated in your app’s region on the first deploy, with plans from 1 GB to 16 GB of RAM. The data moves over with logical replication while the Railway app keeps serving.
RedisCreated in your app’s region on the first deploy, with plans from 250 MB to 5 GB. A Redis that only holds a cache can start empty.
MongoDBIts connection string reaches the app as MONGODB_URI, and the data moves with mongodump and mongorestore.
MySQLKeep it where it runs and add its connection string to the app as a secret.
VolumesFiles the app writes move to a bucket such as Amazon S3. railway volume files download copies them off the volume for the upload.
Cron jobsRailway starts a service on a schedule and expects it to exit. On Modelence the job runs on a timer inside a running service.
Private networkingServices reach their databases over TLS through the connection strings in their variables, so there is no internal hostname to set up.
EnvironmentsEach app has a production environment and sandbox environments for staging or testing, each with its own variables and databases.
RegionsPick any of 17 AWS regions across the Americas, Europe and Asia Pacific, and the app and its databases are created there together.
Custom domainsAdd your domain to the app and update the DNS record. Domains are unlimited on paid plans, with TLS certificates issued for you.

Moving your app

Your coding agent does most of the setup, and you step in to sign in and add secrets.

  1. 1

    Give your coding agent the deploy prompt

    Open the project in your coding agent and paste the prompt below. The agent reads the Modelence deploy guide, works out how the app builds from its Dockerfile, railway.json or package.json, and goes through the next steps with you.

    Paste this into your coding agent

  2. 2

    Rotate your keys and list your variables

    Moving is a good time to rotate the API keys and passwords stored in your variables, so issue new ones and give Modelence the new values. To see which variables the service uses, print them with the Railway CLI:

    railway variables --kv --service api --environment production

    Sealed variables don't show up there, so check the dashboard for those. You can skip the ones Railway sets itself, like those starting with RAILWAY_, and the database connection strings, since the new databases come with their own.

  3. 3

    The agent writes the config file and deploys

    It declares the services, their databases and the variables they need in modelence.config.json, checks that the build works locally and runs the deploy. Your browser opens so you can sign in, pick the app and environment, and paste in the values the deploy asks for.

  4. 4

    Replicate your data

    Postgres copies the data with logical replication while your Railway app keeps serving. The new database pulls changes from the Railway one, so turn on public access for the Railway database for the length of the move, then switch it to logical replication and restart it from the Railway dashboard:

    psql "$DATABASE_PUBLIC_URL" -c "ALTER SYSTEM SET wal_level = logical;"

    After the restart, copy the schema, publish the tables on Railway and subscribe to them from the new database:

    pg_dump "$DATABASE_PUBLIC_URL" --schema-only --no-owner | psql "$NEW_DATABASE_URL"
    
    # Postgres rejects updates and deletes on a published table that has no
    # primary key or other replica identity, so give those tables one.
    psql -X "$DATABASE_PUBLIC_URL" -At -c "SELECT format('ALTER TABLE %I.%I REPLICA IDENTITY FULL;', n.nspname, c.relname)
      FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace
      WHERE c.relkind = 'r' AND n.nspname NOT IN ('pg_catalog', 'information_schema')
        AND NOT EXISTS (SELECT 1 FROM pg_index i WHERE i.indrelid = c.oid AND i.indisprimary);" \
      | psql "$DATABASE_PUBLIC_URL"
    
    psql "$DATABASE_PUBLIC_URL" -c "CREATE PUBLICATION modelence FOR ALL TABLES;"
    psql "$NEW_DATABASE_URL" -c "CREATE SUBSCRIPTION modelence
      CONNECTION '$DATABASE_PUBLIC_URL' PUBLICATION modelence;"

    The subscription copies the existing rows, then applies each new write as it happens. Schema changes don't replicate, so hold off on migrations until the switch. MongoDB moves with mongodump and mongorestore, and a Redis that only holds a cache can start empty.

  5. 5

    Switch over and move your domain

    Stop the Railway service so nothing else writes to the old database. The commands below wait until the new database has every write, then copy the sequence values, which replication doesn't carry, and end the subscription:

    # Wait until the new database has confirmed every write Railway made
    until [ "$(psql -X "$DATABASE_PUBLIC_URL" -At -c "SELECT pg_wal_lsn_diff(pg_current_wal_lsn(), flush_lsn)
      FROM pg_stat_replication WHERE application_name = 'modelence';")" = "0" ]; do sleep 2; done
    
    psql -X "$DATABASE_PUBLIC_URL" -At -c "SELECT format('SELECT setval(%L, %s, true);',
        format('%I.%I', schemaname, sequencename), last_value)
      FROM pg_sequences WHERE last_value IS NOT NULL;" | psql "$NEW_DATABASE_URL"
    
    psql "$NEW_DATABASE_URL" -c "DROP SUBSCRIPTION modelence;"

    Point the Railway service's DATABASE_URL at the new database and deploy it again, so it keeps serving the same data while DNS moves. Then add your domain to the Modelence app and update the DNS record. Once traffic has moved over, turn off public access on the Railway database and delete the service along with its databases and any tokens it held.

On AWS, in the region you choose

Your app and its databases run together in the AWS region you pick, with failover and encryption set up from the first deploy.

Starter+Pro+

Americas

  • Oregonus-west-2
  • N. Californiaus-west-1
  • Ohious-east-2
  • N. Virginiaus-east-1
  • Montrealca-central-1
  • São Paulosa-east-1

Europe

  • Irelandeu-west-1
  • Londoneu-west-2
  • Pariseu-west-3
  • Frankfurteu-central-1
  • Stockholmeu-north-1

Asia Pacific

  • Mumbaiap-south-1
  • Singaporeap-southeast-1
  • Seoulap-northeast-2
  • Osakaap-northeast-3
  • Tokyoap-northeast-1
  • Sydneyap-southeast-2

See how Modelence runs your app on AWS

Frequently asked questions

Does Modelence run on AWS?

Yes. Every app runs on AWS Fargate across two availability zones, in the region you pick on the first deploy, and its databases are created in the same region. You can choose from 17 AWS regions across the Americas, Europe and Asia Pacific.

What happens to files on my Railway volume?

Move them to an object storage bucket such as Amazon S3 and have the app read and write them there. Copy them from the volume to the bucket before you switch the domain.

Which languages and frameworks can I move from Railway?

Any service that runs in a container can move, whether it is written in TypeScript, Python, Go or something else. Services with a Dockerfile build from it, and the rest build with the commands in the config file.

Can Claude Code or Cursor do the migration for me?

Yes. Open the Railway project in Claude Code, Cursor, Codex or another coding agent and paste the prompt from the first step. The agent reads the Modelence deploy instructions, writes the config file from your Railway services and variables, and asks you for the secrets it needs. Copying the data and switching the domain follow the steps above.

My Railway project has an API and a worker. How does that move?

Both go into the same config file as separate services, deploy together and use the same databases. The worker reads its connection strings from variables just like the API does.

How does the cost compare?

Both include the plan price as usage and bill for what your app runs above it, with no charge per seat. Railway meters memory and CPU as the app uses them, while Modelence bills each instance and database by the hour based on its size, so the bill stays at the plan price unless you run more than it covers. Modelence Starter is $20 a month with $20 of usage included.

Are my databases backed up?

Yes. Managed databases are backed up automatically with nothing to turn on, and the Modelence team restores a backup for you when you ask. Their connection strings are in your app’s variables, so you can also take your own dump with the standard tools at any time.

Will my app go down during the move?

The Railway app keeps serving while the data replicates, however large the database is. The only pause is at the switch, for about as long as one Railway deploy, and the app answers on your domain throughout.

Move your app off Railway

Start on the Free plan and keep Railway running until you switch the domain.

Or paste this into your coding agent