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

main
mdx 136 lines 3.66 KB
Raw
1 ---
2 title: Vocs
3 description: Deploy Vocs documentation to Prisma Compute with Prisma.Website.Vocs — static assets and Waku RSC on Bun, with Vocs dev locally.
4 sidebar:
5 order: 10
6 ---
7
8 import PackageManagers from "../../../../components/PackageManagers.astro";
9
10 export const devDeps = "@alchemy.run/frontend-frameworks @vercel/nft";
11
12 `Prisma.Website.Vocs` builds a [Vocs](https://vocs.dev) documentation
13 site and runs it on **Bun in Prisma Compute**. The shared Node target
14 serves client files and prerendered HTML first, then falls through to
15 Vocs' Waku RSC handler. The result is uploaded as `tar.gz`, not a Docker
16 image. Extensionless pages such as `/about` retain their normal URLs.
17
18 ## Install
19
20 Install the build-time integration; the resource loads `/vocs/node`
21 from your project. Keep `vocs` and its Waku peer dependencies installed.
22
23 <PackageManagers dev={devDeps} />
24
25 ## Configure Vocs
26
27 Your `vocs.config.*` loads natively. No adapter is needed:
28
29 ```typescript
30 // vocs.config.ts
31 import { defineConfig } from "vocs/config";
32
33 export default defineConfig({
34 title: "Docs",
35 sidebar: [
36 { text: "Home", link: "/" },
37 { text: "Guide", link: "/guide" },
38 ],
39 });
40 ```
41
42 Vocs controls its output directory through `vocs.config.*`; the default is
43 `dist`. If you change it to `build`, also ignore that directory so generated
44 files stay out of the default build-input hash:
45
46 ```text
47 # .gitignore
48 build/
49 ```
50
51 ## Declare the Website
52
53 ```typescript
54 // alchemy.run.ts
55 import * as Prisma from "@alchemy.run/prisma";
56
57 export const Website = Prisma.Website.Vocs("Website", {
58 rootDir: "./docs",
59 });
60 ```
61
62 Omit `rootDir` for a project at `.`. Omit `project` for a database-less
63 Prisma project created on live deploy, or pass an existing project.
64
65 ## Add it to the Stack
66
67 ```typescript
68 // alchemy.run.ts
69 import * as Alchemy from "alchemy";
70 import * as Effect from "effect/Effect";
71
72 export default Alchemy.Stack(
73 "MyVocsSite",
74 { providers: Prisma.providers(), state: Alchemy.localState() },
75 Effect.gen(function* () {
76 const site = yield* Website;
77 return { url: site.url };
78 }),
79 );
80 ```
81
82 `site.url` is the Compute endpoint on deploy and the local Vocs URL in dev.
83
84 ## Add environment variables
85
86 ```diff lang="typescript"
87 export const Website = Prisma.Website.Vocs("Website", {
88 rootDir: "./docs",
89 + env: { DOCS_TITLE: "Hello from Alchemy!" },
90 });
91 ```
92
93 `env` is applied before build and dev, and passed to Compute. These are
94 process environment variables, not Worker bindings.
95
96 ## Read the environment
97
98 ```typescript
99 const title = process.env.DOCS_TITLE ?? "Docs";
100 ```
101
102 Prerendered pages capture these values at build time; dynamic pages
103 read the runtime environment. Vocs defaults to dynamic rendering, so
104 its Waku RSC handler stays in the artifact. Deploying only a static
105 HTML shell would drop that handler and leave dynamic pages empty.
106
107 ## Local development
108
109 `bun alchemy dev` runs Vocs' own dev server with HMR and creates no
110 Prisma resources for the Website. Opt into live deployment during dev:
111
112 ```typescript
113 export const Website = Prisma.Website.Vocs("Website", {
114 rootDir: "./docs",
115 }).pipe(Alchemy.remote());
116 ```
117
118 ## Custom domain
119
120 ```typescript
121 export const Website = Prisma.Website.Vocs("Website", {
122 rootDir: "./docs",
123 domain: "docs.example.com",
124 });
125 ```
126
127 `domain` creates `Prisma.CustomDomain` and changes `site.url` to the
128 HTTPS hostname.
129 Configure returned DNS records yourself and verify status before cutover;
130 see [Custom domains](/prisma/frontend/websites#custom-domains).
131
132 ## Where next
133
134 - [Vocs API](/providers/prisma/website/vocs).
135 - [Vocs example](https://github.com/alchemy-run/alchemy/tree/main/examples/prisma-website-vocs).
136 - [Websites](/prisma/frontend/websites) and [Compute apps](/prisma/compute/apps).