Menu

Post image 1
Post image 2
1 / 2
0

Shipping TanStack Start and Bun to Railway

DEV Community·Andreas Bergström·28 days ago
#rGBcEyQ2
#railway#docker#bunjs#tanstack#prisma#full
Reading 0:00
15s threshold

Andreas Bergström

Railway's Nixpacks autobuild detects Bun projects fine, but it can't sequence the combination this site needs: prisma generate at build time, Vite + the TanStack Start plugin, a custom server.ts entry, and prisma migrate deploy on boot. A four-stage Dockerfile is simpler than teaching Nixpacks all of that.

The full post walks through the recipe: two parallel bun install stages (one full, one production-only), a build stage that runs prisma generate against a dummy DATABASE_URL, a lean runtime that layers the generated Prisma client on top of deps-prod's node_modules, and an entrypoint that runs migrations before exec-ing into Bun so the container's PID 1 shuts down cleanly on Railway's SIGTERM.

Plus the small Railway-side bits: how to wire the Postgres reference variable, why you should bind explicitly to 0.0.0.0, and the COPY-order detail that determines whether your runtime sees the right Prisma client.


Originally published at andreasbergstrom.dev — read the full post there.

Read More