# How to deploy a Vite React app.

URL: https://antideploy.com/blog/how-to-deploy-a-vite-react-app

A Vite app is a static site on Antideploy: it builds to a folder of files, and the files are served for free.

## At a glance

- **vite build**: Needs a build script
- **dist**: Or the outDir in your Vite config
- **Free and unlimited**: Static sites never count
- **Routes work**: Refreshing a route returns your app

Published 7 October 2026. Facts checked 7 October 2026. 3 min read.

## The short answer

To deploy a Vite React app, give your coding agent the sentence below. Antideploy sees Vite in your `package.json`, runs `npm run build`, and serves the output folder, `dist` by default, as a static site. It is free on every plan and never counts against your apps or deploys.

> **Say this to your coding agent**
>
> Set this project up to deploy on Antideploy. Fetch https://antideploy.com/agent.md and follow it.

## What Antideploy detects

- **Vite.** Detected from the `vite` dependency. Create React App, Astro, Gatsby and SvelteKit with the static adapter are treated the same way.
- **The build.** It needs a `build` script in `package.json`, such as `vite build`. Without one there is no output folder, and Antideploy says so.
- **The output folder.** `dist`, or the `outDir` your Vite config sets.
- **The start script.** A `start` script that only runs a development server, such as `vite` or `vite preview`, is ignored. A real server script, such as `node server.js`, is kept and the project becomes an app with a server.

## Variables in a Vite app

Vite copies variables that start with `VITE_` into the built files while it builds. That has two effects.

- Set a `VITE_` variable before the build, because setting it afterwards cannot repair a build that already ran without it
- Anyone who loads your site can read a `VITE_` variable, so never put a secret in one
- Secrets belong on a server, behind an API your app calls

## Pages, links and refresh

React Router and similar libraries change the address in the browser without asking the server. If someone refreshes on `/dashboard`, the server has no file called `dashboard`. The server that hosts your files sends `index.html` for any address without a file extension, so your app loads and its router takes over. A missing file with an extension, such as a missing image, returns a 404.

## Talking to an API

Do not use `localhost` for the API address, because on a visitor's computer `localhost` is their own machine. Read the address from a `VITE_` variable, or use a relative path when the API is on the same site. If the API is a separate Antideploy app, it must allow your site's address with CORS. See [how to deploy a full-stack app](https://antideploy.com/blog/how-to-deploy-a-full-stack-app).

## Step by step

### 1. Check the build on your machine

`npm run build` should pass and write a `dist` folder.

### 2. Paste the sentence and approve one link

Your agent starts a login and shows you a link and a code. Open it, check the code and click Approve.

### 3. Open your address

Your agent deploys and tells you where it is live, in the form `my-app.antideploy.app`, with HTTPS.

## Here's where it stops.

A platform that only tells you what it is good at is one you find the edges of in production. These are the ones to know before your first deploy.

### Apps sleep when idle

On every plan, an app nobody is using goes to sleep and the next visit wakes it. The first request took 2.9 to 13.9 seconds in our measurements, depending on the stack. There are no always-on workers, so use a cron job or a webhook for background work.

### One region

Everything runs in Singapore, with the database beside the app. Users far from Asia will see slower responses.

## Vite questions, answered.

Anything else? Write to us and a person answers.

[support@antideploy.com](mailto:support@antideploy.com)

### Is a Vite app really free to host?

Yes. It is a static site. Static sites are free on every plan, forever, and never count against your apps or deploys.

### Why is the first visit slow?

Static sites sleep when idle like every app. Measured on 19 September 2026, the first request after sleeping took 6.3 to 6.6 seconds for a Vite single-page app, and the next request about 0.16 seconds.

### Can I use my own domain?

Yes, from the Go plan, with HTTPS included. Free accounts get an address ending in `.antideploy.app` that they can rename.

### My build fails with "Could not resolve". What is wrong?

Usually an import whose path or capital letters do not match the file, because the build runs on Linux. See [Module not found](https://antideploy.com/blog/module-not-found-cant-resolve).

### Can I add a backend later?

Yes. Add a server and the project becomes an app with a server, with the same address.

## More guides, and the platform.

Each platform page covers one part of Antideploy: what it does, where it stops and the questions people ask. [See the whole platform](https://antideploy.com/platform), or [all the guides](https://antideploy.com/blog).

- [How to deploy a static website for free](https://antideploy.com/blog/how-to-deploy-a-static-website-for-free): Plain HTML or a built frontend. Unlimited, free on every plan, with HTTPS and no card.
- [How to deploy a full-stack app](https://antideploy.com/blog/how-to-deploy-a-full-stack-app): A frontend, an API and a database. One app or two, and what to do about each piece.
- [Module not found: Can't resolve](https://antideploy.com/blog/module-not-found-cant-resolve): The build cannot find an import. Match capital letters exactly, add the package, or commit the file.

- [Static sites](https://antideploy.com/platform/static-sites)
- [Deployments](https://antideploy.com/platform/deployments)
- [Environment variables](https://antideploy.com/platform/environment-variables)
- [Custom domains](https://antideploy.com/platform/custom-domains)

Facts on this page were checked against the live platform on 7 October 2026.

## Deploy something. Start with one sentence.

Paste one sentence into your coding agent, click Approve once, and get a live link. No card, no trial clock.

To set this up, give your coding agent this sentence:

```text
Set this project up to deploy on Antideploy. Fetch https://antideploy.com/agent.md and follow it.
```
