Shelf AI consists of two Next.js dashboards (Admin and User). Since they are part of a Turborepo monorepo, Railway requires specific configurations to build and deploy each app independently.
We have already included a nixpacks.toml file at the root to enforce pnpm usage, and the next.config.ts files are configured for standalone output mode.
Follow these steps to deploy both dashboards from the same GitHub repository natively in Railway.
- Go to Railway -> New Project -> Deploy from GitHub repo.
- Select your
shelf-airepository. - Railway will start building (and might fail initially due to missing env variables). Go to the service Settings panel.
- Root Directory: Leave this completely blank (or
/). Do not set it toapps/admin. - Scroll to the Build section:
- Build Command:
pnpm build --filter=@shelf-ai/admin
- Build Command:
- Scroll down to the Deploy section:
- Start Command:
pnpm --filter @shelf-ai/admin start
- Start Command:
- Go to the Variables tab and add all your Admin environment variables (Clerk keys, SpacetimeDB URI, Gemini API key, etc.).
- Click Deploy (or trigger a rebuild if it failed previously).
- Go back to your Railway project dashboard.
- Click Create -> GitHub Repo.
- Select your exact same
shelf-airepository again. (This creates a second, independent service alongside your Admin dashboard). - Go to this new service's Settings panel.
- In the Build section:
- Root Directory: Leave blank (or
/). - Build Command:
pnpm build --filter=@shelf-ai/user
- Root Directory: Leave blank (or
- In the Deploy section:
- Start Command:
pnpm --filter @shelf-ai/user start
- Start Command:
- Go to the Variables tab and add all your User-specific environment variables.
- Click Deploy (or trigger a rebuild if it failed previously).
Because Next.js output: "standalone" is enabled and nixpacks.toml configures pnpm for the workspace, Railway correctly captures all shared local packages (@shelf-ai/ui, @shelf-ai/shared) and isolates each dashboard into its own optimized Docker container.