References
Axeom Engine API Reference.
Axeom Engine
The primary class for building and managing your weightless API.
import { Axeom } from "@axeom/framework";
const app = new Axeom();Core Methods
.use(plugin)
Registers a plugin. A plugin is a function (app: Axeom) => Axeom.
.group(prefix, (app) => app)
Groups routes under a common path prefix. Creates an isolated branch for hooks and derivations.
.decorate(object)
Adds static properties to the context available to all handlers.
.derive(handler)
Adds dynamic properties to the context by running a function before the route handler.
.handle(request: Request)
The standard winterTC entry point. Converts a native Request into a Promise<Response>.
.listen(port, callback?)
Ignites the engine. Axeom automatically detects if it's running in Bun or Deno and starts the optimized native server.
port: The port number to listen on.callback: (Optional) A function executed once the server is live.
Lifecycle Hooks
.onRequest(ctx => void)
Runs as soon as a request is matched, before any other logic.
.onBeforeHandle(ctx => void | Response)
Runs immediately before the route handler. Can return a Response to short-circuit.
.onResponse((res, ctx) => void | Response)
Runs after a response is generated. Can modify headers or return a new Response.
Context (ctx)
The context object passed to every handler and hook. Note that Axeom handles response conversion automatically—returning an object from a handler is equivalent to returning Response.json().
Prop
Type
Schema System
Axeom uses a library-agnostic schema system. While it provides a native, zero-dependency utility (s), it supports any library that implements the Validator interface (including Zod).
import { s } from "@axeom/framework";
app.post("/data", (ctx) => {
return ctx.body;
}, {
body: s.object({
id: s.number()
})
});The Validator Interface
To use an external library like Zod or TypeBox, they simply need to provide a parse method:
export interface Validator<T = any> {
readonly _output: T;
parse: (data: unknown) => T | Promise<T>;
}