Well, it didn’t detect as much as I expected. Turned out, the easiest way is to have nixpacks.toml at the root.
And if you notice the start command, that is where the “cd apps/web” fix the issue. Then Railway able to inject the variable accordingly.
# Nixpacks configuration for monorepo deployment # This file tells Railway how to build and deploy our Next.js app from a monorepo [phases.setup] nixPkgs = ["nodejs_18", "pnpm"] [phases.install] cmd = "corepack enable && pnpm install --frozen-lockfile" [phases.build] cmd = "turbo build -F web" [start] cmd = "cd apps/web && pnpm start"