# Next.js on Railway

Canonical: https://inetgeek.com/stacks/nextjs-on-railway/

Railway publishes its own guide for deploying Next.js.

React framework with file-based routing, server components and a build step that produces both static and server-rendered output.

## What Next.js needs

Every host claims to run Next.js, so the claim on its own decides nothing. These are the things Next.js requires from the platform underneath it, and what Railway publishes about each. Railway documents 4 of the 6.

| Requirement | Railway | Why it matters |
| --- | --- | --- |
| Max request duration | 15 minutes while data keeps transferring; closed after 5 minutes with no data transferred. Websocket connections are exempt and can stay open indefinitely. | Server components and route handlers run per request. The wall-clock ceiling decides whether a slow upstream API or a model response can finish at all. |
| Streaming response limit | Platform-wide: an HTTP request may run up to 15 minutes while data keeps transferring, and is closed after 5 minutes with none. Idle HTTP/1.1 connections close after 60 seconds between requests. WebSocket connections are exempt. Railway documents the connection's duration here, not how the response is delivered. | The App Router streams the dynamic parts of a page as they resolve. A host that buffers the whole response first removes the benefit. |
| Edge network | Supported | Middleware runs on every matched request before the cache is consulted. Where it executes decides how much latency it adds. |
| Build allowance | Not documented | A large Next.js app prerenders at build time, so the build allowance is a recurring cost rather than a one-off. |
| Git deployment | Supported | The Next.js workflow assumes a push builds and ships. A host without git-triggered deploys means wiring CI yourself before the first deploy, which is most of the setup cost. |
| Concurrent builds | Not documented | Next.js builds are slow enough that queueing is felt. One build at a time is workable alone and becomes the bottleneck the moment two people merge in the same hour. |

- Max request duration source: https://docs.railway.com/networking/public-networking/specs-and-limits
- Streaming response limit source: https://docs.railway.com/networking/public-networking/specs-and-limits
- Edge network source: https://docs.railway.com/networking/edge-networking
- Git deployment source: https://docs.railway.com/deployments/github-autodeploys

## What Railway documents

> This guide covers how to deploy a Next.js app to Railway and connect it to a Postgres database.

Source: https://docs.railway.com/guides/nextjs

### Next.js features on Railway

- **image_optimization**: Supported — Next.js Optimization: Built-in support for all Next.js features including ISR, SSR, and API routes [...] Confirm image optimization is working ([source](https://docs.railway.com/platform/migrate-from-vercel))
- **isr**: Limited — On Railway: deploy as a Node service (same as SSR). The server must stay running to handle revalidation requests. [...] Cache is lost on every deploy. Railway replaces the container on each deployment. All cached pages are regenerated from scratch. [...] Cache is not shared across replicas. If you scale to multiple instances, each instance maintains its own cache. ([source](https://docs.railway.com/guides/ssr-ssg-isr))
- **streaming_ssr**: Supported — On Railway: deploy the same way as SSR. Railway does not buffer streaming responses, so chunks reach the browser as they are sent. Ensure your application does not add buffering middleware on the SSE or streaming routes. ([source](https://docs.railway.com/guides/ssr-ssg-isr))

## What it costs to run there

|  | Railway |
| --- | --- |
| Entry paid plan | $5 / month (Hobby) |
| Pricing model | A base subscription fee that goes towards usage, with the plan's own credit included; anything beyond the credit is billed as resource usage. |
| When you exceed a cap | Billed automatically: on the Hobby plan ($5/month, includes $5 of resource usage) usage above the included amount is charged as a delta on top of the subscription — no throttling or suspension is documented |
| Regions | 4 regions: California, Virginia, Amsterdam, Singapore |

- Entry paid plan source: https://docs.railway.com/reference/pricing/plans
- Pricing model source: https://docs.railway.com/reference/pricing/plans
- When you exceed a cap source: https://docs.railway.com/pricing/plans
- Regions source: https://docs.railway.com/reference/regions

## Whether it suits you

Teams that want a plan fee which doubles as usage credit, and deploy services straight from a Dockerfile without managing servers. The $5 Hobby fee comes back as $5 of resource usage.

Consider something else if: You need to run in a region outside California, Virginia, Amsterdam or Singapore.

Written by Palash Bagchi on 2026-09-05. This is a recommendation, not a sourced fact — it carries no citation because it is an opinion.

## Related

- Best hosting for Next.js: https://inetgeek.com/stacks/nextjs/
- Railway: https://inetgeek.com/hosting/railway/
