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

resora

v0.1.10

Published

A structured API response layer for Node.js and TypeScript with automatic JSON responses, collection support, and pagination handling.

Readme

Resora

NPM Downloads npm version License CI Deploy Docs

Resora is a structured API response layer for Node.js and TypeScript backends.

It provides a clean, explicit way to transform data into consistent JSON responses and automatically send them to the client. Resora supports single resources, collections, and pagination metadata while remaining framework-agnostic and strongly typed.

Resora is designed for teams that care about long-term maintainability, predictable API contracts, and clean separation of concerns.


What Problem Does Resora Solve?

In most Node.js backends:

  • Controllers shape JSON directly
  • Response formats drift over time
  • Pagination logic is duplicated
  • Metadata handling is inconsistent

Resora introduces a dedicated response transformation layer that removes these concerns from controllers and centralizes response structure in one place.


Core Capabilities

  • Explicit data-to-response transformation
  • Automatic JSON response dispatch
  • First-class collection support
  • Built-in pagination metadata handling
  • Predictable and consistent response contracts
  • Strong TypeScript typing
  • Transport-layer friendly (Express, H3, and others)

Basic Example

Single Resource

import { Resource } from 'resora';

class UserResource extends Resource {
  data() {
    return this.toArray();
  }
}
return new UserResource(user).additional({
  status: 'success',
  message: 'User retrieved',
});

Response:

{
  "data": {
    "id": 1,
    "name": "John"
  },
  "status": "success",
  "message": "User retrieved"
}

Collection with Pagination

import { ResourceCollection } from 'resora';

class UserCollection<R extends User[]> extends ResourceCollection<R> {
  collects = UserResource;

  data() {
    return this.toArray();
  }
}
return new UserCollection({
  data: users,
  pagination: {
    from: 1,
    to: 10,
    perPage: 10,
    total: 100,
  },
}).additional({
  status: 'success',
  message: 'Users retrieved',
});

Response:

{
  "data": [...],
  "meta": {
    "pagination": {
      "from": 1,
      "to": 10,
      "perPage": 10,
      "total": 100
    }
  },
  "status": "success",
  "message": "Users retrieved"
}

Architectural Positioning

Resora sits between your application logic and the HTTP layer.

  • Controllers handle request flow
  • Services handle business logic
  • Resora handles response structure

This separation ensures:

  • Stable API contracts
  • Minimal controller logic
  • Clear ownership of response shape

Design Principles

  • Explicit over implicit behavior
  • Separation of concerns
  • Minimal abstraction cost
  • Strong typing as a first-class feature
  • Framework independence

Framework Compatibility

Resora is not tied to a specific HTTP framework.

It works with:

  • Express
  • H3
  • Any application or framework that supports Connect-style middleware

Adapters can be added without changing application logic.


When to Use Resora

Resora is a good fit if you:

  • Build APIs with long-term maintenance in mind
  • Care about response consistency across teams
  • Want pagination and metadata handled once
  • Prefer explicit structure over ad-hoc JSON responses

It is intentionally not opinionated about routing, validation, or persistence.


License

MIT