@glokki-cms/sdk
v0.5.1
Published
SDK for defining blocks, globals, collections, and data-models for the glokki-cms editor.
Downloads
1,142
Readme
@glokki-cms/sdk
SDK for declaring blocks, globals, collections, and data-models that the glokki-cms editor consumes via its runtime handshake protocol.
Install
npm install @glokki-cms/sdk zod
# or
bun add @glokki-cms/sdk zodzod is a peer dependency.
Usage
import { createBlockRegistry, defineBlock } from "@glokki-cms/sdk";
import { z } from "zod";
const Hero = defineBlock({
type: "hero",
label: "Hero",
category: "content",
schema: z.object({
title: z.string(),
subtitle: z.string().optional(),
}),
defaultProps: { title: "Hello" },
Component: ({ title, subtitle }) => (
<section>
<h1>{title}</h1>
{subtitle && <p>{subtitle}</p>}
</section>
),
});
export const blocks = createBlockRegistry([Hero]);The exported registry is sent to the CMS dashboard over the v2 iframe
handshake; the dashboard renders props panels from the serialized Zod
schema (FieldDescriptor[]) without ever needing the original Zod
object.
See the glokki-cms docs for the full integration guide, global schemas, and delivery API contracts.
License
MIT
