Octane
Prisma.Website.Octane runs your OctaneJS
project’s Vite build. Octane builds the client and SSR bundles; the
shared Node target wraps the fetch handler as an HTTP program. Both
outputs are uploaded as tar.gz and run on Bun in Prisma Compute,
not a Docker Node container.
Install
Section titled “Install”Install the build-time integration; the resource loads /octane and
/octane/node from your project:
bun add -d @alchemy.run/frontend-frameworks @vercel/nftnpm install -D @alchemy.run/frontend-frameworks @vercel/nftpnpm add -D @alchemy.run/frontend-frameworks @vercel/nftyarn add -D @alchemy.run/frontend-frameworks @vercel/nftConfigure Octane
Section titled “Configure Octane”Choose the shared Node marker adapter in octane.config.ts, not
aws() or cloudflare():
import { node } from "@alchemy.run/frontend-frameworks/octane/node-adapter";import { defineConfig, RenderRoute } from "@octanejs/vite-plugin";
export default defineConfig({ adapter: node(), router: { routes: [new RenderRoute({ path: "/", entry: ["App", "/src/App.tsx"] })], },});A missing or foreign adapter fails the build. The adapter selects the output format; Bun is still the deployed runtime.
Configure Vite
Section titled “Configure Vite”Put Vite plugins alongside Octane’s plugin in vite.config.ts:
import { octane } from "@octanejs/vite-plugin";import tailwindcss from "@tailwindcss/vite";import { defineConfig } from "vite";
export default defineConfig({ plugins: [octane(), tailwindcss()],});Declare the Website
Section titled “Declare the Website”import * as Prisma from "alchemy/Prisma";
export const Website = Prisma.Website.Octane("Website");rootDir defaults to ".". Omit project for a database-less project
created only on live deploy, or pass a project already in your Stack.
Add it to the Stack
Section titled “Add it to the Stack”import * as Alchemy from "alchemy";import * as Effect from "effect/Effect";
export default Alchemy.Stack( "MyOctaneSite", { providers: Prisma.providers(), state: Alchemy.localState() }, Effect.gen(function* () { const site = yield* Website; return { url: site.url }; }),);site.url is the Compute endpoint on deploy and the local dev URL otherwise.
Add environment variables
Section titled “Add environment variables”export const Website = Prisma.Website.Octane("Website", { env: { GREETING: "Hello from Alchemy!", API_BASE: "https://api.example.com", },});Strings or Redacted values are applied before build and dev, and
passed to Compute as process environment.
Read the environment in server code
Section titled “Read the environment in server code”new ServerRoute({ path: "/api/greeting", methods: ["GET"], handler: async () => Response.json({ greeting: process.env.GREETING ?? "hello", }),});Import ServerRoute from @octanejs/vite-plugin when adding this
route. Middleware and route handlers run on Bun and read process.env.
Asset routing
Section titled “Asset routing”Files in dist/client are served first without invoking the Octane
handler. Requests that miss the client assets go to Octane SSR. Both
paths run in Compute; static assets are not a separate CDN deployment.
Local dev
Section titled “Local dev”bun alchemy dev starts Octane’s Vite server with its in-process SSR,
server routes, RPC, and HMR. The Website creates no Prisma resources.
Use .pipe(Alchemy.remote()) to opt into live deployment during dev.
Custom domain
Section titled “Custom domain”const site = yield* Prisma.Website.Octane("Web", { domain: "app.example.com",});Prisma.CustomDomain requires the project’s current default branch.
Configure its returned DNS records yourself and verify status before
cutover; see Custom domains.