0

I have a full-stack app I've developed myself using the MERN stack (+ socket.io and meilisearch). It has been deployed for a few months and started crashing intermittently with no discernible pattern. I was working on implementing PM2 to try and handle the crashes with just restarting as it appeared to be when the server was overloaded.

In trying to implement PM2 I may have discovered the source of the problem, which is that having built the React front-end and copied into a build fold, I am then running 'npm start' which in turn runs the command from my package.json file:

npx nodemon --exec npx babel-node src/server.js

In my research, it would appear that babel-node should NOT be used in a production environment. News to me as this is a technique I picked up in a tutorial many moons ago.

My question is: how do you recommend I deploy the app instead? I'm now questioning the whole approach I have in terms of copying the built frontend into the backend folder etc. Which transpiler option do you use?

1 Answers1

0

I stopped the app from using so much resource by reconfiguring the production following these instructions. I also encountered an issue with some dependencies not being present, specifically regeneratorRuntime. Helpful (short) article found here resolved that. A great side-benefit is that my app is noticeably faster and more responsive.

A more full answer to my deployment improvements can be found here.