Toolsgenerator

Cloudflare Pages for Astro

Generates type-safe Zod schemas for Astro content collections based on input configurations

Try the tool

client runner

Generated Zod Schema

Run the tool to see output.

Examples

Blog Post Schema

{
  "contentTypeName": "blogPost",
  "fields": "title:string\ncontent:markdown\ndate:date"
}

Expected output

z.object({
  title: z.string(),
  content: z.string(),
  date: z.date(),
})

Project Listing Schema

{
  "contentTypeName": "project",
  "fields": "title:string\ndescription:string\nstatus:enum[active, archived]\nlinks:url[]"
}

Expected output

z.object({
  title: z.string(),
  description: z.string(),
  status: z.enum(['active', 'archived']),
  links: z.array(z.string().url()),
})

How it works

Enter a content type name and define fields with their types. The tool generates a Zod schema object with type validation rules suitable for Astro content collections.

Related tools