Bad Turborepo integration

Anonymous
PRO

2 months ago

Hi, feels like turborepo is not properly supported. because even when I set `NIXPACKS_TURBO_APP_NAME`, all my apps in my monorepo are built.

Also does anyone know why the start also triggers the build? Might be something with Railpack

Awaiting User Response

4 Replies

2 months ago

NIXPACKS_TURBO_APP_NAME is ignored in Railpack.

For monorepos, you should set up a root directory so it builds within the context of the specific app within the package, and watch patterns to make Railway only build the files that are changed within the package.

Note that you should:

  • include your root directory's package.json/lockfiles here as well

  • use a custom build command that builds that specific package so it doesn't build everything (ex: don't do npm build). This can be achieved via npm build:$PACKAGE and having a corresponding build command in the package.json of the $PACKAGE

(replace npm with whatever package manager you're using)

edit:

If your apps share a common root, you do not need to set a root directory (this will be counterproductive; you'll want to use the build/deploy commands to direct Railway to build and deploy the specific packages)


Status changed to Awaiting User Response railway[bot] 2 months ago


Anonymous
PRO

2 months ago

I'm using Nixpack, does this apply?

I tried setting up build and start commands like you said - `pnpm run build:$PACKAGE` and `pnpm run start:$PACKAGE` but I had the same behavious, it build all apps, which is slow for my codebase


Status changed to Awaiting Railway Response railway[bot] 2 months ago


Anonymous
PRO

2 months ago

Ok I think I found the issue, there's a bug in Railway, even when the dropdown has Nixpack selected by default, unless you select it is not enabled - you can see the values goes from blank to NIXPACKS before apply the changes


2 months ago

I think that might be a visual bug? There's no way to have an empty builder (nixpacks/railpack must always be selected)

And yes, the suggestions above apply to both Nixpacks & Railpack. Did they work for you?

I'd also recommend switching to Railpack for faster builds


Status changed to Awaiting User Response railway[bot] 2 months ago


Bad Turborepo integration - Railway Help Station