a month ago
I've encountered an intermittent deployment issue when deploying a monorepo application on Railway. Although the service is configured to use the backend/ directory as the root, some deployments appear to ignore the configured rootDirectory during the Nixpacks build step.
Environment
Railway
GitHub integration
Monorepo structure
Backend: Flask + Gunicorn
Frontend: React (separate directory)
Repository Structure
project/
├── frontend/
└── backend/
├── app.py
├── requirements.txt
└── railway.jsonExpected Behavior
Railway should consistently build from the configured backend/ directory.
Actual Behavior
Occasionally, Nixpacks scans the repository root instead of the configured backend directory.
This results in build failures such as:
Unable to locate requirements.txt
Build image creation failure
Deployment stops before startup
Steps to Reproduce
Create a GitHub monorepo.
Place the backend inside a backend/ directory.
Configure Railway to use that directory as the root.
Push a commit.
Observe that some deployments build correctly while others ignore the configured root.
1 Replies
a month ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 29 days ago
a month ago
I’d recommend migrating to Railpack or a Dockerfile, as Nixpacks is deprecated.