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

@nyalajs/http

v2.3.0

Published

Fastify-backed HTTP layer for Nyala.js — routing, guards, interceptors, exception filters, WebSocket gateways, and streaming (SSE / file downloads), all resolved through the same DI container and module graph as the rest of the framework.

Readme

@nyalajs/http

Fastify-backed HTTP layer for Nyala.js — routing, guards, interceptors, exception filters, WebSocket gateways, and streaming (SSE / file downloads), all resolved through the same DI container and module graph as the rest of the framework.

Quick start

import "reflect-metadata";
import { NyalaFactory } from "@nyalajs/core";
import { FastifyAdapter } from "@nyalajs/http";
import { AppModule } from "./app.module";

async function bootstrap() {
  const app = await NyalaFactory.create(AppModule);

  const httpAdapter = new FastifyAdapter(app.getKernel().getContainer(), {
    session: false,
  });
  app.setHttpAdapter(httpAdapter);

  await app.listen(3000);
}

bootstrap();

Controllers, routes, guards, and interceptors are declared with @Controller()/@Get()/@UseGuards()/@UseInterceptors() from @nyalajs/core@nyalajs/http is the runtime that binds them to a real Fastify server.

What's in this package

  • FastifyAdapter — the HTTP runtime: request/response lifecycle, param resolution (@Body/@Param/@Query/@Req/@Res/...), guards, interceptors, @Catch()/@UseFilters() exception filters, form/multipart parsing, and security defaults (helmet, CORS, rate limiting, CSRF, compression — each independently toggleable via FastifyAdapterOptions).
  • WebSocket gateways@WebSocketGateway()/@SubscribeMessage()/@BinaryMessage()/@OnConnect()/@OnDisconnect() for real-time bidirectional connections, opt-in via { websocket: true }. See the WebSockets docs for the full API.
  • StreamingSseStream for Server-Sent Events, StreamableResponse for raw file/body streaming, asyncIterableToSse() to bridge any AsyncIterable<string> (e.g. an LLM token stream) onto SSE. See the Streaming docs.
  • RenderableResponse — a duck-typed interface for pluggable response rendering (e.g. @nyalajs/react's view()), so this package never needs to depend on a rendering library itself.

Example: a controller with both HTTP and real-time

import { Controller, Get, Param } from "@nyalajs/core";
import { WebSocketGateway, SubscribeMessage, MessageBody, ConnectedSocket, NyalaSocket } from "@nyalajs/http";

@Controller("/rooms")
export class RoomsController {
  @Get("/:id")
  find(@Param("id") id: string) {
    return this.rooms.find(id);
  }
}

@WebSocketGateway({ path: "/ws/rooms" })
export class RoomsGateway {
  @SubscribeMessage("join")
  onJoin(@MessageBody() roomId: string, @ConnectedSocket() socket: NyalaSocket) {
    socket.join(roomId);
  }
}

Both resolve through the same DI container — a gateway can inject any service a controller can.

Example: streaming a response

import { Controller, Get } from "@nyalajs/core";
import { SseStream } from "@nyalajs/http";

@Controller("/jobs")
export class JobsController {
  @Get("/:id/progress")
  track(@Param("id") id: string) {
    const sse = new SseStream();
    const job = this.jobs.watch(id);
    job.on("progress", (pct) => sse.send({ event: "progress", data: { pct } }));
    job.on("done", () => sse.close());
    return sse;
  }
}

Peer dependencies

fastify and reflect-metadata are direct dependencies. WebSocket support (@fastify/websocket) is also a direct dependency, but its plugin is only registered on the Fastify instance when websocket: true is passed — no cost if you don't use it.

Documentation

Full docs: github.com/nyalajs/nyalajs — see especially Controllers, WebSockets, and Streaming.