hi
I have a MERN app with MongoDB Atlas as my database. Both backend and the frontend is in a folder call MyApp. In my My App folder, I have a server.js with express and cors and API routes and other stuffs. Also in the MyApp folder, I have a folder called frontend which is a React App. I have test locally and works well. HTTP://localhost:5000 is my backend API and http://localhost:3000, is the frontend React App. I have already setup Nginx and PM2.
Next, how do I deploy this MERN stack to a droplets. Many thanks in advance.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi, Shourov here. You can deploy your mern stack as a simple nodejs application. What you need to do is, just make a build of reactjs project and include it inside your server dir, then use express static and locate your build reactjs project. use a production route (*) and this will be resolve by the building one. that’s it. your mern is up and running.
or 2nd way you can deploy your backend or server at digital ocean and then you can deploy your frontend at netlify or firebase hosting, but before deploy make sure to use a proxy to fool react app.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.