Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 2.16 KB

File metadata and controls

38 lines (29 loc) · 2.16 KB

Deploying Shelf AI to Railway

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.

1. Deploy the Admin Dashboard

  1. Go to Railway -> New Project -> Deploy from GitHub repo.
  2. Select your shelf-ai repository.
  3. Railway will start building (and might fail initially due to missing env variables). Go to the service Settings panel.
  4. Root Directory: Leave this completely blank (or /). Do not set it to apps/admin.
  5. Scroll to the Build section:
    • Build Command: pnpm build --filter=@shelf-ai/admin
  6. Scroll down to the Deploy section:
    • Start Command: pnpm --filter @shelf-ai/admin start
  7. Go to the Variables tab and add all your Admin environment variables (Clerk keys, SpacetimeDB URI, Gemini API key, etc.).
  8. Click Deploy (or trigger a rebuild if it failed previously).

2. Deploy the User Dashboard

  1. Go back to your Railway project dashboard.
  2. Click Create -> GitHub Repo.
  3. Select your exact same shelf-ai repository again. (This creates a second, independent service alongside your Admin dashboard).
  4. Go to this new service's Settings panel.
  5. In the Build section:
    • Root Directory: Leave blank (or /).
    • Build Command: pnpm build --filter=@shelf-ai/user
  6. In the Deploy section:
    • Start Command: pnpm --filter @shelf-ai/user start
  7. Go to the Variables tab and add all your User-specific environment variables.
  8. Click Deploy (or trigger a rebuild if it failed previously).

Why this works

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.