How to move your React website from localhost to the internet
Published: 2023-07-13 09:48:56

---
title: How to move your React website from localhost to the internet
published: true
date: 2022-09-02 09:03:24 UTC
tags: 
canonical_url: 
---

![bethanyjep_5-1661763236133.png](https://techcommunity.microsoft.com/t5/image/serverpage/image-id/399611i33E713927DFEF79E/image-dimensions/488x230?v=v2 "bethanyjep\_5-1661763236133.png")

<font size="5"><strong><span data-contrast="auto">Scenario</span></strong><span data-ccp-props='{"201341983":0,"335559739":160,"335559740":259}'> </span></font>

Let us say you have been building your website for a while now and it is time to show the world what you have been working on. One of the best ways to achieve this is by hosting your site using Azure Static Web Aps (SWA). In this blog, I will take you step by step through deploying your site for the world to see. 

The first question in your mind might be, what is Static Web Apps? 

_Static Web Apps is an Azure Service that you can use to build and deploy your web applications._

_It automates deployment directly from your repository, for instance with GitHub._ 

<li-wrapper><i></i></li-wrapper>

Web applications built using libraries and frameworks like Angular, React, Svelte, Vue, or Blazor where no server-side rendering is required are referred to as Static Web Apps. These apps include HTML (Hyper Text Markup Language), CSS, JavaScript, and image assets that make up the application. Using the Azure SWA, you can easily deploy your applications. 

<font size="5"><strong><span data-contrast="auto">Prerequisites</span></strong><span data-ccp-props='{"201341983":0,"335559685":0,"335559739":160,"335559740":259}'> </span></font>

In addition to Azure SWA, we now have the Static Web Apps CLI, whereby you can integrate Azure Static Web Apps from Local Development. In this tutorial I will do a demo on how you can start using Azure Static Web Apps CLI. When you are done, you will be able to deploy your web application. In order to complete this tutorial, you will need: 

- An Azure subscription, get a free students account [here](https://aka.ms/azure4student) 
- Visual Studio Code installed, install one [here](https://code.visualstudio.com/) 

<font size="5"><strong>QuickStart – Local development </strong></font>

- Once you have built your react app, run it locally using **npm start.** If you are new to React you can follow the [step-by-step tutorial](https://reactjs.org/tutorial/tutorial.html) to build your first app. 

![bethanyjep_0-1661763078648.png](https://techcommunity.microsoft.com/t5/image/serverpage/image-id/399606i24695D404DBBFDA7/image-size/medium?v=v2&px=400 "bethanyjep\_0-1661763078648.png")

 

- Now, onto the SWA CLI. First, you will need to install the CLI using either npm or yarn on the terminal. Using npm, you can: 
  - Install SWA CLI globally: **npm install -g <li-user uid="73893"></li-user>/static-web-apps-cli**  
  - Or install SWA CLI locally withing the project: **npm install -D <li-user uid="73893"></li-user>/static-web-apps-cli**  

- Make sure the CLI is installed by running **swa –version**  

![bethanyjep_1-1661763078650.png](https://techcommunity.microsoft.com/t5/image/serverpage/image-id/399607i5AD0873DB3EE1879/image-size/medium?v=v2&px=400 "bethanyjep\_1-1661763078650.png")

- Once done, you can now go ahead and deploy your application by running swa on the terminal. By running it will generate a configuration for you, build your project then ask you if you want to deploy your application to Azure.
- ![bethanyjep_2-1661763078652.png](https://techcommunity.microsoft.com/t5/image/serverpage/image-id/399608i4D40677F9698BD99/image-size/medium?v=v2&px=400 "bethanyjep\_2-1661763078652.png")
- Once the configuration is generated as shown below, go ahead and accept the configuration which will trigger the build to start. 
- ![bethanyjep_3-1661763078654.png](https://techcommunity.microsoft.com/t5/image/serverpage/image-id/399609i9C62AA51886CAE3D/image-size/medium?v=v2&px=400 "bethanyjep\_3-1661763078654.png") 
- After the build is concluded, you can proceed and deploy your application. Connect the project to your Azure tenant. Once it has access to your subscription, go ahead and create a new application and give it a name. 
- ![bethanyjep_4-1661763078656.png](https://techcommunity.microsoft.com/t5/image/serverpage/image-id/399610i8A52C0E9A3EBD663/image-size/medium?v=v2&px=400 "bethanyjep\_4-1661763078656.png")
- And voila, your application is on the internet, and you can now share it with your friends! 

**Summary**  

In simple steps, we have moved our application from the local host to the web. Regardless of the framework you are using, you can easily deploy it to the internet. Learn more about the Static Web Apps CLI and how you can configure your deployment [here](https://aka.ms/swaCLI).  Eager to learn more on Azure Static Web Apps? The learning path below will help you get going: 

- [Azure Static Web Apps - Learn | Microsoft Docs](https://docs.microsoft.com/en-us/learn/paths/azure-static-web-apps/?WT.mc_id=academic-75638-bethanycheum)

 

[Here is a short clip that goes over the steps above. ](https://www.tiktok.com/@bethanyjep/video/7133546565213375750)

> <section><a title="@bethanyjep" href="https://www.tiktok.com/@bethanyjep?refer=embed" target="_blank" rel="noopener">@bethanyjep</a> how to move your react app from local host to the Internet. docs: <a href="https://aka.ms/swaCLI" target="_blank" rel="noopener">https://aka.ms/swaCLI</a> <a title="students" href="https://www.tiktok.com/tag/students?refer=embed" target="_blank" rel="noopener">#students</a> <a title="azure" href="https://www.tiktok.com/tag/azure?refer=embed" target="_blank" rel="noopener">#Azure</a> <a title="swa" href="https://www.tiktok.com/tag/swa?refer=embed" target="_blank" rel="noopener">#SWA</a> <a title="react" href="https://www.tiktok.com/tag/react?refer=embed" target="_blank" rel="noopener">#React</a> <a title="♬ original sound - Pikachu 🐣" href="https://www.tiktok.com/music/original-sound-7133546562290993926?refer=embed" target="_blank" rel="noopener">♬ original sound - Pikachu :hatching_chick:</a></section>