Deploy React, Vite & Next.js
OneHostBox builds your project, then serves the folder it produces (the publish directory) from a global CDN. Anything that builds to static files works: React, Vue, Svelte, Angular, Vite, Astro, Gatsby, Eleventy, Next.js static export and plain HTML.
Build settings
Section titled “Build settings”When you pick a repository, OneHostBox reads it and fills these in: it recognises Vite, Create React App, Next.js, Nuxt, SvelteKit, Astro, Gatsby, Docusaurus, VitePress, Angular, Eleventy and plain HTML, and your package manager and Node.js version. In a monorepo it lists the folders that hold an app. Change anything that’s different, now or later under Settings → Build settings.
If the project needs a server (for example a Next.js app with API routes or pages rendered on each request, or Nuxt, SvelteKit or Astro in server mode), the form says so before you deploy: OneHostBox hosts static files only.
| Setting | Default | What it is |
|---|---|---|
| Production branch | main |
Pushes to this branch deploy the live site. |
| Root directory | (repository root) | For a monorepo: the folder of the app, e.g. apps/web. |
| Build command | npm run build |
Runs after dependencies are installed. |
| Publish directory | dist |
The folder your build writes, relative to the root directory. |
| Node.js version | 24 | 24 (recommended), 22, 20 or 18. 20 and 18 are past end of life. |
Build command npm run build, publish directory dist.
Build command npm run build, publish directory build.
Next.js must be exported as static files. In next.config.js set output: 'export', then use build command npm run build and publish directory out. Server-side features (API routes, server rendering) don’t run on static hosting.
Astro: dist. SvelteKit with the static adapter: build. Gatsby: public. Eleventy: _site.
No build needed. With no package.json, the repository is published as it is (or the publish directory, if it exists).
If the publish directory doesn’t exist after the build but one of build, out, dist, _site or .output/public does (with an index.html in it), that folder is published and the build log tells you to set it explicitly.
Installing dependencies
Section titled “Installing dependencies”The package manager follows your lockfile: pnpm-lock.yaml uses pnpm, yarn.lock uses Yarn (Yarn 2+ when there’s a .yarnrc.yml), package-lock.json uses npm ci, and no lockfile uses npm install. Development dependencies are installed too.
For pnpm, the version in your package.json’s packageManager field is used (e.g. "packageManager": "pnpm@10.23.0"); without one, builds use pnpm 10. Setting it keeps your computer, CI and OneHostBox on the same version.
Monorepos
Section titled “Monorepos”Set the root directory to your app’s folder. Dependencies are installed at the repository root first, so workspaces (pnpm, Yarn, npm) resolve, then the build runs in the root directory.
Limits
Section titled “Limits”A build can run for up to 15 minutes and publish up to 500 MB. Builds run on Linux with 2 vCPUs, where file names are case-sensitive.
Routing: single-page apps and multi-page sites
Section titled “Routing: single-page apps and multi-page sites”Choose under Settings → Routing. Changes apply within a minute, without a redeploy.
- Automatic (recommended): decided on every deploy from your files.
- Single-page app:
/aboutloadsindex.htmland your app’s router shows the page. - Multi-page site:
/aboutloadsabout.html(orabout/index.html). A missing page shows your404.html.
Automatic picks a single-page app when index.html is an empty app shell (like <div id="root"></div>), and a multi-page site when there’s a 404.html or several HTML pages.
Redirects: _redirects
Section titled “Redirects: _redirects”Add a file named _redirects to the top of your publish directory (for Vite, put it in public/). One rule per line: from to [status].
/old-page /new-page 301/blog/* /news/:splat 301/docs/:slug /guides/:slug 302/app/* /index.html 200/go/github https://github.com/your-org 302- Status codes:
301(the default),302,303,307,308, and200to show another page without changing the address. *matches the rest of the path (only at the end) and is reused as:splat;:namematches one path segment.- The destination can be a path or a full
https://address. Proxying to another site (200to an external address) isn’t supported, nor are query-string or country conditions. - The first 1,000 rules are used. Rules that can’t be used are listed in the build log.
Headers: _headers
Section titled “Headers: _headers”Add a _headers file next to _redirects: a path, then indented Name: value lines.
/* X-Frame-Options: DENY Referrer-Policy: strict-origin-when-cross-origin
/assets/* Cache-Control: public, max-age=31536000, immutableValues must be plain text (ASCII), and a file can carry up to about 2 KB of custom headers. A few headers are set by the platform and can’t be changed (for example Content-Length and Date).