Where to deploy your React app and your APIs
You have a React frontend app (created with for example create-react-app), and one backend API app. Both running successfully on localhost.
Now, where do you deploy them so they are accessible on the internet?
Your frontend app is only pure HTML/JS/CSS. All you need is some static file hosting. Two solid options:
Which one should you pick? It depends based on the requirements of your app.
Amazon S3 promises a 99.999999% uptime which is pretty impressive. It is a distributed storage with at least 3 geographically separated locations. This is a robust and reliable platform to run your React app on.
It is not free. But the good thing is you only pay for what you use.
Perfect for: Your or your client’s production application.
Use Github pages if you just want something up and running quickly. If you are already using Github, then you don’t even have to create a new account. And with create-react-app, the deployment is super simple and well documented.
Also, Github pages is free!
Perfect for: Portfolio site, personal web page, a quick demo, etc.
Hosting a backend app is a bit more work than hosting static files. There are modern cloud providers that have automated a lot to make it much simpler than it was before. These are two solid options:
Both these cloud providers support many different programming languages including Node. And they both provide autoscaling meaning your app will be able to handle a lot of users accessing your site simultaneously.
You don’t need to think about installing/configuring an OS or reverse proxy. It just works out of the box. Also, deploying is automated and works with a simple command from your terminal.
You pay only for what you use. That means it’s pretty cheap to throw up a server just to test something out.
If you don’t like the idea that everything “just works” like with Elastic Beanstalk and Heroku, then there is an option for you.
You can buy a VPS (Virtual Private Server) such as DigitalOcean. Then you get access to your own machine that you have full control over. It requires more knowledge about sysadmin and devops, but at the same time, it gives you more control. I would not recommend using a VPS unless you have some very good reason for it because of the added work of configuring/installing it.
Follow me on Twitter to get real-time updates with tips, insights, and things I build in the frontend ecosystem.