AponiaJSDocs
Compare

AponiaJS vs Fastify

Fastify organises applications with encapsulated plugins and JSON Schema validation. AponiaJS organises them with a validated module graph and constructor injection on Bun.

Fastify is the closest thing in Node to what AponiaJS is aiming at: an opinionated, schema-driven, performance-conscious framework with a real composition model. It is also stable, and AponiaJS is not.

At a glance

Runtime

AponiaJS 0.6.0-alpha.18

Partial. Bun only

Fastify

Yes. Node, and Bun

Maturity

AponiaJS 0.6.0-alpha.18

No. Alpha

Fastify

Yes. Stable, widely deployed

Composition

AponiaJS 0.6.0-alpha.18

Module graph, imports and exports

Fastify

Plugins with encapsulation contexts

Wiring

AponiaJS 0.6.0-alpha.18

Yes. Constructor injection from a container

Fastify

Partial. decorate on the instance or scope

Validation

AponiaJS 0.6.0-alpha.18

Yes. Standard Schema, TypeBox, Elysia t

Fastify

Yes. JSON Schema, compiled with Ajv

Response serialization

AponiaJS 0.6.0-alpha.18

Partial. Elysia's; no unknown-field policy

Fastify

Yes. Compiled from the response schema

Lifecycle hooks

AponiaJS 0.6.0-alpha.18

No. Not implemented

Fastify

Yes. A documented hook at every request phase

Error format

AponiaJS 0.6.0-alpha.18

Yes. RFC 9457 Problem Details built in

Fastify

Yes. Fastify shape, customisable

OpenAPI

AponiaJS 0.6.0-alpha.18

No. Not implemented

Fastify

Yes. @fastify/swagger from route schemas

Ecosystem

AponiaJS 0.6.0-alpha.18

Partial. Elysia plugins

Fastify

Yes. Large first-party plugin set

Two ways to scope a dependency

Fastify scopes by registration tree. A decorator added inside a plugin is visible to that plugin and its children, and disappears outside it:

fastify.register(async (instance) => {
  instance.decorate("repository", new UserRepository());
  instance.get("/users/:id", async (request) =>
    instance.repository.find(request.params.id),
  );
});

AponiaJS scopes by declaration. A module lists what it provides and what it exports, and importers see exactly the exported set:

@Module({
  controllers: [UserController],
  providers: [UserRepository],
  exports: [UserRepository],
})
class UserModule {}

The practical difference is when a mistake surfaces. Reaching for an undecorated property in Fastify is a runtime failure on the request that hits it. Injecting a provider a module never exported is a startup error with a diagnostic, described in visibility.

Where Fastify is clearly ahead

Hooks. onRequest, preValidation, preHandler, onSend, onResponse, and the rest give you a defined place for authentication, logging, and transformation. AponiaJS has no hook runtime of its own; that work goes through Elysia via native access.

Serialization. Fastify compiles the response schema into a fast serializer, which is both a performance and a data-leak-prevention feature. AponiaJS validates response slots but does not own a serialization or unknown-field policy — it is listed in current limitations.

OpenAPI. Route schemas feed @fastify/swagger directly. AponiaJS does not generate OpenAPI documents.

Maturity. Stable releases, a long deprecation policy, and production usage at scale.

Where AponiaJS differs meaningfully

Validator choice. Fastify's schema language is JSON Schema. AponiaJS takes any Standard Schema validator, so the types your application already uses can be the types the route validates with. See validation.

Injection instead of decoration. Constructor injection with explicit tokens rather than properties attached to a shared instance.

Typed client. Eden Treaty infers a client from the composed routes; see Eden Treaty.

Runtime. Bun and Elysia rather than Node and Fastify's HTTP layer.

Which one to pick

Choose Fastify when

  • you deploy to Node and want a stable, schema-first framework;
  • request lifecycle hooks are part of your design;
  • compiled response serialization matters to you;
  • you want OpenAPI generated from the schemas you already wrote;
  • you are shipping to production now.

Choose AponiaJS when

  • Bun is the runtime;
  • you want declared module boundaries rather than encapsulation by registration order;
  • your validators are Zod, ArkType, or Valibot and you would rather not translate them to JSON Schema;
  • alpha software is acceptable for this codebase.

Frequently asked questions

Does AponiaJS support JSON Schema like Fastify?
Indirectly. Route schemas accept TypeBox, which is JSON Schema, as well as Elysia's t and any Standard Schema validator such as Zod, ArkType, or Valibot. What AponiaJS does not have is Fastify's compiled schema-based response serialization.
Is Fastify's plugin encapsulation the same as an AponiaJS module?
They solve the same problem differently. Fastify encapsulation scopes decorators and hooks to a plugin subtree at registration time. An AponiaJS module declares its providers and exports statically, and the graph is validated during bootstrap before anything is constructed.
Can Fastify run on Bun?
Fastify targets Node and relies on Node's HTTP layer, which Bun implements. It generally works, but Fastify is not designed around Bun the way Elysia is.

On this page