Compile-Time Driven
Validation logic is types. Constraints are baked in at compile time with zero runtime reflection.
Type-safe data validation with 50+ built-in types, human-readable errors, and zero runtime overhead.

const std = @import("std");
const z = @import("zigantic");
pub fn main() !void {
// Direct validation with rich utilities
const email = try z.Email.init("alice@company.com");
std.debug.print("Domain: {s}\n", .{email.domain()}); // "company.com"
std.debug.print("Business: {}\n", .{email.isBusinessEmail()}); // true
// Password with strength checking
const pwd = try z.Secret(8, 100).init("MyP@ss123!");
std.debug.print("Strength: {d}/6\n", .{pwd.strength()}); // 5
// Numbers with utilities
const age = try z.Int(i32, 18, 120).init(25);
std.debug.print("Even: {}, Positive: {}\n", .{age.isEven(), age.isPositive()});
// IP with network utilities
const ip = try z.Ipv4.init("192.168.1.1");
std.debug.print("Private: {}\n", .{ip.isPrivate()}); // true
}Install the latest stable release (v0.0.2):
zig fetch --save https://github.com/muhammad-fiaz/zigantic/archive/refs/tags/v0.0.2.tar.gzInstall the latest development version:
zig fetch --save git+https://github.com/muhammad-fiaz/zigantic.gitThen in your build.zig:
const zigantic_dep = b.dependency("zigantic", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("zigantic", zigantic_dep.module("zigantic"));String NonEmptyString Trimmed Lowercase Uppercase Alphanumeric AsciiString Secret StrongPassword
Int UInt PositiveInt NonNegativeInt NegativeInt EvenInt OddInt MultipleOf Float Percentage Probability PositiveFloat NegativeFloat FiniteFloat
Email Url HttpsUrl Uuid Ipv4 Ipv6 Slug Semver PhoneNumber CreditCard Regex Base64 HexString HexColor MacAddress IsoDateTime IsoDate CountryCode CurrencyCode Latitude Longitude Port
List NonEmptyList FixedList
Default Custom Transform Coerce Literal Partial OneOf Range Nullable Lazy
Run the included examples:
zig build run-basic # Direct validation + JSON
zig build run-advanced_types # All 50+ types demo
zig build run-validators # Validator functions
zig build run-json_example # Full JSON workflow
zig build run-error_handling # Error management
zig build bench # Run benchmarks