How do I deploy React app

Hello. I’ve tried to search the forum and also read through the documentation. I could not find any clue on how to deploy a simple React app.

So, how do I do that? Thanks in advance.

Hello @kickloop,

First of all, welcome to Cleavr Forum.

We don’t have a guide for ReactJS at the moment but we do have a guide for deploying a NextJS app if that’d be helpful - Deploy a Next JS app - Cleavr docs

Deploying ReactJS should be straight forward with NodeJS SSR app type. Make sure to update the PM2 Ecosystem with "script": "npm" from Deployments > Deployment Workflow > PM2.

Please reach out to us if this doesn’t work or if you have any other questions.

Thank you! That does it. I’ve tried few times before, but your info helped and now it is deployed!

1 Like

Hi ! Can you please elaborate on your process. I have a react app generated by Vite.

In that case, it’s even easier. Create a NodeJs static site.

  1. Connect to your Github repository.
  2. Make sure you update the build command. ( build command: npm run build --production and set artifact folder to dist )

Just make sure you have the following in your package.json file. It should be predefined when you create your React app with Vite.

//package.json
"scripts": {
  ...
  "build": "vite build",
  ...
},

So, when npm run build --production is run, it actually executes vite build

Once all that is done, you should be able to deploy your React app.

1 Like