Search code examples
node.jsamazon-web-servicesdeploymentweb-deploymentmern

Deploy MERN stack on AWS


I am developing application with MERN stack.

  1. Can I deploy the client and server code separately?
  2. What AWS services should I use for the client and server?
  3. What else I need to think about?

Solution

    1. Yes you can
    2. You can deploy react using amplify and you can use elastic beanstalk for node. You can also use an ec2 instance to deploy your node application. You can even add react to ec2 but keeping it separately deployed should be better.
    3. You would connect your frontend and backend using APIs. So when you deploy correct domain names need to be added. You would also need to enable CORs in your backend for your frontend domain.

    There might be other issues that might run into like opening correct ports (especially if you use ec2), accessing the application from internet etc. I would suggest you deploy the applicaton stepwise making sure each step works before moving on. For example, your backend apis are reachable on their own before you connect frontend with it