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

unnbound-events

v2.0.18

Published

Unified events SDK to handle HTTP routes and queued messages with a single routing API.

Readme

Unnbound Events SDK

Unified HTTP and SQS queue routing with a single API. Register handlers once, handle requests from both transports.

Install

bun add unnbound-events

Quick Start

import { createServer } from 'unnbound-events';

const server = createServer();

// Register route handlers
server.post('/email/:userId', async (c) => {
  const { userId } = c.request.params;
  const body = c.request.body;

  return { status: 200, body: { sent: true } };
});

// Start both HTTP and queue listeners
server.start();

The server automatically:

  • Starts HTTP server on PORT (default: 3000)
  • Starts SQS long-polling if UNNBOUND_SQS_URL is set
  • Provides /healthcheck endpoint (returns 200 { status: 'ok' })
  • Handles graceful shutdown on SIGINT/SIGTERM

Handlers

Routes receive a context object with request details:

server.post('/users/:id', async (c) => {
  // Access request data
  const { id } = c.request.params;
  const query = c.request.query;
  const headers = c.request.headers;
  const body = c.request.body;

  // Return response
  return {
    status: 200,
    body: { id, ...body },
    headers: { 'x-custom': 'value' },
  };
});

Response format: { status?: number, body?: object, headers?: Record<string, string> }

Return undefined, null, or omit properties to default to 204 No Content.

Middleware

Add logic that runs before/after handlers. Works for both HTTP and queue requests.

// Global middleware
server.use(async (c, next) => {
  console.log('Request:', c.request.method, c.request.path);
  return next();
});

// Path-based middleware
server.use('/admin/*', async (c, next) => {
  const token = c.request.headers['authorization'];
  if (!token?.startsWith('Bearer ')) {
    return { status: 401, body: { error: 'Unauthorized' } };
  }
  return next();
});

// Handler-specific middleware
server.post(
  '/email',
  async (c, next) => {
    // Runs only for this handler
    return next();
  },
  async (c) => {
    return { status: 200, body: { ok: true } };
  }
);

Configuration

HTTP Port

Set via PORT environment variable (default: 3000):

export PORT=8080

Queue Options

Configure SQS polling behavior:

const server = createServer({
  queue: {
    maxMessages: 10, // Messages per poll (default: 10)
    visibilityTimeout: 30, // Seconds (default: SQS default)
  },
});

SQS Environment Variables

The queue adapter reads from:

  • UNNBOUND_SQS_URL - Queue URL (required for queue listener)
  • UNNBOUND_AWS_REGION - AWS region (default: us-east-1)
  • UNNBOUND_SQS_ENDPOINT - Custom endpoint (optional)
export UNNBOUND_SQS_URL="https://sqs.us-west-2.amazonaws.com/123/my-queue"
export UNNBOUND_AWS_REGION="us-west-2"

S3 Large Payload Support

For messages >1MB, payloads can be stored in S3. The SDK automatically fetches and processes them.

Environment variables:

  • UNNBOUND_S3_ENDPOINT - Custom S3 endpoint (optional)

The SDK supports AWS Extended Client Library format (S3 pointer messages).

Queue Message Format

SQS message body should be JSON:

{
  "id": "unique-id",
  "timestamp": 1234567890,
  "request": {
    "method": "POST",
    "url": "https://example.com/path?query=value",
    "headers": { "content-type": "application/json" },
    "body": "base64-encoded-body"
  },
  "metadata": {}
}

The adapter extracts method, path, headers, query, and body to route the message through your handlers.

Logger Integration

Pass a custom logger:

import { logger } from 'unnbound-logger-sdk';

const server = createServer({
  logger,
});

The logger is used for internal events and traces.