Validate everything. Complicate nothing.
Guard validates arguments, objects, collections, text, numbers, files, and documents through one API for .NET.
Current release: 1.0.0. Install from NuGet or build and install locally. Build and publish
Install this version using the .NET CLI:
dotnet add package Sunmeat.Guard --version 1.0.0Guard targets .NET 8, 9, 10, and 11. See the platform matrix for verified runtimes. Compatibility
using Sunmeat.Guard;
string name = Guard.NotWhiteSpace("Ada");
int age = Guard.InRange(32, 18, 120);using Sunmeat.Guard;
bool canContinue = Guard.IsEmail("user@example.org") && Guard.IsPhone("+12025550123");using Sunmeat.Guard;
var validator = Guard.For<Registration>()
.Rule(x => x.Name).NotWhiteSpace().MinLength(2)
.Rule(x => x.Email).Email()
.Rule(x => x.Age).Between(18, 120)
.Build();
var result = validator.Validate(new Registration("Ada", "user@example.org", 32));
Console.WriteLine(result.ToText());
record Registration(string? Name, string? Email, int Age);The core covers null and empty values, Unicode text, generic numbers, dates, collections, enumerations, passwords, web addresses, international identifiers, file signatures, JSON, and XML. Fluent rules support conditions, nested models, custom checks, and cancellation. Results can use English or Ukrainian and are available as JSON, text, Markdown, and HTML.
Built-in rule catalog · Fluent validation · Security
| Package | Use |
|---|---|
Sunmeat.Guard.Documents |
YAML, TOML, CBOR, and XML Schema |
Sunmeat.Guard.AspNetCore |
Endpoint filters and Problem Details |
Sunmeat.Guard.Blazor |
EditContext form validation |
Sunmeat.Guard.Prism |
Export reports in six formats |
Sunmeat.Guard.Pulse |
Structured counts and terminal reports |
Getting started and examples · Measured benchmarks · Localization
Independent .NET libraries with a shared philosophy: simple APIs, modularity and open source.
| Library | Purpose | NuGet / Status |
|---|---|---|
| Sunmeat.Prism | Serialization and format conversion | NuGet |
| Sunmeat.Pulse | Structured logging | NuGet |
| Sunmeat.Nexus | HTTP requests and API communication | NuGet |
| Sunmeat.Lens | Code analysis and architecture visualization | NuGet · Roslyn · Raster |
| Sunmeat.Guard (this project) | Validation and argument checks | NuGet |
| Sunmeat.Diff | Data comparison and patches | NuGet |
| Sunmeat.Morph | Object mapping and transformation | NuGet |
| Sunmeat.Forge | Synthetic data and test fixtures | NuGet |
| Sunmeat.Signal | Multichannel notifications | NuGet · Extensions.DependencyInjection |
| Sunmeat.Vault | Cryptography and secret storage | NuGet |
| Sunmeat.Portal | File systems, storage and backups | NuGet |
| Sunmeat.Scribe | Document generation and processing | In development |
| Sunmeat.Flux | In-process Mediator, CQRS and Event Bus | In development |
| Sunmeat.Synapse | Unified AI API and model routing | In development |
All published packages · Ecosystem website
Sunmeat.Guard is free, open-source software created and maintained by an independent developer.
If Guard saves you time, simplifies validation, or becomes a valuable part of your projects, consider supporting its continued development.
Your support helps fund:
- New validation rules and supported data formats.
- Performance improvements and optimizations.
- Localization and international standards support.
- Documentation, examples, and automated tests.
- Long-term maintenance and compatibility.
- New open-source .NET libraries and developer tools.
Every contribution, regardless of its size, makes a difference.
You can also support the project by starring the repository, reporting issues, contributing code, or sharing Guard with other developers.
Built with curiosity. Shared with the community.
Copyright © 2026 Oleksandr Zahoruiko · sunmeat.dev
