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

@horos/resi

v0.1.3

Published

Resi Web API Package

Readme

Resi Web API Platform

This is still in testing

This platform allows you to implement your API on the server side, and generate a client side with built in intellisense support.

The package ships with PASETO token management, and support for streaming responses from the server.

Installation

Install the package

npm i -s @horos/resi

or

yarn add @horos/resi

Install peer dependencies

server:

npm i -s acorn body-parser cors express express-rate-limit morgan paseto

or

yarn add acorn body-parser cors express express-rate-limit morgan paseto

client:

npm i -s axios @react-native-async-storage/async-storage

or

yarn add axios @react-native-async-storage/async-storage

Server side usage

  1. Create 2 folders, one for your api files (the actual functions) and one for your models.
  2. Create a model file
export class TestModel {
  /**
   *
   * @param {string} a
   */
  constructor(a) {
    this.a = a;
  }
}
  1. Create an API file
import { TestModel } from '../models/testModel';
import { enrich, authorization } from '@horos/resi/plugs';
import { createAPIImplementation } from '@horos/resi/create-api';

//                                       ⬇ API name
export default createAPIImplementation('test', {
  /**
   * This JSDoc will be kept for intellisense on the client side
   *
   * @param {number} num1
   * @param {number} num2
   * @returns {Promise<number>}
   */
  test(num1, num2) {
    return num1 + num2;
  },

  /**
   * @returns {Promise<import('../models/testModel').TestModel>}
   */

  //         ⬇ Use the enrich function to plug features to your funtion
  shogi: enrich(async function () {
    return new TestModel('banana');
    // ⬇ In this case authorization is plugged, which means only authorized clients can invoke this handler
  }, authorization),
});
  1. Security object is needed for authorizing incoming requests. 3 Keys are required in total - Public/Private key pair, and a secret key.

You can generate them like this by adding this command to your package.json scripts:

"generate-security-keys": "create-key-set ./security-keys"

Load your keys before you initialize the server

import { KeyFile } from '@horos/resi/server';

const keyFilePaths = {
  publicKey: './security-keys/public',
  privateKey: './security-keys/private',
  secret: './security-keys/secret',
};

/**
 * @type {{[key in keyof(keyFilePaths)]: KeyFile}}
 */
let keyFiles;

export async function loadKeyFiles() {
  if (!keyFiles) keyFiles = await KeyFile.resolveKeyFiles(keyFilePaths);

  return keyFiles;
}
  1. Finally create your RESI API using your API and models directories, and your security files
import { createServerFromResiDir } from '@horos/resi/server';

async function init() {
  await createServerFromResiDir(path.resolve('./src/resi-server/apis'), path.resolve('./src/resi-server/models'), {
    security,
  });
}

Client side usage

  1. Install @horos/resi on your client as well
  2. Make sure the server is running with NODE_ENV set to "development"
  3. Add a script to your package.json "build-client": "build-client http://localhost src/resi-client" Replace the "http://localhost" with the url of your server, and "src/resi-client" with any path you wish
  4. Execute the new script. This should create a local API, identical to the one on your server
  5. Test your client
import { makeResiClient } from './resi-client/apis';

export const resi = makeResiClient('http://localhost');

Type "resi." and you should see intellisense auto-compeleting according to your server definition.

Execute any function, and it should invoke its respective API function on the server.