Deploying to Railway
Below are the steps to deploy your Triplit server on Railway (opens in a new tab). If there are issues with your deployment, please see the Railway documentation (opens in a new tab) for the latest information.
Railway does have a free tier but it is very limited. We recommend using the Hobby plan at minimum.
One Click Deploy
You can deploy your Triplit server to Railway with a single click using the following button:
Please ensure you set the JWT_SECRET
to your own secret value. If you forget
to, it can be overriden at anytime. More information on generating a JWT
secret can be found. here.
(opens in a new tab)
This will create a new Railway project with the Triplit server pre-configured. You will need at minimum a Hobby plan to deploy from a template. Please ensure you set the
JWT_SECRET
to your own secret value.
Manual Deployment (Dashboard)
Create a Railway account
Go to Railway (opens in a new tab) and create an account if you don't have one already. Railway does have a free tier but it is very limited. We recommend using the Hobby plan at minimum.
Create a new service from the Triplit Docker image
Follow the steps to create a service from a docker image in the Railway documentation (opens in a new tab), using aspencloud/triplit-server:latest
as the docker image.
Add a volume to your service
Create a volume by following the steps in the Railway documentation (opens in a new tab). Set the mount path to /mnt/triplitdb
, or any other path you prefer.
Configure environment variables
You may see logs that your service is not running or failing, this is expected as you need to configure the environment variables first.
- Set
JWT_SECRET
to your desired JWT secret (see here for more information). - Set
LOCAL_DATABASE_URL
to/mnt/triplitdb/app.db
(or any other path you prefer, but make sure it matches the mount path of your volume).
Expose your service
Expose a public URL by following the steps in the Railway documentation (opens in a new tab).
Test your server is up
Test your server is up by sending a request to the Railway application URL. You can use curl
or any HTTP client to send a request:
curl https://<railway-domain>/healthcheck