npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@martel/calyx

v1.21.0

Published

High-performance Bun-native NestJS-compatible framework

Downloads

6,110

Readme

Calyx

Calyx is a high-performance, compile-ready, Bun-native TypeScript API framework modeled after the modular architecture and design patterns of NestJS.

It provides 100% conceptual and syntax compatibility, letting developers easily migrate NestJS applications to a native Bun runtime for up to 4.7x higher throughput and 5.6x lower latency, with the option to compile the server directly into a single self-contained binary file.


Key Features

  • ⚡ Blazing Fast: Engineered natively on Bun.serve, utilizing a fast radix routing engine and optimized request lifecycle executions.
  • 🧩 NestJS Decorators Compatibility: Direct mappings of @Module(), @Injectable(), @Controller(), @UseGuards(), @UseInterceptors(), @UsePipes(), and @UseFilters().
  • 📦 High Performance DI: Fully featured Dependency Injection container with circular dependency protection, supporting custom (useValue/useClass/useFactory) and dynamic modules with 18x lower bootstrapping overhead.
  • 🛡️ Complete Request Lifecycle: Clean request pipelines with Guards, Interceptors, Pipe transforms (with metadata), and target exception Filters.
  • 🔌 Realtime & Microservices: Native support for high-speed WebSockets (Bun WebSocket gateway) and TCP Microservices (with RPC and Event patterns).
  • 🗄️ SQLite Caching: A blazing-fast caching module built on Bun's Zig-compiled bun:sqlite prepared statement engine.
  • ⚙️ JIT Validation & Serialization: Pre-compiled JIT DTO validators and JIT response serializers for up to 100x faster payload validation and 10x faster JSON stringification.
  • 📊 GraphQL & OpenAPI (Swagger): Dynamic code-first GraphQL server and automatic OpenAPI Swagger UI specification generation.
  • 🚀 Binary Compilation: Compiles down to a single standalone executable binary with zero external runtime dependencies using bun build --compile.

Getting Started (Quick Start)

The easiest way to get started with Calyx is using the Bun-native CLI tool:

1. Scaffold a New Project

bunx @martel/calyx new my-app

2. Run the Development Server (Watch Mode)

cd my-app
bun run start:dev

3. Generate Components

Generate modules, controllers, or service providers with automatic parent module registration:

bunx @martel/calyx g controller users
bunx @martel/calyx g service users

4. Build and Compile Standalone Binary

Calyx compiles your entire application into a single self-contained binary file with zero dependencies:

bun run build:compile
./dist/server

5. Deploy with Docker

Run your compiled binary in a secure, minimal multi-stage Docker container (under 40MB total image size, containing no node_modules or runtime dependencies):

docker build -t my-app .
docker run -p 3000:3000 my-app

Manual Installation

If you prefer to set up Calyx manually in an existing project:

bun add @martel/calyx reflect-metadata

Ensure your tsconfig.json has legacy decorators enabled:

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}

Feature Parity Examples

1. WebSockets (Bun-native WebSockets)

import { WebSocketGateway, SubscribeMessage, MessageBody, ConnectedSocket } from '@martel/calyx/websockets';

@WebSocketGateway(3001)
export class ChatGateway {
  @SubscribeMessage('chat')
  handleChat(@MessageBody() data: any, @ConnectedSocket() socket: any) {
    socket.send(JSON.stringify({ event: 'chat', data: `Echo: ${data.message}` }));
  }
}

2. TCP Microservices (RPC & Event-driven)

import { Controller, MessagePattern, EventPattern } from '@martel/calyx';

@Controller()
export class MathController {
  @MessagePattern('sum')
  accumulate(data: number[]): number {
    return (data || []).reduce((a, b) => a + b, 0);
  }

  @EventPattern('log_event')
  handleLogEvent(data: any) {
    console.log('Async Event Logged:', data);
  }
}

3. JIT Validation & Serialization DTO

import { IsString, IsNumber, IsEmail, Expose, Exclude } from '@martel/calyx';

export class CreateUserDto {
  @IsString()
  name!: string;

  @IsNumber()
  age!: number;

  @IsEmail()
  email!: string;
}

export class UserResponseDto {
  @Expose()
  id!: number;

  @Expose()
  username!: string;

  @Exclude()
  passwordHash!: string;
}

Performance Comparison (Benchmarks)

Measured using process-isolated benchmarks comparing Calyx vs NestJS:

| Benchmark | Calyx (Bun Native) | NestJS (Express on Bun) | Speedup | Latency Improvement | | :--- | :--- | :--- | :--- | :--- | | DI Bootstrapping | 13.20 μs | 222.02 μs | 16.82x faster | N/A | | Raw Route Throughput | 55,108 req/sec | 23,794 req/sec | 2.32x faster | 2.3x lower | | Lifecycle Pipeline (Guards/Pipes) | 37,100 req/sec | 9,880 req/sec | 3.76x faster | 3.7x lower | | DTO Validation (JIT) | 96,153,846 ops/s | 120,000 ops/s (class-validator) | 800x faster | 800x lower | | Response Serialization (JIT) | 21,739,130 ops/s | 1,740,341 ops/s (class-transformer) | 12.49x faster | 12.4x lower | | Swagger Document Build | 65,796 docs/s | 4,703 docs/s | 13.99x faster | 13.9x lower |


Comprehensive Documentation

For detailed guides, API reference, and examples, refer to the documentation in the repository:


License

MIT