We’ve just laid the foundation for the NextBlock CMS plugin system (the Block SDK), and the core decision was all about safety. When a developer installs a custom block, the last thing the CMS should do is crash due to invalid data.
That’s where Zod comes in.
Instead of relying on fragile runtime checks or simply trusting TypeScript interfaces (which disappear after compilation), we now enforce a strict "Contract" for every content block using Zod schemas.
How it works: Every custom block must define its data structure as a Zod schema. If a user tries to save content that doesn’t match the schema, the CMS intercepts the invalid data, shows a clear error, and prevents the crash. This moves data validation from an implicit guess to an explicit, self-documenting contract.
Thi…
We’ve just laid the foundation for the NextBlock CMS plugin system (the Block SDK), and the core decision was all about safety. When a developer installs a custom block, the last thing the CMS should do is crash due to invalid data.
That’s where Zod comes in.
Instead of relying on fragile runtime checks or simply trusting TypeScript interfaces (which disappear after compilation), we now enforce a strict "Contract" for every content block using Zod schemas.
How it works: Every custom block must define its data structure as a Zod schema. If a user tries to save content that doesn’t match the schema, the CMS intercepts the invalid data, shows a clear error, and prevents the crash. This moves data validation from an implicit guess to an explicit, self-documenting contract.
This is critical for an Open-Source project aiming for professional extensibility—it lets the community build plugins without the fear of breaking the core platform.
A peek at the contract:
TypeScript
// The Testimonial Block Schema export const TestimonialSchema = z.object({ quote: z.string().min(1, ‘Quote cannot be empty.’), author_name: z.string().min(1, ‘Author is required.’), image_url: z.string().url().nullable().default(null), });
This is the future of resilient content modeling. Read the full guide on how to build your first custom block using this new system soon!