Skip to main content

Choose your stack

validonce has two halves. On the server you write cross-field rules in your own language, and validonce exports them into your OpenAPI document under x-validonce. In the browser a small runtime reads those rules and checks the form before it is sent. The server still checks every request.

1. Pick your server​

Each tab shows the same four rules for the playground's Contact form: email or phone, a full address or none of it, a postal code when the country is US, and an end date on or after the start date. Pick a tab once and every code sample on this site follows it.

examples/aspnet-app/Signup.cs
public sealed class ContactValidator : ValidonceValidator<Contact>
{
private static readonly string[] Countries = ["US", "CA", "GB", "other"];

public ContactValidator()
{
// Rule order is part of the contract (examples/CONTRACT.md).
AtLeastOneOf(x => x.Email, x => x.Phone).WithMessageKey("rules.contact_email_or_phone");
AllOrNone(x => x.Street, x => x.City, x => x.PostalCode).WithMessageKey("rules.address_all_or_none");
RequiredWhen(x => x.PostalCode, If.Eq(x => x.Country, "US")).WithMessageKey("rules.postal_code_required_us");
Compare(x => x.AvailableTo, CompareOp.Ge, x => x.AvailableFrom).WithMessageKey("rules.available_to_after_from");

RuleFor(x => x.Email).EmailAddress().When(x => !string.IsNullOrEmpty(x.Email));
RuleFor(x => x.Phone).Matches(@"^\+?[0-9 ()-]{7,20}$").When(x => !string.IsNullOrEmpty(x.Phone));
RuleFor(x => x.Country).NotEmpty().Must(c => c is null || Countries.Contains(c)).WithMessage("Country must be one of US, CA, GB, other.");
}
}

From examples/aspnet-app/Signup.cs, the example app that runs in the playground.

Then follow the guide for your server:

ServerGuide
ASP.NET Core (FluentValidation)Getting started: ASP.NET Core
FastAPI (Pydantic)Getting started: FastAPI
Fastify (TypeBox)Getting started: Fastify
NestJS (class-validator)Getting started: NestJS
Go (Huma or go-playground/validator)Getting started: Go
Spring Boot (Java or Kotlin)Getting started: Spring Boot
Kubernetes CRDs (CEL)Kubernetes

2. Pick your client​

ClientGuide
React (react-hook-form and Zod)React client
Angular (Signal and Reactive Forms)Angular client
Vue (VeeValidate)Vue client
Plain forms and web componentsDOM client
Generated clients (Hey API, kubb, orval)Client codegen

3. See it run​

  • Rule kinds, live: each of the five rule kinds as a small form, running the real runtime in this page.
  • The playground: any server with any client, with the server's answer next to the form's.
  • Moving an existing app over? Agentic migration covers the MCP server and the migration skill.