Help to deploy a MERN!

Hi guys!

I’m about to deploy my first MERN and have a personal domain to use.

I already used Heroku to deploy the Back-end and I’m thinking of Netlify for Front-end.

My question is a silly one: do I have to configure the domain in both of them or just in one?



As far as I know, you can use Heroku for both backend and frontend. Just provide a path to the frontend files, like app.use(express.static('client/build')). There are many guides for deploying MERN with Heroku, see for example Deploying a Full-Stack MERN app with Heroku - DEV Community.

If you deploy frontend and backend separately, you will get a lot of problems. At the very least, you will need to use two domains (or subdomains within the same domain) and allow access to your API from a different server (see CORS).

Therefore, I recommend deploying all code to single service.