# Frameworks

HostEdge deploys a folder of static files, plus optional server code that runs as a Worker on a global edge network. **Any framework that can build to static files works, and Next.js, Astro, SvelteKit, Nuxt and React Router can render on the server too.** The presets below only fill in the commands and the output folder; you can change them at any time in **Project › Settings**.

HostEdge looks at your `package.json` (and your lockfile) when you upload or import a project and picks the most specific match, so a Nuxt project is detected as Nuxt rather than Vite.

## Static sites

| Framework   | Detected when                    | Build command        | Output            |
| ----------- | -------------------------------- | -------------------- | ----------------- |
| Static HTML | An `index.html`, no build script | none                 | the folder itself |
| Astro       | `astro`                          | `npm run build`      | `dist`            |
| Gatsby      | `gatsby`                         | `npm run build`      | `public`          |
| Eleventy    | `@11ty/eleventy`                 | `npx @11ty/eleventy` | `_site`           |

## Apps

| Framework                   | Detected when                 | Build command       | Output                |
| --------------------------- | ----------------------------- | ------------------- | --------------------- |
| Next.js (static export)     | `next`                        | `npm run build`     | `out`                 |
| Nuxt (static)               | `nuxt`                        | `npx nuxi generate` | `.output/public`      |
| SvelteKit (static)          | `@sveltejs/kit`               | `npm run build`     | `build`               |
| React Router (SPA mode)     | `@react-router/dev`           | `npm run build`     | `build/client`        |
| Vite + React, Vue or Svelte | `vite` and the UI library     | `npm run build`     | `dist`                |
| Vite                        | `vite` (Solid, Preact, Lit …) | `npm run build`     | `dist`                |
| Angular                     | `@angular/core`               | `npm run build`     | `dist/<name>/browser` |
| Create React App            | `react-scripts`               | `npm run build`     | `build`               |

Single-page apps (Vite, Angular, Create React App, React Router) are served with SPA fallback: unknown paths return `index.html` so client-side routing works. Everything else returns your `404.html` if you have one.

## Documentation

| Framework  | Detected when      | Build command                          | Output                     |
| ---------- | ------------------ | -------------------------------------- | -------------------------- |
| Docusaurus | `@docusaurus/core` | `npm run build`                        | `build`                    |
| VitePress  | `vitepress`        | the script that runs `vitepress build` | `<folder>/.vitepress/dist` |

## Server-rendered apps

| Framework             | Detected when                                     | Build command                               | Output                   |
| --------------------- | ------------------------------------------------- | ------------------------------------------- | ------------------------ |
| Next.js (full)        | `next`                                            | `npx opennextjs-cloudflare build`           | `.open-next/assets`      |
| Astro (server)        | `astro` and `@astrojs/cloudflare`                 | `npm run build`                             | `dist/client`            |
| SvelteKit (server)    | `@sveltejs/kit` and `adapter-cloudflare`          | `npm run build`                             | `.svelte-kit/cloudflare` |
| Nuxt (server)         | `nuxt` and `nitro-cloudflare-dev` or `wrangler`   | `npx nuxi build --preset=cloudflare_module` | `.output/public`         |
| React Router (server) | `@react-router/dev` and `@cloudflare/vite-plugin` | `npm run build`                             | `build/client`           |

Each framework's edge adapter writes the server code; after your build command, HostEdge bundles it into a Worker (with `wrangler deploy --dry-run`, using your `wrangler.jsonc` if the project has one) and serves your static files next to it. Pages, API routes, server actions, middleware, loaders and form actions all work. Prerendered pages are served as files without waking the server.

Things to know:

- **Next.js** works without setup. If the project has no `@opennextjs/cloudflare`, `open-next.config.ts` or `wrangler.jsonc`, the build adds them (your own files always win). For a static export (`output: "export"`), pick **Next.js (static export)** instead.
- **Next.js caching (ISR) is on automatically.** The first deploy creates a page cache and a tag database for the project (shown in **Storage**, free and not counted against your plan). Pages prerendered at build time are in the cache before the deploy goes live. Pages with `revalidate` are served instantly and refreshed in the background once stale; `revalidatePath` and `revalidateTag` work across all visitors. If you bring your own `open-next.config.ts`, use the object-storage incremental cache and the database tag cache to get the same behaviour.
- **Node.js APIs** are available (`nodejs_compat`): `Buffer`, `AsyncLocalStorage`, `crypto` and most of `node:*`. Native modules and child processes are not.
- **Bindings** from your own wrangler config are not used. Databases, key-value stores and file storage you create in **Project › Storage** are bound by name, and environment variables are available as usual.
- **Size**: the server bundle must stay under 10 MB gzipped. The build log shows how many modules were bundled.

## Workers

| Framework | Detected when | Build command   | Output                         |
| --------- | ------------- | --------------- | ------------------------------ |
| Hono      | `hono`        | `npm run build` | `dist`, with `dist/_worker.js` |

A `_worker.js` file at the top of the output folder becomes the Worker. For several modules, write a `_worker.js/` folder with an `index.js` entry (the usual Pages-style layout); `.js`, `.mjs`, `.cjs`, `.wasm`, `.txt`, `.html`, `.sql` and `.bin` files in it are uploaded as modules and never served as files. Static files are served alongside through the `ASSETS` binding. Workers run with the per-plan CPU and subrequest limits listed on [Pricing](https://hostedge.app/pricing), and outbound requests to private networks and cloud metadata endpoints are blocked.

## Anything else

Pick **Other** and set the build command and output folder yourself. If your tool writes HTML, CSS and JavaScript to a folder, HostEdge can host it.

## Package managers

HostEdge installs with the package manager your lockfile names: `npm ci` for `package-lock.json`, `pnpm install --frozen-lockfile` for `pnpm-lock.yaml`, and `yarn install --frozen-lockfile` (or `--immutable` for Yarn 2+) for `yarn.lock`. Without a lockfile it follows the `packageManager` field in `package.json`, then falls back to `npm install`. Builds run on Node.js 22. Bun projects build with npm.

## Root directory

For monorepos, set the root directory to the folder that contains the app's `package.json`. Commands run there and the output folder is relative to it. A lockfile at the repository root is still used.
