How to Deploy React App on Elestio
Tags: opensource, elestio, react, deploy
Published: 2023-10-11 12:16:15

---
title: How to Deploy React App on Elestio
published: true
date: 2022-11-21 08:24:19 UTC
tags: opensource, elestio, react, deploy
canonical_url: https://elestio.hashnode.dev/how-to-deploy-react-app-on-elestio
---

So you made a React web application and want to deploy it to the cloud 🚀

You probably heard about Kubernetes (and all its complexity) or various options to deploy your apps like Heroku, Render Fly, or Railways. They all have something in common, those products are building your own source code on every commit from your GIT repository.

Elestio is doing the same **but different!** Instead of deploying your app to a shared cluster, we deploy to dedicated VMs.

In this tutorial, we will deploy a simple ReactJS app that was created using the create-react-app command. You can use any existing application, create a new one with create-react-app, or simply fork and use our example by following the [**_link_**](https://github.com/elestio-examples/reactjs?ref=blog.elest.io).

> _To learn more about the elestio CI-CD, go_ [**here**](https://docs.elest.io/books/cicd-pipelines/page/overview?ref=blog.elest.io).

<iframe src="https://www.youtube.com/embed/BhFAWWwF6Q8?feature=oembed" width="700" height="393"></iframe>

If youre new, sign up for [_Elestio_](https://dash.elest.io/?ref=blog.elest.io), otherwise, login to your existing account.

**Deploy a ReactJs web app with CI/CD to the cloud**

#### Step 1:

Go to CI/CD from the left sidebar.

#### Step 2:

Now, select the deployment source.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005830095/fb85337b-06c7-4f6d-804e-14daec1d20ee.png)

In this tutorial, Im deploying using GITHUB, but you can also use GITLAB if you have a project there.

#### Step 3:

Select the repository.

If you have already authenticated your GITHUB or GITLAB account in ci-cd for repository access, you can choose the desired repository to deploy directly. Otherwise, you must first authenticate your GIT account with elestio ci-cd for repository access.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005832789/81a0e119-00c2-4f90-ae56-efb427b5ff09.png)

**Step 4:**

Choose Deployment Targets

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005834343/a1788c37-9ec2-40b3-b704-50ab30e49828.png)

Elestio offers two types of deployment targets **Deploy on a new VM** and **Deploy on an existing VM**.

> _You are allowed to set up n pipelines on each elestio Ci-CD target/VM. According to the project configuration you select and the project youre deploying, the number of pipelines varies._

If you want to deploy these projects as a pipeline on a new Target/VM or dont have any installed targets, choose Deploy on a new VM. If you already have any installed or previously configured ci-cd targets/VMs, choose Deploy on an existing VM, and then choose the existing target from the targets dropdown.

Follow the steps below only if you select **Deploy on a new VM** , otherwise click the next button to proceed.

> _CI/CD Pipelines by Elestio are available with our 5 cloud partners (AWS Lightsail, Digital Ocean, Vultr, Linode & Hetzner) in 85 locations over 27 countries but also on any cloud (AWS, Azure, Google, Oracle, ) and on-premise with_ [_BYOVM._](https://doc.elest.io/books/cloud-providers/page/byovm-bring-your-own-vm?ref=blog.elest.io)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005836518/8c19e90e-f731-4e6b-8313-9d0e4392e060.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005838736/aafd85e5-3b0e-4ed2-9911-c667f3fbc065.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005840882/53abab1f-ff4f-46c7-877a-1cb4e3ef4759.png)

Now Customize the target name and project (where the CICD Target will be created).

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005843444/beea1159-a1cf-41e3-ba81-3a3c90ced41e.png)

> _If you want to deploy it with a different name and a different project, you can customize it. By default, we configure it with a dynamic target name and the current project._

**Step 5:**

Configure your Project

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005845755/fc368767-e6e3-4364-a037-832f67bb1538.png)

Here you can configure the project details by filling up the project name, branch, run time, version, framework, and root directory.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005847208/8cd637cd-83af-4855-8ccb-494087dab51a.png)

In the Build and output setting, you can configure your project install, run and build command.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005849514/c805fc91-9c4e-4be1-855d-635443d25df5.png)

The configuration of life cycle scripts is always optional; they should only be used if you want to execute a specific command before and after building your project. Otherwise, leave them empty.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005851313/d8cae3f4-53d4-4065-bf7c-31ddacfc1325.png)

You can list all of your projects API keys and secrets here if they were saved in ENV

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005853573/0e0ec196-a66b-4605-ba81-5ff5e9e066d6.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005855057/622a4af5-50eb-4a24-9123-4b6a912b6063.png)

The final step is to configure the exposed port and reverse proxy settings. You can specify the port on which your project will run here.

> _If your project includes_ **_elestio.yml_** \*, Elestio will auto-fill all of these fields. As in this tutorial, were using our ReactJs elestio example, so you can see in the above images that all of our fields are auto-filled.\*

Refer to these links to learn how to create our own [**_elestio.yml_**](https://docs.elest.io/books/cicd-pipelines/page/create-your-own-template-elestioyml?ref=blog.elest.io) for the project.

A sample elestio.yml for ReactJs is shown below. check it out on [**_github_**](https://github.com/elestio-examples/reactjs/blob/master/elestio.yml?ref=blog.elest.io)

```
config:
    runTime: 'NodeJs'
    version: '16'
    framework: 'React'
    buildCommand: 'npm run build'
    buildDir: 'build'
    runCommand: 'npm run start'
    installCommand: "npm install"
    icon: "src/logo.svg"
    screenshot: "src/screenshot.png"
ports:
  - protocol: "HTTPS"
    targetProtocol: "HTTP"
    listeningPort: "443"
    targetPort: "3000"
    targetIP: "172.17.0.1"
    public: true
    path: "/"
    isAuth: false
    login: ""
    password: ""
environments:
    - key: 'ENV'
       value: 'production'
webUI:
  - url: "https://[CI_CD_DOMAIN]"
    label: "Website"

```

**Step 6:**

Click the **_Create CI/CD pipeline_** button to deploy your pipeline.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005856651/453fdf19-bf12-418f-a011-70633b9b935a.png)

_In a couple of moments, your application was successfully deployed on elestio 🚀._

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1697005858469/b0a76ad8-2181-46c4-9e72-433fe491710a.png)

![](https://cdn-images-1.medium.com/max/800/0*-5V3c-LY77ywqwj5.gif)

You can now view your deployed URL and access your application by going to desired application pipeline details.

Please let us know by contacting our support [**_email_**](mailto:support@elest.io)or [**_ticketing_**](https://dash.elest.io/support/creation?ref=blog.elest.io)system if you give it a shot and encounter any problems or if anything goes wrong.

Join us on [**_discord_**](https://discord.gg/4T4JGaMYrD?ref=blog.elest.io) to know more.

_Originally published at_ [_https://blog.elest.io_](https://blog.elest.io/how-to-deploy-react-app-on-elestio/) _on November 21, 2022._