18 days ago
I have a pnpm turbo monorepo setup. There is a apps/backend and apps/frontend folder (NestJS + Vite React). The problem is, since there is no pnpm-lock file in either of these folders (only in the root), it keeps defaulting to npm.
Since there is no shared code in them, it's an isolated monorepo but I'm having problems with setting it up. Also, would like to have it done in a way that deployments get triggered only when there is code change in that specific app (apps/frontend for Vite React and apps/backend for NestJS)
0 Replies
18 days ago
You can define a packageManager
in your package.json
, but if that doesn't work for you then you can also override the install and build command on Railpack via RAILPACK_INSTALL_CMD
and RAILPACK_BUILD_CMD
I figured it out. Created a nixpacks.toml file in my backend:
[phases.setup]
nixPkgs = ["nodejs", "pnpm"]
[phases.install]
cmds = ["pnpm install"]
[phases.build]
cmds = ["pnpm run build"]
[start]
cmd = "pnpm run start:prod"
This did the job.
If this worked for the apps/backend, it should work for apps/frontend too
18 days ago
I suppose that works but just remember that wouldn't be cross compatible with Railpack if you ever switch in the future
Is one better than the other? Right now I just set out with the default configurations (AI helped me with the nixpack stuff)
18 days ago
Nixpacks is Railway's first generation builder and Railpack is the replacement second generation builder, from my understanding Nixpacks isn't being worked on anymore and Railway is actually already in the process of defaulting over to Railpack (only for some new services)
18 days ago
Setting pnpm as your packageManager
in your package.json
rather than using nixpacks.toml
will work for both Railpack and Nixpacks so if you ever need to switch in the future then you don't need to translate Nixpacks configurations
18 days ago
Thank you. I'll check this out.
An unrelated question to the topic but can I not install the vector extension on my postgres instance?
18 days ago
I don't think so, but you can install a different postgres database that has the vector extension preinstalled
(made by a Railway team member)
I've got one more small thing. As stated that it's a pnpm monorepo structure. I've set the root directory for both as well:apps/frontend
and apps/backend
And I've set the watch paths for both like this:apps/backend/src/**
and apps/frontend/src/**
What I thought would happen is that deployment for each app would happen based on whether I have made changes in their respective paths. But right now I edited the nixpacks.toml in the backend folder and it triggered deployments for both. What am I missing here?
18 days ago
That's weird <:Thinking:1360710341239242762> I didn't think it'd do that, but I also don't use monorepo so I guess I never had a chance to find out that I'd be wrong
regardless, you can set up watch paths for each service to tell Railway which paths should change before triggering a new deployment, this will be in your service settings
17 days ago
awesome!!
17 days ago
all good to close this thread?
17 days ago
I'll do that no worries
17 days ago
thank youuu
17 days ago
you will? 😆
17 days ago
trust
17 days ago
14 days ago
!s
Status changed to Solved dev • 14 days ago
14 days ago
lol
14 days ago
i have to let it marinate