skip to Main Content

I have created a MERN stack application ,and now i want to host my application on the aws server. I have already purchased the domain name for my application. I have implemented my frontend(React) and backend(Node) differently and I have no idea on how to deploy my application.

I have found several tutorials on youtube about how can I deploy my MERN stack application on aws , but non of them covers what to do if the frontend and backend are implemented seperatly.

2

Answers


  1. Frontend: S3 + CloudFront is a standard way to host frontend apps on AWS. S3 stores files and CloudFront adds HTTPS and caching.

    Backend: dockerize your Node app and use AWS ECS to deploy it on EC2 or Fargate. Choose Fargate for easier maintenance which comes with a somewhat higher cost.

    Mongo: AWS DocumentDB, AWS EC2 (self-host), or Mongo Atlas.

    Login or Signup to reply.
  2. Your front end is nothing but a static HTML file with a bunch of javascript dependencies. Host it in a static file storage such as S3, and serve it over a CDN (CloudFront). It’s easy.

    For your node express backed, either you can dockerize it and deploy it via ECS (might be a bit tricky if you’re new to it).

    Or if you’re building an MVP, you can spin up an EC2 instance, set up Node, and required dependencies (such as MongoDB) in it. Then clone your node repo and run the app using a process manager such as pm2. Additionally, you might want to install nginx and proxy the traffic from port 80 (or 443) to your node app (that might be live at localhost:3000)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search