10 days ago
Title: Multi-service config-as-code with Railpack builder - can't override config file path per service
Body:
I have two services in the same monorepo on Railway, both using the Railpack builder.
Service 1 (api-server): uses /railway.json by default — working correctly.
Service 2 (pdf-extractor sidecar): I want it to read /pdf-extractor.railway.json instead of /railway.json, because the two services need different build commands, start commands, and watch patterns.
What I've tried:
- Setting the service's UI field "Config-as-code file" (which Railway's API exposes as nixpacksConfigPath) to /pdf-extractor.railway.json. The field saves successfully, but the build manifest still shows configFile: "/railway.json" — Railpack appears to ignore this field entirely. The nixpacksConfigPath name suggests it's Nixpacks-only.
What happens: every deploy of the sidecar service builds @workspace/api-server (the wrong package) because /railway.json is being loaded instead of my intended /pdf-extractor.railway.json.
Two questions:
1. Is there a Railpack-equivalent way to specify a custom config file path per service via Railway's UI or API?
2. If not, what's the recommended pattern for two services with different build/start commands in the same monorepo, both using Railpack? I'd prefer not to rename /railway.json (disturbs a working service) or switch builders.
Project ID: d0d4afcd-9bc1-4057-a520-a71c34fbf589 (zesty-purpose)
Sidecar service ID: 3e0875dc-7c60-487f-bc35-91b7a9a41aec
2 Replies
Status changed to Awaiting Railway Response Railway • 10 days ago
Status changed to Open brody • 10 days ago
10 days ago
Try making service 1's config file name into something like api.railway.json or something. See if that does anything.
- And no, you can't declare config file path in the file. This can only be done through the dashboard.
- What do you mean by "recommended pattern"?
Also, check the build logs. At the very top, it tells you which config file it's using. (Something like config-as-code path set as ...).
9 days ago
Thanks for the response. Confirmed via build log on the sidecar service — Railpack is loading the api-server's railway.json and running its build command (pnpm --filter @workspace/api-server build) on the sidecar service. The dashboard "Config-as-code file" field on the sidecar is set to /pdf-extractor.railway.json but is being ignored, exactly as you predicted.
On clarification for question 2: by "recommended pattern" I meant the canonical Railway-supported way to run two services with different build/start commands in the same monorepo under Railpack. Your rename suggestion answers that — make service 1 non-default so service 2 can take the default /railway.json name.
One question before I rename, since the api-server is serving production traffic at api.yournfp.com and I'd rather not disturb it unless necessary: is there a Railpack-native mechanism (environment variable like RAILPACK_CONFIG_FILE, a service-level override, etc.) that would let the sidecar service explicitly point at /pdf-extractor.railway.json without renaming the api-server's config? Or is the rename truly the only path?
If rename is the only option, I'll proceed with it. Just want to confirm there's no Railpack-native escape hatch before touching the working service.