Skip to content

Nuxt

Archil.Website.Nuxt deploys a Nuxt app to an Archil sandbox, through nitro’s Node server; prerendered pages are served first. The site is the program of its own sandbox, on port 3000, at a public https://3000-…archil.app URL. A stopped sandbox starts again on the next request.

The build integration is not bundled with alchemy. Install @alchemy.run/frontend-frameworks; the resource loads its /nuxt and /nuxt/node exports from your project at deploy time. It is only used at build time, so a dev dependency is enough:

Terminal window
pnpm add -D https://pkg.alchemy.run/@alchemy.run/frontend-frameworks/pr:2930:0cabab6

Your nuxt.config.ts loads natively — modules, layers, and all — so configure Nuxt exactly as you would outside Alchemy:

nuxt.config.ts
export default defineNuxtConfig({
modules: ["@nuxtjs/tailwindcss"],
routeRules: {
"/about": { prerender: true },
},
});

Deploy-specific overrides are merged over it via the nuxt prop (the override wins) — see Prerendering below for an example.

Don’t set nitro.preset — the Node deploy target owns the preset ("node"), and a foreign preset is a hard error.

Declare the site as a module-level const:

alchemy.run.ts
import * as Archil from "@alchemy.run/archil";
export const Website = Archil.Website.Nuxt("Website");

sandbox sizes the site’s sandbox and sets its image, timeouts, disks and network policy:

alchemy.run.ts
export const Website = Archil.Website.Nuxt("Website", {
sandbox: { vcpuCount: 2, memSizeMiB: 4096, idleTtlSeconds: 600 },
});

Yield the site from your Stack and return its URL:

alchemy.run.ts
import * as Archil from "@alchemy.run/archil";
import * as Alchemy from "alchemy";
import * as Effect from "effect/Effect";
export const Website = Archil.Website.Nuxt("Website");
export default Alchemy.Stack(
"MyNuxtSite",
{
providers: Archil.providers(),
state: Alchemy.localState(),
},
Effect.gen(function* () {
const site = yield* Website;
return { url: site.url };
}),
);

Run alchemy deploy. url is the site’s https://3000-…archil.app URL. site.sandbox is the sandbox behind it, and undefined under alchemy dev.

See examples/archil-website-nuxt for the checked-in example.

Process environment is the top-level env prop — plain strings, or Redacted values. They are copied onto process.env before build and alchemy dev, and onto the program at deploy:

alchemy.run.ts
export const Website = Archil.Website.Nuxt("Website", {
env: {
GREETING: "Hello from Alchemy!",
NUXT_PUBLIC_API_BASE: "https://api.example.com",
},
});

This is the hosted Node process, not Worker bindings. NUXT_-prefixed keys override Nuxt runtimeConfig the usual way; NUXT_PUBLIC_ values are inlined into the client at build time.

The nitro server is a plain Node process, so server routes and SSR read the environment from process.env:

server/api/hello.ts
export default defineEventHandler(() => {
return { greeting: process.env.GREETING ?? "hello" };
});

Routes marked for prerendering in routeRules (or via nitro.prerender) render at build time into .output/public and are uploaded with the program, served as static files before the nitro handler:

export const Website = Archil.Website.Nuxt("Website", {
nuxt: {
routeRules: {
"/about": { prerender: true },
},
},
});

Nitro’s isr route rule is implemented only by the Vercel and Netlify presets. On the Node preset it is silently ignored at build time, and the route renders on demand like any other SSR route. Use prerender for build-time static routes, or cache route rules for runtime caching.

Terminal window
bun alchemy dev

alchemy dev runs Nuxt’s own dev server (nitro dev, full HMR) instead of deploying; site.url is the local address and no Archil resources are created. Wrap the site in Alchemy.remote() to deploy the live sandbox even during dev.