The best way to control Claude Code, Codex and more from any computer or phone

main
mdx 143 lines 4.4 KB
Raw
1 ---
2 title: Vinext
3 description: Deploy vinext to Prisma Compute with the shared Website API, native local development, and traced runtime dependencies.
4 sidebar:
5 order: 9.6
6 ---
7
8 import PackageManagers from "../../../../components/PackageManagers.astro";
9
10 export const devDeps = "@alchemy.run/frontend-frameworks @vercel/nft";
11
12 `Prisma.Website.Vinext` builds with the Vinext Vite API, then hosts vinext's production
13 Node server on **Bun in Prisma Compute**. Alchemy packages `dist/`, public
14 assets, and locally installed runtime dependencies into a `tar.gz` artifact.
15 There is no Dockerfile, registry, Wrangler configuration, or OpenNext build.
16
17 ## Install
18
19 Keep `vinext`, `react`, `react-dom`, and `react-server-dom-webpack` in your
20 application dependencies, and install `vite` and `@vitejs/plugin-rsc` for
21 building. Add the Alchemy integration and dependency tracer:
22
23 <PackageManagers dev={devDeps} />
24
25 ## Configure vinext
26
27 ```typescript
28 // vite.config.ts
29 import { defineConfig } from "vite";
30 import vinext from "vinext";
31
32 export default defineConfig({
33 plugins: [vinext({ prerender: true })],
34 });
35 ```
36
37 Alchemy injects the Node data-cache adapter during deployment. No Alchemy plugin
38 is required in `vite.config.ts`. Configure deployment settings on
39 `Prisma.Website.Vinext` and leave Cloudflare plugins out of the Vite config.
40
41 ## Declare the Website
42
43 ```typescript
44 // alchemy.run.ts
45 import * as Prisma from "@alchemy.run/prisma";
46
47 export const Website = Prisma.Website.Vinext("Website", {
48 rootDir: ".",
49 });
50 ```
51
52 A live deployment creates a database-less project when `project` is omitted.
53 Pass an existing project to share it with other applications.
54
55 ## Add it to the Stack
56
57 ```typescript
58 import * as Alchemy from "alchemy";
59 import * as Effect from "effect/Effect";
60
61 export default Alchemy.Stack(
62 "MyVinextSite",
63 { providers: Prisma.providers(), state: Alchemy.localState() },
64 Effect.gen(function* () {
65 const site = yield* Website;
66 return { url: site.url };
67 }),
68 );
69 ```
70
71 `site.url` is the Compute endpoint on deploy and the native dev-server URL locally.
72 The result also exposes `compute`, `project`, and `domain`, matching other
73 Prisma Website constructors.
74
75 ## Add environment variables
76
77 ```typescript
78 export const Website = Prisma.Website.Vinext("Website", {
79 env: { GREETING: "Hello from vinext on Prisma!" },
80 });
81 ```
82
83 `env` is available during build, development, and production. Server components,
84 route handlers, and server actions read `process.env`. Public framework variables
85 can be compiled into browser assets; keep secrets out of public keys.
86
87 ## Configure the data cache
88
89 The default cache is process-local and does not survive a Compute restart or
90 provide cross-instance consistency. For persistent ISR and `"use cache"`, provide
91 an existing Redis endpoint:
92
93 ```typescript
94 import * as Redacted from "effect/Redacted";
95
96 export const Website = Prisma.Website.Vinext("Website", {
97 env: {
98 REDIS_URL: Redacted.make("rediss://user:password@cache.example.com:6379"),
99 },
100 });
101 ```
102
103 The injected cache adapter uses Redis when `REDIS_URL` is set and memory
104 otherwise. Prisma.Website does not provision Redis. The same Node adapter is
105 used by Fly, Hetzner, and Railway.
106
107 ## Local development
108
109 ```sh
110 bun alchemy dev
111 ```
112
113 The Website runs `vinext dev` with native HMR without creating a Prisma project,
114 Compute service, or custom domain. Other resources declared in the Stack retain
115 their own provider behavior. Apply `.pipe(Alchemy.remote())` to deploy the
116 Website to Compute during development.
117
118 ## Custom domains
119
120 ```typescript
121 const site = yield* Prisma.Website.Vinext("Web", {
122 domain: "app.example.com",
123 });
124 ```
125
126 Configure the returned DNS records
127 and verify domain status before routing traffic; see
128 [Custom domains](/prisma/frontend/websites#custom-domains).
129
130 ## Packaging
131
132 Prisma runs the uploaded artifact without installing dependencies. `@vercel/nft`
133 traces the installed application's runtime graph. Native addons require a
134 Linux-compatible build environment; a macOS deployment does not cross-compile them.
135
136 ## Where next
137
138 - [vinext API reference](/providers/prisma/website/vinext).
139 - [Runnable example](https://github.com/alchemy-run/alchemy/tree/main/examples/prisma-website-vinext).
140 - [Websites](/prisma/frontend/websites) and [Compute apps](/prisma/compute/apps).
141 - [vinext on Cloudflare](/cloudflare/frontend/vinext), [AWS](/aws/frontend/vinext),
142 [Fly](/fly/frontend/vinext), [Hetzner](/hetzner/frontend/vinext), and
143 [Railway](/railway/frontend/vinext).