Skip to content

Nextjs

Source: src/Railway/Website/Nextjs.ts

Deploy a Next.js application to Railway as a long-running Node process: next build, then a serve entry that import("next") + next({ dev: false }).prepare() + getRequestHandler() on PORT (default 3000). Not OpenNext — those wrappers are Lambda/workerd.

The image npm installs next, react, and react-dom, and bakes .next plus public/ into /app.

During alchemy dev the site is Next’s own dev server (next dev) and no cloud resources are declared; Alchemy.remote() opts back into the full live deployment.

const site = yield* Railway.Website.Nextjs("Web", {
rootDir: "./app",
});
const site = yield* Railway.Website.Nextjs("Web", {
rootDir: "./app",
env: {
API_BASE: "https://api.example.com",
},
});