Labsco
vercel-labs logo

next

15,600

by vercel · part of vercel-labs/json-render

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…

🔥🔥🔥✓ VerifiedFreeQuick setup
🧰 Not standalone. This skill ships with vercel-labs/json-render and only works together with that tool — install the tool first, then add this skill.

This is the playbook your agent receives when the skill activates — you don't need to read it to use the skill, but it's here to audit before installing.

by vercel

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… npx skills add https://github.com/vercel-labs/json-render --skill next Download ZIPGitHub15.6k

@json-render/next

Next.js renderer that converts JSON specs into full Next.js applications with routes, pages, layouts, metadata, and SSR support.

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 Slot component)

  • 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, generateStaticParams

  • schema -- Custom schema for Next.js apps (for AI catalog generation)

  • matchRoute(spec, pathname) -- Match a URL to a route spec

  • resolveMetadata(spec, route) -- Resolve metadata for a route

  • slugToPath(slug) -- Convert catch-all slug array to pathname

  • collectStaticParams(spec) -- Collect static params for all routes

Client Exports (@json-render/next)

  • NextAppProvider -- Context provider for registry and handlers

  • PageRenderer -- Renders a page spec with optional layout

  • NextErrorBoundary -- Error boundary component

  • NextLoading -- Loading state component

  • NextNotFound -- Not-found component

  • Link -- Built-in navigation component (wraps next/link)