API Reference
@json-render/next
Next.js renderer. JSON becomes full Next.js applications with routes, layouts, metadata, and SSR.
Installation
schema
The Next.js app schema for multi-page specs. Use with defineCatalog from core.
createNextApp
Create all exports needed for a Next.js [[...slug]] catch-all route.
Options
| Option | Type | Description |
|---|---|---|
spec | NextAppSpec | (() => NextAppSpec | Promise<NextAppSpec>) | The application spec (static or dynamic) |
loaders | Record<string, LoaderFn> | Server-side data loaders keyed by name |
Returns
| Export | Description |
|---|---|
Page | Async Server Component for page.tsx |
generateMetadata | Metadata generator for Next.js SEO |
generateStaticParams | Static params for pre-rendering at build time |
NextAppSpec
The top-level spec defining an entire Next.js application.
Route Patterns
Routes use Next.js URL conventions:
| Pattern | Example Match | Params |
|---|---|---|
/ | / | {} |
/about | /about | {} |
/blog/[slug] | /blog/hello | { slug: "hello" } |
/docs/[...path] | /docs/a/b/c | { path: ["a","b","c"] } |
/app/[[...path]] | /app or /app/x/y | { path: [] } or { path: ["x","y"] } |
NextAppProvider
Client component that provides the component registry and action handlers to all pages.
Built-in Components
Slot
Placeholder in layouts where page content is rendered. Every layout MUST include a Slot.
Link
Client-side navigation wrapping next/link.
Built-in Actions
| Action | Params | Description |
|---|---|---|
setState | { statePath, value } | Update a value in state |
pushState | { statePath, value, clearStatePath? } | Append to array in state |
removeState | { statePath, index } | Remove from array by index |
navigate | { href } | Client-side navigation |
Server Utilities
matchRoute
Match a pathname against a spec's routes.
resolveMetadata
Resolve merged metadata for a route.
slugToPath
Convert catch-all slug array to pathname.
Entry Points
| Import | Contents |
|---|---|
@json-render/next | Client components (NextAppProvider, PageRenderer, Link) |
@json-render/next/server | Server utilities (createNextApp, matchRoute, schema) |