# Deploy a React app on AWS
---
Deployment.io builds your React app from its repository and serves it from Amazon S3 and CloudFront in your own AWS account.
## Before you start
- The app is in a GitHub, GitLab or Bitbucket repository that's connected to Deployment.io. See [Adding a Repository](/docs/dashboard/adding-a-repository/).
- The app is built with Vite or Create React App.
## Deployment
1. Create a new Static site on Deployment.io.
2. Select your app's repository.
3. Build command: `npm run build`.
4. Publish directory: `dist` (Vite) or `build` (Create React App).
5. Single-page app: Yes.
6. Root directory: leave it empty unless the app lives in a subfolder of the repository (a monorepo). Then enter that folder.
7. Choose the Environment and click Deploy static site.
Your site is available at the CloudFront URL shown in the dashboard once the build finishes. See [Adding Custom Domains](/docs/dashboard/adding-custom-domains/) and [Automatic Deployment on Git Push](/docs/dashboard/automatic-deployment-on-git-push/).
## How the build runs
Deployment.io installs the app's dependencies before the build command, with the package manager its lockfile names — npm (`package-lock.json`), Yarn (`yarn.lock`) or pnpm (`pnpm-lock.yaml`). A `packageManager` field in `package.json` is honoured. So the build command is only the build itself — don't add an install step.
Builds run on Node.js 22, and `package.json` must be at the top of the repository or of the Root directory.
## Environment variables
The environment's variables are available to the build. Vite puts only variables with the `VITE_` prefix into the code that runs in the browser; Create React App puts only those with the `REACT_APP_` prefix.
Anything in a static site's build is public — never put a secret there.
## Routing
Client-side routing (for example React Router) works: any address without a file of its own serves `index.html`, and the router takes over.
---
Source: https://deployment.io/docs/guides/how-to-deploy-a-reactjs-app-on-aws/