1---
2title: Vinext
3description: Deploy vinext to Hetzner with the shared Website API, native local development, and a platform-specific data cache.
4sidebar:
5 order: 9.6
6---
7
8import { Code, Tabs, TabItem } from "@astrojs/starlight/components";
9
10export const devDeps = "@alchemy.run/frontend-frameworks";
11
12`Hetzner.Website.Vinext` builds with the Vinext Vite API for production and runs native
13`vinext dev` locally. The built app runs on a Hetzner Cloud Server using vinext's production Node
14server as a systemd service. Alchemy creates a server when `server` is omitted
15and uploads `dist/` with the runtime dependency installation.
16
17## Install
18
19Keep `vinext`, `react`, `react-dom`, and `react-server-dom-webpack` in your
20application dependencies, with `vite` and `@vitejs/plugin-rsc` for building.
21Add the Alchemy integration:
22
23<Tabs syncKey="pkgManager">
24 <TabItem label="bun" icon="bun"><Code code={`bun add -d ${devDeps}`} lang="sh" /></TabItem>
25 <TabItem label="npm" icon="npm"><Code code={`npm install -D ${devDeps}`} lang="sh" /></TabItem>
26 <TabItem label="pnpm" icon="pnpm"><Code code={`pnpm add -D ${devDeps}`} lang="sh" /></TabItem>
27 <TabItem label="yarn" icon="seti:yarn"><Code code={`yarn add -D ${devDeps}`} lang="sh" /></TabItem>
28</Tabs>
29
30## Configure vinext
31
32```typescript
33// vite.config.ts
34import { defineConfig } from "vite";
35import vinext from "vinext";
36
37export default defineConfig({
38 plugins: [vinext({ prerender: true })],
39});
40```
41
42Alchemy injects the target-specific data-cache adapter during deployment.
43No Alchemy plugin is required in `vite.config.ts`; deployment settings belong on
44`Website.Vinext`. Leave Cloudflare plugins and Worker entrypoints out of this application.
45
46## Declare the Website
47
48```typescript
49// alchemy.run.ts
50import * as Hetzner from "alchemy/Hetzner";
51
52export const Website = Hetzner.Website.Vinext("Website", {
53 rootDir: ".",
54});
55```
56
57`rootDir`, `env`, `memo`, `assets`, `dev`, and `domain` use the same vocabulary
58as the other Website constructors. Framework configuration stays in
59`vite.config.ts` rather than a nested server configuration object.
60
61## Add it to the Stack
62
63```typescript
64import * as Alchemy from "alchemy";
65import * as Effect from "effect/Effect";
66
67export default Alchemy.Stack(
68 "MyVinextSite",
69 { providers: Hetzner.providers(), state: Alchemy.localState() },
70 Effect.gen(function* () {
71 const site = yield* Website;
72 return { url: site.url };
73 }),
74);
75```
76
77Keep the local state available for subsequent deploys and teardown.
78
79## Add environment variables
80
81```typescript
82export const Website = Hetzner.Website.Vinext("Website", {
83 env: { GREETING: "Hello from vinext on Hetzner!" },
84});
85```
86
87`env` is available during build, development, and production. Server code reads
88`process.env`; public framework variables may be compiled into browser assets.
89Keep secrets out of public keys and wrap credentials in `Redacted`.
90
91## Read the runtime environment
92
93```typescript
94// app/api/hello/route.ts
95export function GET(request: Request) {
96 const name = new URL(request.url).searchParams.get("name") ?? "world";
97 return Response.json({ name, greeting: process.env.GREETING ?? "hello" });
98}
99```
100
101Request-dependent route handlers read the production environment. A prerendered
102page reflects its build-time inputs instead.
103
104## Configure the data cache
105
106The default data cache is process-local. To persist ISR and `"use cache"`
107across restarts, supply an existing Redis endpoint through `env.REDIS_URL`.
108The Website does not install or provision Redis. Protect credentials with
109`Redacted.make` and keep the Redis service private.
110
111## Local development
112
113```sh
114bun alchemy dev
115```
116
117The Website runs `vinext dev` with native HMR and creates no cloud resources.
118Other resources declared in the Stack retain their own provider behavior.
119Apply `.pipe(Alchemy.remote())` to the Website for a live deployment during dev.
120
121## Custom domains
122
123```typescript
124const site = yield* Hetzner.Website.Vinext("Web", {
125 domain: "app.example.com",
126 zone,
127});
128```
129
130Hetzner requires an existing DNS `zone` when setting `domain`.
131See [Website domains](/hetzner/frontend/websites) for platform-specific DNS and
132certificate configuration.
133
134## Where next
135
136- [vinext API reference](/providers/hetzner/website/vinext).
137- [Runnable example](https://github.com/alchemy-run/alchemy/tree/main/examples/hetzner-website-vinext).
138- [Website overview](/hetzner/frontend/websites).
139- [vinext on Cloudflare](/cloudflare/frontend/vinext) and [Prisma](/prisma/frontend/vinext).