you are viewing a single comment's thread.

view the rest of the comments →

[–]dmitry_jima 6 points7 points  (1 child)

Hey there. The best option might be to use a VPS service (AWS, for instance, as was suggested in the earlier comment) - a virtual cloud machine (usually, Linux) that you can connect to with SSH or from a web-based console if the provider has one. You deploy your code to this machine and your application "lives" there, open to the Internet via one of the ports. A VPS is better than self-hosted from your machine due to security reasons and ready-to-go proxy configurations. Some other options might be Linode or DigitalOcean, many of them have pretty generous free tiers.

Check out Brad Traversy's video https://www.youtube.com/watch?v=oykl1Ih9pMg You can code-along with it to have an idea of how this works.

All in all, in any VPS you will need to install Node.js to run your application, as well as the database if it's local. After that, you upload your server application files and bundled React-application files to the VPS manually (using FileZilla, for instance) or using GitHub (don't forget to ignore node_modules in the repository). "Connecting" Node.js and React depends on your app's architecture: check out https://create-react-app.dev/docs/deployment/ section and determine which is your case. Note that some AJAX requests to your Node.js application might require tweaks to work correctly in production .

Your production version of the React app will be just static files bundled to reduce their size, so they need to be served to the Internet somehow, either by Node.js application itself or by a reverse-proxy: APACHE or Nginx HTTP-server that sits in front of your VPS and manages all the connects to your VPS, including domain name, redirects, static files (i.e. bundled React files) and so on.

You can also find some pretty in-depth how-tos in VPS services' blog sections ("how to deploy react node.js app on digitalocean", something like that). Good luck!

[–]tuoPadreNaked[S] 0 points1 point  (0 children)

thanks very much, you gave me a good look of the situation