> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reliantlabs.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy Vite with Reliant Forge

> Deploy a Vite single-page app (React, Vue, Svelte) to Reliant's free static hosting and CDN: adopt it in place with forge, build one release, and deploy it, with or without an account.

You will put an existing Vite app on [Reliant hosting](https://docs.reliantlabs.io/hosting/overview.md)'s static hosting, behind a CDN, on a generated hostname. A Vite build is already a folder of static files, so Forge adds only its declarations and never touches `package.json`, `src/` or `vite.config.ts`. This guide was run on a fresh `npm create vite@latest -- --template react-ts` app at Forge `v1.10.1-0.20261123064811-54313eead62f`.

## Before you begin

* Node.js, and the app in a git repository. `npm run build` must succeed.
* Forge: `reliant forge` inside Reliant, or `npx -y @reliantlabs/forge@latest` anywhere else.
* Nothing to pay: one hosted static site per person is free (1 GiB of storage, 10 GiB of traffic a month). Each environment's site counts, so staging and prod both deployed is two.

## What the build must produce

Forge publishes the directory the env's `public_dir` names, `dist` for Vite. Two settings in `vite.config.ts` decide whether the result works:

* **`build.outDir`** must stay `dist` (or match `public_dir` in each env's `main.k`).
* **`base`** must match where the site is mounted. At the root of its hostname that is Vite's default, `/`. A `base: "/app/"` copied from a GitHub Pages setup makes every asset 404.

`reliant forge lint --static-export` checks both and prints what it found, for example `web (vite-spa): base "/" (Vite's default — vite.config.ts sets no base) matches the mount in env prod, staging`.

Client-side routes work: an unknown path with no extension falls back to `index.html` with a 200, so React Router's `/settings` loads. A missing file with an extension is a 404. Anything in the bundle is public, so a `VITE_*` variable is never a secret; an API key belongs on a backend.

**1. Adopt the app**

```bash terminal theme={null}
reliant forge project new --in-place --kind site --name my-site
```

```text Output theme={null}
✅ Static site 'my-site' adopted at /home/you/my-site
   frontend "web": the vite app at the root (path ".", builds into dist/)
   wrote forge.yaml, deploy/kcl/kcl.mod (+ its empty kcl.mod.lock), deploy/kcl/{dev,staging,prod}/main.k, a gitleaks .pre-commit-config.yaml — no Go, no server
```

`--dry-run` works only with `--kind app`; for a site, review the files after writing them. Commit them, `kcl.mod.lock` included.

**2. Build and check**

```bash terminal theme={null}
npm run build
reliant forge lint --static-export
reliant forge env render prod
```

```text Output (trimmed) theme={null}
✓ built in 1.24s
✅ All 1 gating linters passed.
hosted (published to the control plane, not applied):
  web (static)
```

`reliant forge env up dev` runs the Vite dev server and mirrors the browser console into `.forge/logs/dev/`.

**3. Deploy**

Signed in, build one release and deploy it:

```bash terminal theme={null}
reliant forge env build prod --release v0.1.0
reliant forge env deploy prod v0.1.0
```

To promote the same bytes later, deploy that release to another env; nothing rebuilds. A second hosted site (staging as well as prod) needs billing, and until then that deploy is queued with exit **7**.

With no account, one command adopts the app if it isn't yet and publishes it:

```bash terminal theme={null}
npx -y @reliantlabs/forge@latest env deploy prod --claimable
```

It prints the URL and a claim link. The site stays up for 72 hours; opening the link and signing up (free) makes it permanent and yours. A static site isn't affected by the no-outbound-internet rule, because its requests come from the browser. Inside Reliant you are signed in and `--claimable` is refused: use the first form. See [Deploy without an account](https://docs.reliantlabs.io/forge/deploy-without-an-account.md).

**4. Verify**

```bash terminal theme={null}
reliant forge env status prod
curl -sI https://<your-host>/
curl -sI https://<your-host>/some/client/route
```

Both should return 200. Open the page in a browser and check the console for 404s on `/assets/…`, which mean a wrong `base`.

## Per-environment settings without a rebuild

A `VITE_*` value is baked in at build time, so a release built for staging carries staging's API URL into prod. For values that differ per env, put them in the frontend's `runtime_config` in each `main.k`; the platform serves them as `/config.js` (`window.__FORGE_CONFIG__`). Load it with a plain blocking `<script src="/config.js"></script>` in `index.html`'s `<head>`, before your bundle. [Deploy a static site](https://docs.reliantlabs.io/guides/forge/deploy-static-site-cdn.md) covers it, and custom domains, in full.

## Vite gotchas

* **Blank page, assets 404:** `base` doesn't match the mount.
* **`outDir` changed:** set `public_dir` in every env's `main.k` to match, or `lint --static-export` fails.
* **Over 1 GiB:** a release is kept three times, so about 340 MiB of build output fits. Move videos to object storage.

See also: [Adopt an existing Vite or Next.js app](https://docs.reliantlabs.io/guides/forge/adopt-existing-vite-nextjs.md), [Custom domains](https://docs.reliantlabs.io/hosting/custom-domains.md), [Hosting limits](https://docs.reliantlabs.io/hosting/limits.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.