Axeom Logo
Axeom.

Validation

Ensuring data integrity with first-class schema support.

Validation isn't an afterthought in Axeom—it's part of the Blueprint. Axeom provides a native, zero-dependency validation engine through the s utility, while remaining completely flexible: you can use s, Zod, TypeBox, or any other library of your choice.


The Native s Validator

Axeom's built-in s utility is an ultra-lightweight validation engine designed specifically for the framework. It provides a familiar, chainable API with zero external dependencies, keeping your bundle size practically non-existent.

const  = .({
  : .().(3),
  : .().(),
  : .().()
});

.("/users", () => {
  // Direct access to validated body!
  const { ,  } = .;
  
  return { : 1,  };
}, { 
  :  
});

Bring Your Own Library

Axeom is library-agnostic. Because the engine relies on a simple Validator interface, you can use any library that provides a .parse() or equivalent method.

.("/external", () => {
  return .;
}, {
  : .object({
    : .string()
  })
});

Validating Other Segments

Axeom's validation covers every part of the request. Once validated, the data is automatically parsed and available on the context with full type safety.

.("/search", () => {
  const { ,  } = .;
  return { : [],  };
}, {
  : .({
    : .(),
    : .().(1)
  })
});

Error Handling

When validation fails, Axeom interrupts the request and returns a 400 Bad Request with a clear description of the failure.

Zero-Dependency Speed

The native s validator is optimized for the Axeom engine, providing significantly faster cold-boots and lower memory usage than heavier alternatives, making it ideal for Edge and Serverless environments.

On this page