apps/docs/content/docs.v6/orm/prisma-client/deployment/traditional/deploy-to-railway.mdx
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 simplifies the software development lifecycle with instant deployments, built-in observability, and effortless 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 automates the provisioning and setup of a Prisma Postgres database, linking it directly to your Next.js application upon deployment, making the entire project ready with just one click.
To get started, all you need is:
:::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. :::
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.
You'll need a Prisma Postgres connection string. There are two ways to obtain one:
npx create-db for a temporary database (no account required)DATABASE_URLOnce the deployment completes with the database URL configured:
Go to the generated URL and you'll see your deployed app!
If you used the example project, you should see three api endpoints already set up:
/api)/api/feed)/api/seed)If you see any errors:
DATABASE_URL is setTo learn more about the various features Railway offers for your application, visit the Railway documentation.