Skip to content

Vite

Source: src/Hetzner/Website/Vite.ts

Deploy a plain Vite application to a Hetzner Cloud Server: vite build output served by a static-file systemd unit on port 3000. For client-only projects — React/Vue/Solid SPAs, index.html multi-page apps — whose entire deployable output is static assets.

The build runs through @alchemy.run/frontend-frameworks/vite with the @alchemy.run/frontend-frameworks/vite/node deploy target — the package must be installed in your project. During alchemy dev the site is Vite’s own dev server and no cloud resources are created.

Basic Vite SPA

const site = yield* Hetzner.Website.Vite("Web");

Project in a Subdirectory

const site = yield* Hetzner.Website.Vite("Web", {
rootDir: "./app",
});

Existing Server

const server = yield* Hetzner.Server("box", {
serverType: "cpx12",
image: "ubuntu-24.04",
location: "fsn1",
});
const site = yield* Hetzner.Website.Vite("Web", { server });
const site = yield* Hetzner.Website.Vite("Docs", {
assets: { notFoundHandling: "404-page" },
});
const site = yield* Hetzner.Website.Vite("Web", {
domain: "app.example.com",
zone,
});
const site = yield* Hetzner.Website.Vite("Docs", {
outDir: "build",
base: "/docs/",
});
// `alchemy dev` starts `vite` programmatically: site.url is the local
// dev server (HMR included); no Server or Service is created.
const site = yield* Hetzner.Website.Vite("Web");