@kimoxstudio/nextjs
v0.2.1
Published
Next.js App Router integration for kimox-fw (rendering, middleware, preview).
Readme
@kimoxstudio/nextjs
Next.js App Router integration.
The glue between the framework and a Next.js app: rendering, the variation cookie, the preview bridge and route handlers.
// app/[[...slug]]/page.tsx
import { renderPageFromContent } from "@kimoxstudio/nextjs";
const result = await renderPageFromContent(kx, { route });
if (!result.node) notFound();
return result.node;// middleware.ts (Next 14/15) — on Next 16 use proxy.ts + createKxProxy
import { createKxMiddleware } from "@kimoxstudio/nextjs/middleware";
export default createKxMiddleware({ cookieName, secrets, variationBranchPrefix });
export const runtime = "nodejs";// root layout — enables hover / click-to-select / inline editing in the admin
// preview. Self-gating: does nothing on the live site.
import { KxPreviewBridge } from "@kimoxstudio/nextjs/preview";
<body>{children}<KxPreviewBridge /></body>A stale variation cookie (branch published or deleted) falls back to production instead of 404-ing the visitor.
Part of kimox-fw
kimox-fw is a JSON-document + template site framework for Next.js (App Router): pages are declarative JSON documents rendered by Zod-typed templates, with content stored in git and edited through a visual admin using draft branches ("variations").
Scaffold a whole site with npx create-kx-app.
MIT © Kimox Studio
