DEV Community

bronxsystem
bronxsystem

Posted on

Deploying react and node.js?

I am bit confused about deploying my react/node app. I have a domain that I purchased but not sure how to deploy. cPanel can host react apps but not sure about node =/

Top comments (8)

Collapse
 
andrewbaisden profile image
Andrew Baisden • Edited

Deploying a React/Node app is easy check out these serverless hosts. Who is your domain with? You can add your DNS records to say Netlify for example and get your domain and website working easily.

And if you want to connect the node backend to the react frontend you just need to change the server from localhost to whatever address you get when you deploy it online.

netlify.com/

vercel.com/

heroku.com/

surge.sh/

pages.github.com/

Collapse
 
bassforce86 profile image
James King • Edited

One thing to consider here is whether your app truly needs to be dynamic content, or whether you could in fact create a "static" site.

The reason I bring this up is that both GitLab (and I believe GitHub although I've not tried) will host static sites for free. If you're unsure of the difference, GitLab wrote a great article detailing it here: static vs dynamic

This way, you can also begin learning about pipelines (CI/CD) and begin the journey down boosting your productivity by automating your workflows.

Collapse
 
yash_chudasama17 profile image
Yash Chudasama

I think you have to first host your node js app and then configure your react app to communicate with you hosted node js app and then host your react app using cPanel as built react app is static web page.

Collapse
 
bradtaniguchi profile image
Brad

This really depends on how your hosting provider works, as not all are equal. Its possible a "React app" can be hosted because React can build static files (HTML, CSS, JS) and basically all hosting providers can host static files.

I'd look into your hosting providers docs and see if/how they support nodejs. Its possible they don't provide a hosting/runtime for any back-end apps (Nodejs, PHP, Python, Java, whatever) and you may need to use another provider.

Collapse
 
jamesroyston profile image
James

One way you can do it is to host both the frontend and backend together and serve the bundle. I use this pattern in this blog post: dev.to/jamesroyston/how-to-deploy-...

Collapse
 
timon0305 profile image
Timon0305

You can use DigitalOcean Server. It is very easy to deploy react/node js app. I have rich experience in this part.
Thanks

Collapse
 
ushieru profile image
Ushieru Kokoran

If is only frontend. Github-pages, check this post:

dev.to/ranaemad/deploy-react-apps-...

Collapse
 
bronxsystem profile image
bronxsystem

Thank you all for replies. I will try do what Andrew suggested because I have used it to host just react app before. S: hope it works