No Runtime Errors
Catch content validation issues at build time, not in production. Your users will never see broken content again.
Framework-agnostic validation for Markdown and Standard Schema — built for Astro, Next.js, and modern frameworks.

import { parseMarkdown, validateWithSchema, z } from '@fieldtest/core';
// Define your schema using Zod (Standard Schema compliant)
const blogSchema = z.object({
title: z.string(),
author: z.string(),
published: z.boolean(),
tags: z.array(z.string()).optional()
});
// Parse your markdown content
const markdown = `---
title: "Getting Started with FieldTest"
author: "Jane Developer"
published: true
tags: ["typescript", "validation", "markdown"]
---
# Getting Started
This post shows how easy it is to validate content with FieldTest!
`;
const doc = parseMarkdown(markdown);
// Validate the frontmatter against your schema
const result = await validateWithSchema(blogSchema, doc.frontmatter);
if ('issues' in result) {
result.issues.forEach(issue => {
console.error(`❌ ${issue.path?.join('.')}: ${issue.message}`);
});
} else {
console.log('✓ Content validated successfully!');
console.log('Title:', result.title); // Type-safe access
}// src/content/config.ts
import { defineCollection } from 'astro:content';
import { z } from '@fieldtest/core';
// Astro's built-in Zod works with FieldTest schemas
const blog = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
author: z.string(),
published: z.boolean().default(false),
tags: z.array(z.string()).optional()
})
});
export const collections = { blog };// Validate content at build time
import { parseMarkdown, validateWithSchema, z } from '@fieldtest/core';
import fs from 'fs';
const postSchema = z.object({
title: z.string(),
date: z.string(),
author: z.string()
});
export async function getStaticProps({ params }) {
const content = fs.readFileSync(`./content/${params.slug}.md`, 'utf-8');
const doc = parseMarkdown(content);
const data = await validateWithSchema(postSchema, doc.frontmatter, {
throwOnError: true // Fail build on invalid content
});
return { props: { post: { ...data, body: doc.body } } };
}// Works with any framework or runtime
import { parseMarkdown, validateWithSchema, z } from '@fieldtest/core';
const schema = z.object({ title: z.string() });
const doc = parseMarkdown(markdown);
const result = await validateWithSchema(schema, doc.frontmatter);
const isValid = !('issues' in result);Stop wrestling with framework-specific validation. FieldTest works the same way across Astro, Next.js, Remix, SvelteKit, and more.
Based on the emerging Standard Schema specification, ensuring your validation logic is future-proof and interoperable.
Designed to handle large content sites. Validates thousands of documents in seconds with minimal memory usage.
Comprehensive TypeScript support, clear error messages, extensive documentation, and helpful tooling integrations.
Use OpenAPI contracts to generate Zod schemas and validate request/response payloads.
Get up and running in less than 5 minutes with our comprehensive getting started guide.
Get Started →Explore real-world examples and patterns for different frameworks and use cases.
Browse Examples →Comprehensive documentation of all functions, types, and configuration options.
View API →