Deploying my MERN frontend and backend seperately, frontend doesn't work?

kweebacTRIAL

a year ago

Here's the repo: https://github.com/Kweebac/messagingApp

I followed a tutorial to do this.
First I created a new project for the backend and changed the root directory to /server, copied all my .env variables over and generated a domain.
The deployment worked, but when I go to the domain it says "Application failed to respond". Also in my /server/package.json I don't have an npm run build command yet that's the default build command in the settings? I don't understand that.

Then I created a new project for the frontend, changed the root directory to /client, added a variable NODE_OPTIONS: --openssl-legacy-provider because it said to in the tutorial (I don't know why) and generated a domain. The deployment fails saying "Error: No start command could be found" even though in /client/package.json there is an npm run build command.

2 Replies

kweebacTRIAL

a year ago

I forgot to mention, for the backend I also created a MongoDB database on Railway and connected it with the shared variable. I don't think there's any issues with that.


a year ago

when I go to the domain it says "Application failed to respond"

Please see this docs page - https://docs.railway.app/guides/fixing-common-errors

I don't have an npm run build command yet that's the default build command in the settings? I don't understand that.

Its just placeholder text - https://www.w3schools.com/tags/attinputplaceholder.asp

The deployment fails saying "Error: No start command could be found"

Seems like you added the nixpacks.toml and Caddyfile 2 minutes ago so that should be fixed now.