diff --git a/content/200-orm/200-prisma-client/500-deployment/101-traditional/325-deploy-to-railway.mdx b/content/200-orm/200-prisma-client/500-deployment/101-traditional/325-deploy-to-railway.mdx new file mode 100644 index 0000000000..23c2a3f22e --- /dev/null +++ b/content/200-orm/200-prisma-client/500-deployment/101-traditional/325-deploy-to-railway.mdx @@ -0,0 +1,87 @@ +--- +title: 'Deploy to Railway' +metaTitle: 'Deploy a Prisma app to Railway' +metaDescription: 'Learn how to deploy an app that uses Prisma ORM and Prisma Postgres to Railway.' +--- + +This guide explains how to deploy an app that uses Prisma ORM and Prisma Postgres to [Railway](https://railway.com). 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](https://railway.com/deploy/prisma-postgres). + +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. + +## Prerequisites + +To get started, all you need is: + +* A [Railway account](https://railway.com) +* A GitHub repository with your application code. + +:::note +If you don't have a project ready, you can use our [example Prisma project](https://github.com/prisma/prisma-examples/tree/latest/deployment-platforms/railway). 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 + +### 1. Create a new Railway project + +1. Go to the [Railway dashboard](https://railway.com/dashboard) +2. Click **Create a New Project** +3. Select **GitHub Repo** +4. Click **Configure GitHub App** and authorize Railway +5. 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. + +![Railway deploying application](./images/railway-deploying.png) + +## Configure your database + +### 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](https://console.prisma.io) +- Run `npx create-db` for a temporary database _(no account required)_ + +### 2. Add the database URL to Railway + +1. In your Railway project, open your service +2. Go to the **Variables** tab +3. Click **New Variable** +4. Set the name to `DATABASE_URL` +5. Paste your database connection string as the value +6. Click **Deploy** to redeploy your application with the new environment variable + +![Railway environment variables setup](./images/railway-env-vars.png) + +### 3. Access your application + +Once the deployment completes with the database URL configured: + +1. Navigate to the **Settings** tab +2. Under **Networking**, click **Generate Domain** +3. Your application will be available at the generated URL + +![Railway networking settings](./images/railway-networking.png) + +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: +- Check API status (`/api`) +- Load feed (`/api/feed`) +- Seed data (`/api/seed`) + +![Railway deployed application](./images/railway-final-product.png) + +If you see any errors: +- Wait a minute and refresh +- Ensure `DATABASE_URL` is set +- Check the service logs +- Redeploy + +To learn more about the various features Railway offers for your application, visit the [Railway documentation](https://docs.railway.app). \ No newline at end of file diff --git a/content/200-orm/200-prisma-client/500-deployment/101-traditional/images/railway-deploying.png b/content/200-orm/200-prisma-client/500-deployment/101-traditional/images/railway-deploying.png new file mode 100644 index 0000000000..54738245bb Binary files /dev/null and b/content/200-orm/200-prisma-client/500-deployment/101-traditional/images/railway-deploying.png differ diff --git a/content/200-orm/200-prisma-client/500-deployment/101-traditional/images/railway-env-vars.png b/content/200-orm/200-prisma-client/500-deployment/101-traditional/images/railway-env-vars.png new file mode 100644 index 0000000000..e4cf17c4fd Binary files /dev/null and b/content/200-orm/200-prisma-client/500-deployment/101-traditional/images/railway-env-vars.png differ diff --git a/content/200-orm/200-prisma-client/500-deployment/101-traditional/images/railway-final-product.png b/content/200-orm/200-prisma-client/500-deployment/101-traditional/images/railway-final-product.png new file mode 100644 index 0000000000..64ff8b61b7 Binary files /dev/null and b/content/200-orm/200-prisma-client/500-deployment/101-traditional/images/railway-final-product.png differ diff --git a/content/200-orm/200-prisma-client/500-deployment/101-traditional/images/railway-networking.png b/content/200-orm/200-prisma-client/500-deployment/101-traditional/images/railway-networking.png new file mode 100644 index 0000000000..b6081c69c5 Binary files /dev/null and b/content/200-orm/200-prisma-client/500-deployment/101-traditional/images/railway-networking.png differ diff --git a/content/250-postgres/1100-integrations/200-vercel.mdx b/content/250-postgres/1100-integrations/200-vercel.mdx index b523e70de6..106e5264c2 100644 --- a/content/250-postgres/1100-integrations/200-vercel.mdx +++ b/content/250-postgres/1100-integrations/200-vercel.mdx @@ -31,7 +31,6 @@ The easiest way to use Prisma Postgres on the Vercel Marketplace is via one of t - [Postgres + Kysely Next.js Starter](https://vercel.com/templates/next.js/postgres-kysely) - [Postgres + Drizzle Next.js Starter](https://vercel.com/templates/next.js/postgres-drizzle) - [Postgres + SvelteKit Starter](https://vercel.com/templates/svelte/postgres-sveltekit) -- [Next.js SaaS Starter](https://vercel.com/templates/authentication/next-js-saas-starter) ## Usage diff --git a/content/900-ai/index.mdx b/content/900-ai/index.mdx index 03355fc6da..507fd52b0c 100644 --- a/content/900-ai/index.mdx +++ b/content/900-ai/index.mdx @@ -91,7 +91,7 @@ npx -y mcp-remote https://mcp.prisma.io/mcp } href={{ text: "Read now", - url: "https://www.prisma.io/docs/postgres/integrations/mcp-server#tools" + url: "/postgres/integrations/mcp-server#tools" }} body={`Discover all the tools that make up the capabilities of the Prisma MCP server.`} /> @@ -102,7 +102,7 @@ npx -y mcp-remote https://mcp.prisma.io/mcp } href={{ text: "Read now", - url: "https://www.prisma.io/docs/postgres/integrations/mcp-server#integrating-in-ai-tools" + url: "/postgres/integrations/mcp-server#integrating-in-ai-tools" }} body={`Learn how to integrate Prisma’s MCP server in your favorite AI tool, such as Cursor, Claude, Warp, and more.`} /> @@ -151,7 +151,7 @@ npx -y mcp-remote https://mcp.prisma.io/mcp } href={{ text: "Read now", - url: "https://www.prisma.io/docs/guides/ai-sdk-nextjs" + url: "/guides/ai-sdk-nextjs" }} body={`Learn how to build a chat application using the Vercel AI SDK with Next.js and Prisma ORM to store chat sessions and messages in a Prisma Postgres database.`} /> @@ -178,7 +178,7 @@ npx -y mcp-remote https://mcp.prisma.io/mcp } href={{ text: "Get started", - url: "https://www.prisma.io/docs/postgres/integrations/idx" + url: "/postgres/integrations/idx" }} body={`Google's Firebase Studio is a fully-fledged online IDE with a native AI integration. Prompt and build apps directly in your browser and deploy them by connecting with a powerful Prisma Postgres database in just a few clicks.`} />