next
vercel-labs/json-render
Convert JSON specs into full Next.js applications with routes, layouts, SSR, and metadata.
What is next?
@json-render/next is a renderer that transforms JSON specifications into complete Next.js applications with multi-page routing, reusable layouts, server-side rendering, and SEO metadata. Use it when building AI-generated Next.js apps from structured JSON specs or when you need to programmatically create multi-page applications.
- Converts JSON specs into Next.js page routes with dynamic and catch-all segments
- Manages reusable layouts with Slot-based content injection
- Handles server-side data loading and async rendering
- Generates metadata and static params automatically
- Provides built-in state management with setState, pushState, and removeState actions
- Supports client-side navigation via Link component
How to install next
npx skills add https://github.com/vercel-labs/json-render --skill next- Node.js and npm installed
- Existing Next.js project (App Router)
- @json-render/core and @json-render/react packages
How to use next
- 1.Install @json-render/core, @json-render/react, and @json-render/next via npm
- 2.Define your NextAppSpec with metadata, layouts, and routes in a spec file
- 3.Create the app using createNextApp() with your spec and optional data loaders
- 4.Wire up the catch-all route file at app/[[...slug]]/page.tsx to export Page, generateMetadata, and generateStaticParams
- 5.Wrap your app layout with NextAppProvider, passing your component registry and handlers
- 6.Define custom components in your registry and reference them by type in your JSON spec
Use cases
- Generate multi-page Next.js applications from AI-produced JSON specifications
- Build dynamic content sites where pages and layouts are defined in JSON
- Create template-based applications with shared layouts across multiple routes
- Implement server-side data loading for dynamic routes like /blog/[slug]
- Generate static sites with automatic metadata and SEO configuration
- AI agents generating Next.js applications
- Developers building template-driven or dynamic content platforms
- Teams creating programmatic multi-page web applications
- Engineers working with json-render ecosystem
next FAQ
Slot is a placeholder component that marks where page content will be rendered within a layout. Every layout must include exactly one Slot so the router knows where to inject the matched page's content.
Data loaders are async functions passed to createNextApp that run on the server before rendering. They receive route parameters (like slug) and return data that gets merged into the page's initial state, enabling dynamic content fetching.
Yes. Define routes with Next.js URL conventions: [slug] for dynamic segments, [...path] for catch-all, and [[...path]] for optional catch-all. Use generateStaticParams to pre-render static routes.
The Page component exported by createNextApp is an async Server Component that matches the route, runs data loaders, resolves metadata, and passes the spec to the client renderer for hydration.
Built-in actions include setState (update state), pushState (append to array), removeState (remove by index), and navigate (client-side navigation). Custom actions can be added via handlers in your registry.
Full instructions (SKILL.md)
Source of truth, from vercel-labs/json-render.
name: next description: Next.js renderer for json-render that turns JSON specs into full Next.js applications with routes, layouts, SSR, and metadata. Use when working with @json-render/next, building Next.js apps from JSON specs, or creating AI-generated multi-page applications.
@json-render/next
Next.js renderer that converts JSON specs into full Next.js applications with routes, pages, layouts, metadata, and SSR support.
Quick Start
npm install @json-render/core @json-render/react @json-render/next
1. Define Your Spec
// lib/spec.ts
import type { NextAppSpec } from "@json-render/next";
export const spec: NextAppSpec = {
metadata: {
title: { default: "My App", template: "%s | My App" },
description: "A json-render Next.js application",
},
layouts: {
main: {
root: "shell",
elements: {
shell: { type: "Container", props: {}, children: ["nav", "slot"] },
nav: { type: "NavBar", props: { links: [
{ href: "/", label: "Home" },
{ href: "/about", label: "About" },
]}, children: [] },
slot: { type: "Slot", props: {}, children: [] },
},
},
},
routes: {
"/": {
layout: "main",
metadata: { title: "Home" },
page: {
root: "hero",
elements: {
hero: { type: "Card", props: { title: "Welcome" }, children: [] },
},
},
},
"/about": {
layout: "main",
metadata: { title: "About" },
page: {
root: "content",
elements: {
content: { type: "Card", props: { title: "About Us" }, children: [] },
},
},
},
},
};
2. Create the App
// lib/app.ts
import { createNextApp } from "@json-render/next/server";
import { spec } from "./spec";
export const { Page, generateMetadata, generateStaticParams } = createNextApp({
spec,
loaders: {
// Server-side data loaders (optional)
loadPost: async ({ slug }) => {
const post = await getPost(slug as string);
return { post };
},
},
});
3. Wire Up Route Files
// app/[[...slug]]/page.tsx
export { Page as default, generateMetadata, generateStaticParams } from "@/lib/app";
// app/[[...slug]]/layout.tsx
import { NextAppProvider } from "@json-render/next";
import { registry, handlers } from "@/lib/registry";
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
<NextAppProvider registry={registry} handlers={handlers}>
{children}
</NextAppProvider>
</body>
</html>
);
}
Key Concepts
NextAppSpec
The top-level spec defines an entire Next.js application:
- metadata: Root-level SEO metadata (title template, description, OpenGraph)
- layouts: Reusable layout element trees (each must include a
Slotcomponent) - routes: Route definitions keyed by URL pattern
- state: Global initial state shared across all routes
Route Patterns
Routes use Next.js URL conventions:
"/"-- home page"/about"-- static route"/blog/[slug]"-- dynamic segment"/docs/[...path]"-- catch-all segment"/settings/[[...path]]"-- optional catch-all segment
Layouts
Layouts wrap page content. Every layout MUST include a Slot component where page content will be rendered. Layouts are defined once in spec.layouts and referenced by routes via the layout field.
Built-in Components
- Slot: Placeholder in layouts where page content is rendered
- Link: Client-side navigation link (wraps
next/link)
Built-in Actions
- setState: Update state value. Params:
{ statePath, value } - pushState: Append to array. Params:
{ statePath, value, clearStatePath? } - removeState: Remove from array by index. Params:
{ statePath, index } - navigate: Client-side navigation. Params:
{ href }
Data Loaders
Server-side async functions that run in the Server Component before rendering. Results are merged into the page's initial state.
createNextApp({
spec,
loaders: {
loadPost: async ({ slug }) => {
const post = await db.post.findUnique({ where: { slug } });
return { post };
},
},
});
SSR
Pages are server-rendered automatically. The createNextApp Page component is an async Server Component that:
- Matches the route from the spec
- Runs server-side data loaders
- Generates metadata
- Passes the resolved spec to the client renderer for hydration
Entry Points
@json-render/next-- Client components (NextAppProvider, PageRenderer, Link)@json-render/next/server-- Server utilities (createNextApp, matchRoute, schema)
API Reference
Server Exports (@json-render/next/server)
createNextApp(options)-- Create Page, generateMetadata, generateStaticParamsschema-- Custom schema for Next.js apps (for AI catalog generation)matchRoute(spec, pathname)-- Match a URL to a route specresolveMetadata(spec, route)-- Resolve metadata for a routeslugToPath(slug)-- Convert catch-all slug array to pathnamecollectStaticParams(spec)-- Collect static params for all routes
Client Exports (@json-render/next)
NextAppProvider-- Context provider for registry and handlersPageRenderer-- Renders a page spec with optional layoutNextErrorBoundary-- Error boundary componentNextLoading-- Loading state componentNextNotFound-- Not-found componentLink-- Built-in navigation component (wraps next/link)
Related skills
More from vercel-labs/json-render and the wider catalog.

react
Convert JSON specs into React components with type-safe props, state binding, and event handling.

react-email
Convert JSON specs into HTML or plain-text emails using React Email components.

react-native
React Native renderer that converts JSON specs into native mobile UIs with standard components and data binding.

react-pdf
Render PDF documents from JSON specs using React components.

react-three-fiber
Render interactive 3D scenes from JSON specs using React Three Fiber and Three.js

redux
Redux adapter for json-render's StateStore interface. Use when integrating json-render with Redux or Redux Toolkit for state management via @json-render/redux.