Stop choosing between a static site and a server app.
Every page in a Zero app picks how it renders: built once, cached and refreshed, rendered per request, or client-only. One line per page. Loaders, server actions, islands and seven deploy targets come in the same box.
npm create @pyreon/zero@latest - render modes
- SSG · ISR · SSR · SPAPer page with
export const renderMode, or by glob withrouteRules. - server rendering
- 6.5× faster than React 19Compiled SSR, 1,000 rows. One run, synthetic, author-run.
- deploy
- Node, Bun, Deno, Vercel, Netlify, Cloudflare, staticPicked from the build environment if you don't choose.
- forms
- work before JavaScript loads
<Form>posts to the page; JavaScript upgrades it to fetch.
- 6.5× faster compiled server rendering than React 19 at 1,000 rows (109.9 vs 714.4 µs a render)BENCHMARKS.md 2026-11-05 §5, overnight run, one run
- 4.02 ms to hydrate a 2,206-node app page: the fastest of Pyreon, React 19, Preact and Vue 3BENCHMARKS.md 2026-11-05 §4, final pass, one run
- 6.6 KB of hydration code (gzip) a production build drops on its own when every page is client-onlydocs/src/content/docs/zero.md, "SPA apps ship without hydration code" (measured on examples/kanban)
synthetic · author-run · M3 Max · record of 2026-11-05
Every result, including where we lose →The parts of a web app you would otherwise assemble.
One line decides each page
export const renderMode = 'ssg'on the landing page,'isr'on the blog,'spa'on the dashboard. A layout's choice cascades to the pages under it, and the build prints a table of what each route got.Cache the page, not the person
serverIsland()leaves a hole in a cached page that is filled per request: a cart badge, a greeting, a live price. The page around it stays on the CDN, and visitors without JavaScript see the fallback.Forms that work with JavaScript off
<Form>renders a real<form method="post">. With JavaScript, the same action runs over fetch withpending()and the optimisticinput(). A redirect answers 303, so a refresh never resubmits.Server code stays on the server
A
.server.tsfile next to a route is never imported by the client bundle, and the Vite plugin strips eachdefineActionhandler, plus the imports only it used, out of the browser build. Pyreon's own CI builds real apps and fails if a server-only marker turns up in their client files.
A form with a server action: three files, or one.
A server action file, a client component for the pending state and the error, and the page that renders it.
// app/posts/new/actions.ts
'use server'
import { redirect } from 'next/navigation'
import { db } from '@/lib/db'
export async function createPost(prev: { error?: string }, formData: FormData) {
const title = String(formData.get('title') ?? '').trim()
if (!title) return { error: 'Title is required' }
const id = await db.posts.create({ title })
redirect(`/posts/${id}`)
}
// app/posts/new/form.tsx
'use client'
import { useActionState } from 'react'
import { createPost } from './actions'
export function NewPostForm() {
const [state, action, pending] = useActionState(createPost, {})
return (
<form action={action}>
<input name="title" />
<button disabled={pending}>Create</button>
<p>{state.error}</p>
</form>
)
}
// app/posts/new/page.tsx
import { NewPostForm } from './form'
export default function Page() {
return <NewPostForm />
}One route file. The handler never reaches the browser, and the form works before JavaScript loads.
// src/routes/posts/new.tsx
import { redirect } from '@pyreon/router'
import { defineAction, fail, Form, useSubmission } from '@pyreon/zero/actions'
import { db } from '../../server/db'
export const action = defineAction(async ({ formData }) => {
const title = String(formData?.get('title') ?? '').trim()
if (!title) return fail(422, { error: 'Title is required' })
const id = await db.posts.create({ title })
throw redirect(`/posts/${id}`)
})
export default function NewPost() {
const submission = useSubmission(action)
return (
<Form action={action}>
<input name="title" />
<button disabled={submission.pending()}>Create</button>
<p>{() => submission.result()?.error ?? ''}</p>
</Form>
)
}The pieces Zero is made of.
Title, meta and link tags from any component, SSR-ready.
The SSR handler, SSG prerendering and islands underneath Zero.
npm create @pyreon/zero@latest gets you a running app.
One import for the whole fundamentals ecosystem.
Dev, build and preview commands.
Coming from React Router (framework mode) or Next.js App Router?
A route module with a loader and an action
// app/routes/posts.new.tsx
import { Form, redirect, useNavigation } from 'react-router'
import type { Route } from './+types/posts.new'
import { db } from '../db.server'
export async function action({ request }: Route.ActionArgs) {
const formData = await request.formData()
const title = String(formData.get('title') ?? '').trim()
if (!title) return { error: 'Title is required' }
const id = await db.posts.create({ title })
return redirect(`/posts/${id}`)
}
export default function NewPost({ actionData }: Route.ComponentProps) {
const navigation = useNavigation()
return (
<Form method="post">
<input name="title" />
<button disabled={navigation.state === 'submitting'}>Create</button>
<p>{actionData?.error}</p>
</Form>
)
}The shape you know: the file is the route, and the action sits next to the page. Routes come from the folder with no routes.ts to keep in sync, pending() and result() are signals, and one more line (export const renderMode) makes any page static, cached or client-only.
// src/routes/posts/new.tsx
import { redirect } from '@pyreon/router'
import { defineAction, fail, Form, useSubmission } from '@pyreon/zero/actions'
import { db } from '../../server/db'
export const action = defineAction(async ({ formData }) => {
const title = String(formData?.get('title') ?? '').trim()
if (!title) return fail(422, { error: 'Title is required' })
const id = await db.posts.create({ title })
throw redirect(`/posts/${id}`)
})
export default function NewPost() {
const submission = useSubmission(action)
return (
<Form action={action}>
<input name="title" />
<button disabled={submission.pending()}>Create</button>
<p>{() => submission.result()?.error ?? ''}</p>
</Form>
)
}A cached page that refreshes itself
// app/blog/[slug]/page.tsx
export const revalidate = 60
export default async function Post({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params
const post = await getPost(slug)
return <h1>{post.title}</h1>
}The refresh interval is set once for the app in zero({ isr }), not per page. A loader also runs in the browser on client-side navigation; put database code in a .server.ts file next to the route instead. On-demand refresh goes by tag: the ISR handler's revalidateTag('posts') drops every cached page that rendered posts.
// src/routes/blog/[slug].tsx
import { useLoaderData, type LoaderData } from '@pyreon/router'
export const renderMode = 'isr' // refreshed after zero({ isr: { revalidate } }), 60 s by default
export const loader = ({ params }: { params: Record<string, string> }) => getPost(params.slug!)
export default function Post() {
const post = useLoaderData<LoaderData<typeof loader>>()
return <h1>{post().title}</h1>
}Pick a route to see how it renders.
A sample src/routes folder. Each file chooses its own rendering with one export.
_layout.tsx · _404.tsx · _error.tsx · _loading.tsx
Built once, served from a CDN
Rendered to static HTML at build time.
- renders
- at build
- cached
- CDN, until the next deploy
- javascript
- only interactive parts
export const renderMode = 'ssg'Illustration of what zero build decides per route. Nothing renders on a server here.
Compiled server rendering led at every size we measured.
Fastest at 10, 100 and 1,000 rows against Vue 3, Svelte 5 and React 19, and 5.7–6.6× ahead of React. Hydrating a whole app page was the fastest of four. A 1,000-row table hydrates level with Vue, and Vue is marginally ahead on its total in one of two runs.
- compiled SSR, 10 rows1.8 µs2.18 µswin1.21× vs Svelte 5 (5.7× vs React 19)
- compiled SSR, 100 rows11.64 µs15.66 µswin1.35× vs Vue 3 (6.6× vs React 19)
- compiled SSR, 1,000 rows109.9 µs124.9 µswin1.14× vs Vue 3 (6.5× vs React 19)
- renderToString, cardwin8.95M/s · 4.68× vs Solid, byte-identical output
- renderToString, 1,000-item listwin11.3K/s · 1.72× vs Solid
- hydrate app page (2,206 nodes)4.02 ms4.15 mswin1.03× vs React 19, 1.11× vs Vue 3 (one run)
- hydrate 1,000-row table: framework walk1.16 ms1.17 mstielevel with Vue 3 in both runs
- hydrate 1,000-row table: total6.04 ms5.99 mssplittie in run 1, Vue 3 1.01× ahead in run 2
- head serialize, 5 / 20 / 50 tagswin1.50× / 1.27× / 1.22× vs Unhead
Included, configured, and out of the bundle when you don't use it.
- File-system routing with layouts, URL-invisible
(groups), and_error,_loadingand_404files per segment - Typed routes:
typedRoutes: truemakes<Link href="/postz/1">a compile error - Server loaders in a
.server.tsfile, fetched in one request per navigation - Server actions with a no-JavaScript fallback, pending state, an origin check and a 1 MiB body limit
- Schema-validated actions:next release
defineAction(schema, handler)with any Standard Schema - ISR with tag invalidation: a webhook calls
revalidateTag('posts')on the ISR handler, andcreateFsStoresurvives a restart - Server islands for per-request fragments inside cached pages
- Optimised images, self-hosted fonts, favicons and OG images drawn in JSX, plus a service worker that precaches exactly what shipped
- Env validation: only
ZERO_PUBLIC_*reaches the client, and a missing declared variable fails the build - Sessions, CSP nonces, CORS and rate limits, through the same request pipeline in dev and production
Things to build with it.
Set the default once and override by path. A page's own renderMode export still wins over the rule, and the build prints the mode each route resolved to.
// vite.config.ts
import pyreon from '@pyreon/vite-plugin'
import zero from '@pyreon/zero/server'
export default {
plugins: [
pyreon(),
zero({
mode: 'ssr', // the default for any route that does not say otherwise
isr: { revalidate: 60 },
routeRules: {
'/about': { renderMode: 'ssg' }, // built once, served from the CDN
'/blog/**': { renderMode: 'isr' }, // cached, refreshed every 60 s
'/app/**': { renderMode: 'spa' }, // client-only dashboard
},
}),
],
}The pricing page is cached for everyone. The badge is fetched per visitor from a fragment endpoint that createServer mounts for you, and it renders with the request's locals, exactly like a page.
// src/islands/CartBadge.tsx: rendered per request, on the server
import { useRequestLocals } from '@pyreon/server'
export default function CartBadge() {
// set by your session middleware: ctx.locals.cartCount = …
const count = Number(useRequestLocals().cartCount ?? 0)
return <a href="/cart">Cart ({count})</a>
}
// src/routes/pricing.tsx: the page is cached, the badge is not
import { serverIsland } from '@pyreon/zero'
export const renderMode = 'isr'
const CartBadge = serverIsland(() => import('../islands/CartBadge'), {
name: 'CartBadge',
fallback: <a href="/cart">Cart</a>,
})
export default function Pricing() {
return (
<main>
<header>
<CartBadge />
</header>
<h1>Pricing</h1>
</main>
)
}Pass any Standard Schema (Zod, Valibot, ArkType or @pyreon/validate) before the handler. Bad input never reaches it: the action answers 422 with messages per field, and the handler receives typed, parsed data.
// src/routes/posts/new.tsx
import { s } from '@pyreon/validate'
import { defineAction, Form, useSubmission } from '@pyreon/zero/actions'
import { db } from '../../server/db'
export const action = defineAction(
s.object({ title: s.string().min(3), tags: s.array(s.string()) }),
async (input) => db.posts.insert(input), // input: { title: string; tags: string[] }
)
export default function NewPost() {
const sub = useSubmission(action)
const titleError = () => {
const r = sub.result()
return r && 'fields' in r ? (r.fields.title?.join(', ') ?? '') : ''
}
return (
<Form action={action}>
<input name="title" />
<p>{titleError}</p>
<input name="tags" value="news" />
<input name="tags" value="release" />
<button>Publish</button>
</Form>
)
}Split by where it runs: the main entry is browser-safe.
Every export has a reference page with its signature, an example and the mistakes people make with it.
- Link
- Image
- Script
- Meta
- Icon
- island
- serverIsland
- useLocale
- setLocale
- registerServiceWorker
- defineAction
- fail
- Form
- useSubmission
- defineConfig
- createServer
- createApp
- createISRHandler
- createMemoryStore
- createFsStore
- nodeAdapter
- bunAdapter
- denoAdapter
- vercelAdapter
- netlifyAdapter
- cloudflareAdapter
- staticAdapter
- https
- sessionMiddleware
- getSession
- seoPlugin
- faviconPlugin
- validateEnv
- publicEnv
- cspMiddleware
- useNonce
- corsMiddleware
- rateLimitMiddleware
- fontPlugin
- reportWebVitals
Good to know before you start.
mode: 'auto' is experimental
Zero can infer each page's mode from its exports. Read the mode table the build prints, and declare renderMode on any page where the answer matters.
Streaming is opt-in
Set ssr: { mode: 'stream' }. ISR routes always render buffered, because the cache stores whole responses.
More than one server needs shared state
The default ISR store is in memory and createFsStore is for a single box. Behind a load balancer, plug in a shared store (Redis, KV). From the next release, server-island fragments are signed: set the same PYREON_ISLAND_SECRET on every instance.
Big static builds multiply
Dynamic routes times locales adds up. Use ssg.concurrency, ssg.workers and onProgress on large sites.
What people ask first.
Is it ready for production?
Zero is a Stable package: from 1.0 a breaking change lands only in a major version (before 1.0, in a minor), always with a changelog entry, and pyreon upgrade --write aligns your @pyreon/* versions and runs the codemod for any break that can be migrated mechanically. pyreon.dev itself is built and deployed with it.
How is it different from Next.js?
One render pipeline for every mode, so the same loader works in SSR, ISR, SSG and SPA, and the mode is a per-page export. There are no server and client component trees to split. Components run once and update through signals, so there is nothing to memoise.
Do I have to use Vite?
Yes. Zero is a set of Vite plugins: pyreon() compiles the JSX and zero() adds routing, rendering and the build. zero dev, zero build and zero preview wrap them.
Where can I deploy it?
Node, Bun, Deno, Vercel, Netlify, Cloudflare Pages or any static host. Leave adapter unset and the build picks it from the platform's environment. A route can ask for the edge with export const runtime, and the build fails if the adapter can't do it.
Is it faster than Next.js on a real app?
We don't claim that yet. The repo has a suite that builds the same app with Zero, Next.js, React Router, SvelteKit, SolidStart, Nuxt, Astro, TanStack Start and Qwik City (bun run bench:stacks), and no result from it is published. The numbers on this page are component-level server rendering and hydration.
The static site and the app were one project all along.
npm create @pyreon/zero@latest