Skip to main content
Multilingual TursoDB, MVCC & AI Agent database guides Read Engine Guide →
Turso Cloud Turso Cloud Embedded Replicas Platform Guides

Turso + Railway

Deploy a JavaScript/Rust app using [Turso Cloud embedded replicas](/features/embedded-replicas) to [Railway](https://railway.app/).

Koyeb banner

Prerequisites

Before you start, make sure you:

1. Retrieve database credentials

You will need an existing database to continue. If you don’t have one, create one.

Get the database URL:

turso db show --url <database-name>

Get the database authentication token:

turso db tokens create <database-name>

Assign credentials to the environment variables inside .env.

TURSO_DATABASE_URL=
TURSO_AUTH_TOKEN=
NOTE

You will want to store these as environment variables.

2. Get application code

Fork and clone the following embedded replica project from GitHub locally:

3. Create a new Railway project

Run the following command to create a new Railway project. Provide the project’s name when prompted.

railway init

4. Add a service to the Railway project

Create a new empty service on your Railway project to act as your app’s deployment target.

5. Link application to service

Run the following command to list and select the service to link to your application:

railway service

6. Add database credentials

Open the service on your Railway dashboard and add your Turso Cloud database credentials.

TURSO_DATABASE_URL=libsql://[db-name]-[github-username].turso.io
TURSO_AUTH_TOKEN=...
LOCAL_DB=file:local-db-name.db

7. Deploy

Run the following command to deploy your application:

railway up
NOTE

Make sure you expose your application to the internet to make it accessible from the public network.

WARNING

If you are on a free plan, you’ll need to connect your Railway account to GitHub to have access to code deployments.

Synced from official Turso documentation ( tursodatabase/turso-docs · MIT License) Official Docs ↗
Search
Press Esc to close · Powered by Pagefind