Hosting a monorepo with a Vite/Svelte Front and and a Fiber Backend

I am trying to host my monorepo application within railway however I am facing some issues when trying to deploy. Should i be using npm run dev as my run command? I was thinking of creating two railway instances one for the front end and the other for the back end while setting each respective root directory but I am not sure if this is the best option
11 Replies
Percy
Percy10mo ago
Project ID: 4a299107-d7aa-41fc-8de7-34c9d4071a4d
julian31186
julian3118610mo ago
4a299107-d7aa-41fc-8de7-34c9d4071a4d
Brody
Brody10mo ago
- Should i be using npm run dev as my run command? no you shouldn't, see the " Why use Caddy when deploying to Railway?" part of this templates readme https://github.com/brody192/vite-react-template - I was thinking of creating two railway instances one for the front end and the other for the back end while setting each respective root directory but I am not sure if this is the best option this would be the currect way to go about it!
julian31186
julian3118610mo ago
thank you! also for the hobby plan, is there a way to set a upper bound limit on charge fee?
Brody
Brody10mo ago
there is not, but if you enable usage alerts in your account settings youll get an email when you go one cent over 5$ lol
julian31186
julian3118610mo ago
after reading i do not quite understand when i initially used npm run dev as the deploy command it passed, however nothing was exposed to the internet
Brody
Brody10mo ago
simply copying the nixpacks.toml and Caddyfile into your vite project should be enough
julian31186
julian3118610mo ago
will i then be able to leave both build and start commands empty? if i were to use npm run dev as my deploy command, do you know how I would expose it to the internet?
Brody
Brody10mo ago
again, do not use that command please use the nixpacks.toml and Caddyfile from my template repo you should be able to wanting to follow up, did you have any success?
julian31186
julian3118610mo ago
I did, added the 2 files and it magically worked. I am not sure how but i am amazed. thank you so much! how does the Caddy file know what to do
Brody
Brody10mo ago
I recommend you read that repositories readme, and read the caddyfile itself