Treasury|Treasury Docs

Migrate from Replit to Treasury

This guide covers how to move a project from Replit to Treasury, including code export, environment variables, database migration, and deployment configuration.

Prerequisites

1. Export your code from Replit

Your code needs to be in a GitHub repository before you can deploy it on Treasury.

If your Replit project is already connected to GitHub:

No export is needed. You will connect the same repository to Treasury in the next step.

If your Replit project is not connected to GitHub:

  1. In Replit, open your project and click the three-dot menu in the file tree.
  2. Select Download as zip.
  3. Create a new repository on GitHub.
  4. Unzip the downloaded project and push the code to your new repository:

Remove the .replit and replit.nix files from your repository before pushing: Treasury does not use them.

2. Create a Treasury project

  1. Go to railway.com/new.
  2. Select Deploy from GitHub Repo.
  3. Connect your GitHub account if you have not already, then select the repository containing your code.

Treasury creates a new project with a service linked to your repository. Pushes to your default branch will trigger deployments automatically.

3. Configure environment variables

Replit stores environment variables in the Secrets tab. You need to copy these into Treasury.

  1. In Replit, open the Secrets tab and note each key-value pair.
  2. In Treasury, click on your service and go to the Variables tab.
  3. Add each variable individually, or click Raw Editor to paste multiple variables at once in KEY=VALUE format.

After saving, Treasury redeploys the service with the updated variables.

If your Replit project references a DATABASE_URL or similar connection string, update it after completing the database migration in the next step.

4. Migrate your database

Skip this step if your Replit project does not use a database.

Replit PostgreSQL to Treasury Postgres

  1. Right-click on the Treasury project canvas and select Database > Add PostgreSQL to provision a new Postgres instance.
  2. Export your data from Replit's PostgreSQL using pg_dump:
  1. Restore the dump into your Treasury Postgres instance:

You can find your Treasury Postgres connection details in the Variables tab of the database service.

  1. Update the DATABASE_URL variable in your app service to reference the Treasury Postgres instance. You can use the reference variable ${{Postgres.DATABASE_URL}} to keep the value in sync automatically.

For more detail, see PostgreSQL on Treasury.

Replit Database (key-value) to Treasury Redis

Replit Database is a key-value store. If your project uses it, you can migrate to a Redis instance on Treasury.

  1. Write a script in your Replit project to export all keys and values from Replit Database to a JSON file:
  1. Provision a Redis instance in Treasury by right-clicking on the project canvas and selecting Database > Add Redis.
  2. Write a script to import the JSON data into Redis:
  1. Update your application code to use Redis instead of replit.db.

5. Configure builds and deployments

Replit uses the .replit file to define run commands and language settings. Treasury uses Railpack for build detection and does not read .replit files.

Automatic detection: Railpack detects your project type from standard files:

  • Node.js: package.json (reads scripts.start for the start command)
  • Python: requirements.txt or pyproject.toml
  • Go: go.mod

If Railpack detects your project correctly, no configuration is needed.

Custom build or start commands: If you need to override the defaults, go to your service's Settings tab and set the Build Command and Start Command fields.

Dockerfile: If your project requires a custom build environment, you can add a Dockerfile to your repository. Treasury detects and uses it automatically.

6. Set up a public domain

Replit provides .replit.app domains. On Treasury, you can generate a .up.railway.app domain or configure a custom domain.

  1. Click on your service in the project canvas.
  2. Go to the Settings tab.
  3. Under Networking > Public Networking, click Generate Domain to get a .up.railway.app domain.

To use a custom domain, see Custom Domains.

Migration checklist

  • Code exported to GitHub
  • .replit and replit.nix files removed from the repository
  • Environment variables migrated
  • Database migrated (if applicable)
  • Build and start commands verified
  • Public domain configured
  • Application tested

Next steps