Schema
Define events and state with validation
Supported Libraries
Ventyd uses Standard Schema, so you can use any compatible validation library.
Which One Should I Choose?
- Valibot: Smallest bundle size, modern and modular
- Zod: Most popular, largest ecosystem
- TypeBox: JSON Schema support, great for APIs
- ArkType: Fastest validation, elegant syntax
Pick any - they all work great with Ventyd!
Custom Event Seperator
By default, events are named entity:event (e.g., user:created). You can customize this:
const schema = defineSchema("user", {
schema: valibot({
event: { created: v.object({ ... }) },
state: v.object({ ... }),
namespaceSeparator: "/" // Use "/" instead of ":"
}),
initialEventName: "user/created" // Match the separator
});