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

@bonapasogit-dev/responder

v1.0.1

Published

Standardized API response builder and handler utilities

Readme

@bonapasogit-dev/responder

Utility package for standardized API responses across Node.js services.

Features

  • ✅ Strict REST-friendly HTTP status behavior
  • ✅ Unified response payload shape with data, meta, and error
  • ✅ Express-style response handlers
  • ✅ Auto-adapting middleware helpers (status/json and code/send)
  • ✅ Consistent custom error payload object
  • ✅ Validation error normalization
  • ✅ TypeScript-first API

Installation

npm install @bonapasogit-dev/responder

Quick Start

import responder = require('@bonapasogit-dev/responder');

const payload = responder.builder.success({
    message: 'User loaded',
    data: { id: 'u-1' },
    meta: { traceId: 'abc123-def456' },
});

console.log(payload);

// {
//   message: 'User loaded',
//   data: { id: 'u-1' },
//   meta: { traceId: 'abc123-def456' },
//   error: null
// }

Response Schema

All responses follow the same root shape:

{
    "message": "Success",
    "data": {},
    "meta": {},
    "error": null
}

Error responses:

{
    "message": "Validation Error",
    "data": null,
    "meta": {},
    "error": {
        "code": "VALIDATION_FAILED",
        "message": "email is required",
        "details": [
            { "field": "email", "issue": "missing" }
        ],
        "traceId": "abc123-def456"
    }
}

You can place any client-facing error context inside error (for example traceId, details, code, provider-specific fields). Clients can simply check whether error is null.

Middleware (Express/Fastify/Nest/Adonis)

Express-style middleware

import responderMiddleware from '@bonapasogit-dev/responder/middleware';

app.use(responderMiddleware());

app.get('/health', (_req, res) => {
    return res.success({
        message: 'Service ready',
        data: { uptime: process.uptime() },
    });
});

Fastify-style reply decoration

import responderMiddleware from '@bonapasogit-dev/responder/middleware';

fastify.addHook('preHandler', async (_request, reply) => {
    responderMiddleware.attach(reply);
});

fastify.get('/', async (_request, reply) => {
    return reply.success({ data: { ok: true } });
});

@bonapasogit-dev/responder/middleware auto-detects:

  • response.status(...).json(...) (Express / Nest Express)
  • reply.code(...).send(...) (Fastify / Nest Fastify)
  • response.status(...).send(...) (Adonis-style)

HTTP statuses are strict and semantic: 201 for created, 400 for bad request/validation, 401, 403, 404, 409, and 500.

API

  • builder.success(options)
  • builder.error(options)
  • builder.validation(options)
  • builder.forward(response)
  • handler.success(res, options)
  • handler.created(res, options)
  • handler.noContent(res)
  • handler.badRequest(res, options)
  • handler.validationError(res, options)
  • handler.notFound(res, options)
  • handler.conflict(res, options)
  • handler.unauthorized(res, options)
  • handler.forbidden(res, options)
  • handler.internalError(res, options)
  • handler.error(res, options)
  • handler.forward(res, options)
  • middleware(options)
  • middleware.attach(response, options)
  • middleware.createMethods(response)
  • normalizer.fromJoi(error)
  • normalizer.fromExpressValidator(errors)
  • normalizer.fromCustom(field, issue)

Development

npm run build
npm test

License

MIT