Backend deploy guide for Railway and Render

foolish-bandit documented the Express backend deployment in three commits: a 124-line `backend/DEPLOY.md` covering build settings, env vars, and host-specific steps, a removal of `backend/bun.lock` to stop Nixpacks from provisioning Bun, and a one-line fix adding `NEXT_PUBLIC_SUPABASE_URL` to `backend/.env.example` because Railway needs it.

infrastructure

The DEPLOY.md is the useful artifact here. It covers Railway and Render specifically, maps out the build pipeline (root dir: backend, install: npm install, build: npm run build, start: node dist/index.js, Node 22.x), and lists LibreOffice as a required system package - already declared in backend/nixpacks.toml for Railway; Render needs a Docker service or an explicit apt-get step. The env-var table distinguishes required from secret, notes which keys stay backend-only, and calls out which must never reach the frontend Worker bundle.

The bun.lock deletion is the same trap that bit the frontend: Cloudflare's, Railway's, and Render's framework detectors all provision Bun when a Bun lockfile is present, even if package-lock.json is the live lockfile. Removing it forces npm. The backend/package-lock.json is unaffected.

The one-liner adding NEXT_PUBLIC_SUPABASE_URL to backend/.env.example is worth flagging before copying it anywhere. NEXT_PUBLIC_* is a Next.js convention for build-time client-bundle variables. A backend env var using that prefix almost certainly means something in routes/workflows.ts is reading the wrong name - the DEPLOY.md itself acknowledges this: "set both until that is unified." It works, but it's technical debt, not a design decision.

So what Worth a look if you're deploying the backend to Railway or Render - the `DEPLOY.md` env-var matrix and LibreOffice setup notes are good prior art that saves rediscovery. Audit the `NEXT_PUBLIC_SUPABASE_URL` usage in `routes/workflows.ts` before importing that line; the name mismatch points to a read from the wrong variable that should be cleaned up rather than copied.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

6 commits from foolish-bandit/gary, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
d2245301 Merge pull request #4 from foolish-bandit/claude/prepare-backend-deployment-2J0Le Zack Brenner 2026-05-07 ↗ GitHub
Document backend deployment on Railway/Render
014f57ae Merge pull request #5 from foolish-bandit/claude/remove-backend-bun-lockfile Zack Brenner 2026-05-07 ↗ GitHub
Remove backend/bun.lock so hosts use npm
24be1632 Document backend deployment on Railway/Render Claude 2026-05-07 ↗ GitHub
commit body
Adds backend/DEPLOY.md with install/build/start commands, the full
required-vs-secret env var matrix, host-specific (Railway, Render)
steps, frontend wire-up via NEXT_PUBLIC_API_BASE_URL, and a
post-deploy smoke test. Links it from the root README so it is
discoverable next to the existing frontend/Workers section.

https://claude.ai/code/session_019pRkhcGDRKQWHjzAnV5yCL
eac38d95 Remove backend/bun.lock so hosts use npm Claude 2026-05-07 ↗ GitHub
commit body
backend/package-lock.json is the active lockfile and the README + DEPLOY
docs prescribe npm. A stale bun.lock can mislead build detectors (Railway
Nixpacks, Cloudflare, Render) into provisioning Bun, which is exactly the
trap the frontend just hit.

https://claude.ai/code/session_019pRkhcGDRKQWHjzAnV5yCL
d872d0fc prep backend env for railway deploy SONOMOS 2026-05-07 ↗ GitHub
6404ba39 Merge pull request #19 from foolish-bandit/codex/pr-19-railway-backend-deployment-prep Zack Brenner 2026-05-07 ↗ GitHub
Backend deployment prep for Railway

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-157.md from inside the repo you want the changes in.

⬇ Download capture-thread-157.md