Home > Software design >  Issues with deploying React based app on Railway
Issues with deploying React based app on Railway

Time:12-31

I was moving my fullstack app (React Express) from Heroku. The problem was that React app has to be built for running (also has to install required dependencies), but on git we usually store only raw source code.

A common structure for fullstack projects:

enter image description here

Heroku has the option to run scripts after deployment with a special script in the package.json file:

"heroku-postbuild": "npm install --prefix client && npm run build --prefix client"

But I didn't find a similar ability on Railway.

So my solution is:

  1. Remove the build folder from the .gitignore file
  2. Build react app with npm run build
  3. Add all to git repository
  4. enter image description here

  • Related