Skip to content

@warlock.js/web

@warlock.js/web is Warlock’s React page layer. A page is an ordinary Warlock route that renders a document instead of JSON, so pages share the application’s route table, middleware, validation, request context, and lifecycle.

Pages render on the server and hydrate in the browser. After hydration, <Link> provides client navigation while loaders keep request-only work on the server.

Install only the highest layer you need. Dependencies are resolved for you:

Terminal window
warlock add web # React SSR page layer
warlock add tailwind # Web + Tailwind CSS v4
warlock add shadcn # Web + Tailwind + shadcn/ui prerequisites

For shadcn/ui, Warlock prepares the project; shadcn’s own CLI still adds the components:

Terminal window
npx shadcn@latest add button card

Do not run shadcn init after warlock add shadcn; Warlock has already written the project-specific aliases, stylesheet, design tokens, and cn helper.

See the complete Tailwind and shadcn/ui setup →

Create src/web/about.page.tsx:

src/web/about.page.tsx
import type { PageMetadata } from "@warlock.js/web";
export const metadata: PageMetadata = {
title: "About",
};
export default function AboutPage() {
return (
<main>
<h1>About</h1>
</main>
);
}

With no route export, that file serves /about. Warlock derives routes from files beneath src/web/; an explicit literal route can override the path and name when needed.

Upgrading from v4? Web is an opt-in addition in v5; start with the v5 migration guide.