Skip to content
TypeScript
2.9 KB
Raw Blame
---
title: Waku
description: Package Waku RSC and static pages for Neon Functions, with native Waku development.
sidebar:
  order: 9
---

`Neon.Website.Waku` builds Waku's React Server Components handler and static pages
into a Node 24 Fetch artifact for a Neon Function. It reuses the Node build target,
but the deployed entry does not open a listening socket. No container or S3
website is created.

## Prepare the app

Use an existing Waku app or the
[runnable Waku example](https://github.com/alchemy-run/alchemy/tree/main/examples/neon-website-waku).
Keep the React/RSC peer versions compatible with your Waku version. Configure
[deployment credentials](/neon/setup), then install in the app directory:

Install [Alchemy and its matching Effect dependencies](/getting-started) first;
use Node 24 for this build toolchain.

```sh
pnpm add -D @alchemy.run/frontend-frameworks @vercel/nft
```

Keep `waku.config.*`, but do not set `unstable_adapter`: the integration selects
Waku's Node adapter. The `waku` resource prop accepts `srcDir`, `distDir`, and
`basePath` overrides.

## Define the stack

```typescript
// alchemy.run.ts
import * as Alchemy from "alchemy";
import * as Neon from "@alchemy.run/neon";
import * as Effect from "effect/Effect";

export default Alchemy.Stack(
  "NeonWaku",
  { providers: Neon.providers(), state: Alchemy.localState() },
  Effect.gen(function* () {
    const site = yield* Neon.Website.Waku("Web", {
      rootDir: ".",
    });
    return { url: site.url };
  }),
);
```

The Fetch wrapper serves built files and resolves extensionless HTML paths before
falling through to Waku's handler. Dynamic rendering and RSC requests use that
handler. Server code can read private `env` values from `process.env`; never pass
service credentials through client-component props or public build variables.

## Develop and deploy

```sh
pnpm exec alchemy dev
pnpm exec alchemy deploy
pnpm exec alchemy destroy
```

Run separately, destroying when finished. Dev runs Waku's native development
server and HMR, returns a local URL, and creates no implicit Project or Function.
Append `.pipe(Alchemy.remote())` to the Website Effect to use live deployment during dev.

Without scope, live deploy creates an Ohio Project. Pass either `project` or
`branch` for an existing backend; choose Ohio when adding storage. See
[scope and credentials](/neon/frontend/vite#scope-and-credentials).

:::caution[Deployment limits]
Complete live framework acceptance remains unverified. Native RSC development
does not establish production acceptance, and Neon probes have served old
code/env after deployment metadata changed. No CDN or durable framework cache
is added; domain registration is not TLS validation. See the
[shared deployment limits](/neon/frontend/vite#environment-and-deployment-limits).
:::

## Reference

- [Waku API](/providers/neon/website/waku)
- [Runnable Waku example](https://github.com/alchemy-run/alchemy/tree/main/examples/neon-website-waku)