Turbo Repo Static Site
We have a vite frontend and nextjs backend in a turborepo monorepo. We can easily get the api working by running the build command with filter, same with start. However, with the vite frontend, i'm having difficulty figuring out how to get nixpack's staticfile stuff working. Because it's not an isolated monorepo, i can't change the root directory. But I can't seem to figure out how to specify that it should detect static files since the build command will output files in the app subfolder. It seems to want to use
npx turbo run start
as the start command, which is wrong. Any suggestions on how to configure an app in turborepo to be a staticfile app in railway?16 Replies
Project ID:
54205b43-ca6b-4c89-a842-83e476b6541c
this is a pr i did for a user that used npm workspaces instead of turbo, it uses caddy to serve the frontend, hopefully you can get an idea of whats going on and modify to work with turbo
https://github.com/4vinn/cypher-code-editor/pull/1
is there no way to configure it to use the
staticfile
provider in nixpack? I'd prefer to just use the NGINX setup rather than some other static file server
my thought was something like this:
but the problem i'm having right now is having multiple nixpacks in my monorepo and getting railway to use the right onedont know never tried it because i know you cant configure it to serve single page apps correctly
oh wait really?
yeah the nginx config is hardcoded into the staticfile provider unlike the php provider where you can provide your own nginx.conf file
railway isn't designed with serving frontend apps in mind, so trust me, caddy is going to be your best bet
seems like long-term getting a docker container with nginx configured is the right choice
may I ask why you are opposed to caddy? caddy would do just as good as nginx, and in my opinion is far more user friendly
Don’t have the time to really vet another new piece of tech
caddy? or my proposed solution to using caddy on railway?
Caddy
fair enough, reputation doesn't cut it I take it?
We are already scrambling to fix crap cause by trying to use fancy new things ( looking at you Vercel 🤬 )
Rep can be a factor for sure
But not looking to add yet one more thing no one on the team has any experience with
Rep is why we are on railway to be fair
makes sense, then nginx is the way to go, I'm sure you can implement it in some similar manner to how I have shown with caddy, but I've never used nginx extensively on railway so I'm noy much help there
Thanks for the input. I’m sure we’ll look into caddy at some point when things aren’t on fire
Our team does love learning about new technologies. Just don’t have the bandwidth for more right now lol
for sure, I get ya
best of luck and if you have any more questions about the platform you know where to ask!