Search code examples
reactjsazureazure-sql-databaseazure-web-app-servicenodejs-server

Azure hosting of react js and node js application


I have react JS as my client side framework and Node JS express is my API backend services with SQL database on a home project. The app runs locally on my machine and I want to deploy the app in azure. I am not sure if I have to take 2 app services instances to manage my frontend and backend or take a linux VM and manage the deployment myself as I am doing now locally with nginx and pm2.

Considering scalability in future, how to deploy in Azure and what I have to take as Azure components?


Solution

  • I'm assuming you are using the free tier for learning purpose as you said it is a home project?

    For scalability and availability, I would go with a 3-tier architecture, the first tire is for the compute stuff (the nodejs app), deployed in an auto scalling group of minimum two instances all behind an Azure load balancer

    The second-tier is the DB, I would go for Azure Databases for this

    And last, is your React app, if it is a statically generated app (like Gatsby), I would go for Static website hosting in Azure Storage, otherwise it is best to put the React server in the same Linux instance as Nodejs app, and use path redirection in the load balancer to target the App

    PS: this will cost a considerable amount of money depending on the load, but you don't have to care about the scalability, also you don't need to manage your database anymore.