Axeom vs. Fastify
The ultimate showdown between the Node.js standard and the weightless engine.
Fastify is the industry standard for high-performance Node.js development. Axeom takes inspiration from Fastify's speed but re-imagines the architecture for the Fetch API era, slashing bundle size and removing Node-specific lock-in.
Routing & Handlers
Axeom uses a standard REST-first approach and exposes a unified context object that works across all runtimes.
import from '@axeom/framework';
const = new ();
// Unified Context handler
.('/ping', () => {
return "pong";
});
.('/data', ({ }) => {
return ;
});
import from 'fastify';
const = ();
// Proprietary req/reply objects
.get('/ping', async (, ) => {
return "pong";
});
.post('/data', async (, ) => {
return .body;
});Validation & Type Safety
Axeom provides Zero-CodeGen Type Safety through its native s schema utility. Axeom's types are perfectly inferred at runtime and shared with the client without extra steps.
import , { } from '@axeom/framework';
const = new ();
// Native schema-to-type inference
.('/user', ({ }) => {
return .; // Fully typed
}, {
: .({ : .() })
});
import from 'fastify';
import { } from '@sinclair/typebox';
const = ();
// Requires TypeBox or JSON Schema
const = {
: .Object({ : .Number() })
};
.post('/user', { }, () => {
return .body.id;
});File Upload
Axeom handles file uploads through a unified storage abstraction, making file saving identical on Bun, Deno, and Node.
import , { } from '@axeom/framework';
const = new ();
// Native storage abstraction
.('/upload', async () => {
const { } = .;
await .storage.save(, `uploads/${.}`);
return "Saved";
}, {
: .({ : .() })
});
import from 'fastify';
const = ();
// Requires fastify-multipart
.register(import('@fastify/multipart'));
.post('/upload', async () => {
const = await .file();
// Manual pump/fs required
return "Saved";
});Lifecycle & Interceptors
Fastify uses an onion-model middleware. Axeom uses a Flattened Hook System (onRequest, onResponse) and .derive() for data injection.
import from '@axeom/framework';
const = new ();
// Flat Hooks & Derivations
.(() => ({ : '@axeom/framework' }))
.(() => {
.(..);
});
import from 'fastify';
const = ();
// Nested hooks
.addHook('onRequest', (, , ) => {
.(.url);
();
});Encapsulation (Grouping)
Axeom's grouping system is designed for isolation without the complexity of Fastify's plugin decorators.
import from '@axeom/framework';
const = new ();
// Functional grouping
.('/v1', () => {
.('/info', () => "v1");
});
import from 'fastify';
const = ();
// Plugin encapsulation
.register((, , ) => {
.get('/info', () => "v1");
();
}, { : '/v1' });Error Handling
Axeom utilizes a unified error interceptor that works seamlessly with standard JavaScript rejections.
import from '@axeom/framework';
const = new ();
// Direct rejection handling
.('/err', () => {
throw new ("Critical Failure");
});
import from 'fastify';
const = ();
// Error handler hook
.setErrorHandler((, , ) => {
.status(500).send({ : false });
});OpenAPI & Documentation
In Axeom, documentation is a byproduct of your schemas via the @axeom/swagger plugin.
// Native Swagger Plugin
import from '@axeom/framework';
import { } from "@axeom/swagger";
const = new ();
.(());
// Documentation is automatic
// via s.object() schemas.
import from 'fastify';
const = ();
// Requires manual schema tags
.register(import('@fastify/swagger'));
.get('/ping', {
: {
: 'ping',
: { 200: { : 'string' } }
}
}, async () => "pong");Summary: Why Axeom Wins
| Feature | Fastify | Axeom |
|---|---|---|
| Runtime | Node.js Only | Universal (Edge, Bun, Deno, Node) |
| Core Size | ~200KB (Transitive) | ~10KB (Zero Deps) |
| Protocol | Proprietary Abstraction | Standard Fetch API |
| Complexity | High (Decorators, Plugins) | Low (Hooks, Groups) |
| Type Safety | Third-party (TypeBox/Zod) | Native (s Utility) |