Deploy to Railway (Prisma ORM v7) (/docs/orm/v7/prisma-client/deployment/traditional/deploy-to-railway)
For the complete Prisma documentation index, see llms.txt. A markdown version of any docs page is available by appending
.mdto its URL.
Learn how to deploy an app that uses Prisma ORM and Prisma Postgres to Railway
Location: ORM > v7 > Prisma Client > Deployment > Traditional > Deploy to Railway
This guide explains how to deploy an app that uses Prisma ORM and Prisma Postgres to Railway. The app exposes a REST API and uses Prisma Client to query a Prisma Postgres database. Your app will run on Railway and connect to a managed Prisma Postgres database.
Railway is a deployment platform that provides instant deployments, built-in observability, and scaling. It supports code repositories and container images from popular registries. Railway handles configuration management, environment variables, and provides private networking between services.
To get a pre-wired Next.js Project with Prisma ORM, Prisma Postgres, and Railway, use the Official Prisma Railway Template.
This template provisions a Prisma Postgres database and links it to your Next.js application when you deploy.
Prerequisites
Section titled “Prerequisites”You need:
- A Railway account
- A GitHub repository with your application code.
[!NOTE] If you don't have a project ready, you can use our example Prisma project. It's a simple Hono application that uses Prisma ORM and includes a REST API, a frontend for testing endpoints, and a defined Prisma schema with migrations.
Deploy your application
Section titled “Deploy your application”1. Create a new Railway project
Section titled “1. Create a new Railway project”- Go to the Railway dashboard
- Click Create a New Project
- Select GitHub Repo
- Click Configure GitHub App and authorize Railway
- Select your repository
Your application is now deploying to Railway, but it won't properly run without a database connection.
In the next section, you'll configure a database and set the DATABASE_URL environment variable in Railway.
Configure your database
Section titled “Configure your database”1. Get your database connection string
Section titled “1. Get your database connection string”You'll need a Prisma Postgres connection string. There are two ways to obtain one:
- Create a new database on Prisma Data Platform
- Run `npx create-db` for a temporary database *(no account required)*
2. Add the database URL to Railway
Section titled “2. Add the database URL to Railway”- In your Railway project, open your service
- Go to the Variables tab
- Click New Variable
- Set the name to
DATABASE_URL - Paste your database connection string as the value
- Click Deploy to redeploy your application with the new environment variable
3. Access your application
Section titled “3. Access your application”Once the deployment completes with the database URL configured:
- Navigate to the Settings tab
- Under Networking, click Generate Domain
- Your application will be available at the generated URL
Open the generated URL to see your deployed app.
If you used the example project, you should see three api endpoints already set up:
- Check API status (
/api) - Load feed (
/api/feed) - Seed data (
/api/seed)
If you see any errors:
- Wait a minute and refresh
- Ensure
DATABASE_URLis set - Check the service logs
- Redeploy
To learn more about the various features Railway offers for your application, visit the Railway documentation.
Related pages
Section titled “Related pages”Deploy to Fly.io: Learn how to deploy a Node.js server that uses Prisma ORM to Fly.ioDeploy to Heroku: Learn how to deploy a Node.js server that uses Prisma ORM to HerokuDeploy to Koyeb: Learn how to deploy a Node.js server that uses Prisma ORM to Koyeb Serverless PlatformDeploy to Render: Learn how to deploy a Node.js server that uses Prisma ORM to RenderDeploy to Sevalla: Learn how to deploy a Node.js server that uses Prisma ORM to Sevalla