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

@openreachtech/renchan-express

v0.2.1

Published

Express bindings for renchan

Readme

@openreachtech/renchan-express

Express bindings for renchan: route classes, and a server builder that assembles an Express application out of an engine and a server-specific routes builder.

Concept

A server built on this package is split into three parts.

| part | responsibility | provided by | | :-- | :-- | :-- | | engine | holds the environment and the config, and collects the middleware and the Express settings | BaseServerEngine, derived by the application | | server-specific routes builder | produces the routes the server answers on | BaseServerSpecificRoutesBuilder, derived by the application. SentinelServerSpecificRoutesBuilder for a server with no routes of its own | | server builder | assembles the two into an Express application and an HTTP server | BaseExpressServerBuilder, derived by the application |

What kind of server it is — JSON-RPC, RESTful API, GraphQL — is settled by the server-specific routes builder a derived server builder names. The server builder itself knows nothing about it.

Each dependency is reached through the classes listed below, so that a major version of one is answered in those classes alone.

| dependency | reached through | | :-- | :-- | | express | BaseExpressServerBuilder, BaseExpressMiddlewareInflator | | http | BaseExpressServerBuilder | | cors | CorsMiddlewareInflator |

Installation

Requires Node.js 24.19.0 or later (the CI builds against the current LTS).

npm install @openreachtech/renchan-express

It is an ES module ("type": "module"); import it with ESM import syntax.

The following are peer dependencies. The application provides them.

| package | range | | :-- | :-- | | express | ^4.22.3 | | @types/express | ^4.17.25 | | cors | ^2.8.6 | | @types/cors | ^2.8.19 |

Usage

import {
  BaseServerSpecificRoutesBuilder,
  BaseExpressServerBuilder,
  BaseServerEngine,
  GetMethodExpressRoute,
} from '@openreachtech/renchan-express'

// The engine: config, middleware and Express settings.
class AlphaServerEngine extends BaseServerEngine {
  static get env () {
    return {
      NODE_ENV: 'development',
    }
  }

  static get config () {
    return {
      staticPath: 'public/',
    }
  }

  composeMiddlewareFactoryOptionsLookup () {
    return {
      static: [this.config.staticPath],
      json: [{ limit: '10mb' }],
    }
  }

  collectExpressSettings () {
    return {
      'trust proxy': true,
    }
  }
}

// The server-specific routes builder: the routes the server answers on.
class AlphaServerSpecificRoutesBuilder extends BaseServerSpecificRoutesBuilder {
  buildRoutes () {
    return [
      GetMethodExpressRoute.create({
        path: '/health',
        handlers: [
          (req, res) => {
            res.json({
              status: 'ok',
            })
          },
        ],
      }),
    ]
  }
}

// The server builder: names the server-specific routes builder, and nothing else.
class AlphaExpressServerBuilder extends BaseExpressServerBuilder {
  static get ServerSpecificRoutesBuilderCtor () {
    return AlphaServerSpecificRoutesBuilder
  }
}

const serverBuilder = await AlphaExpressServerBuilder.createAsync({
  EngineCtor: AlphaServerEngine,
})

serverBuilder.buildHttpServer()
  .listen(3000)

The engine is derived from BaseServerEngine, and the server-specific routes builder from BaseServerSpecificRoutesBuilder.

A server whose engine carries every middleware it needs has no routes to build. Such a server names SentinelServerSpecificRoutesBuilder, which builds no routes, as its server-specific routes builder.

API

API reference

How the server is assembled

#buildHttpServer() runs the following steps in order.

  1. Apply the settings the engine collects to the Express application. Express reads its settings when the first route is mounted, so this comes before any mounting.
  2. Collect one middleware route carrying every handler the engine collects.
  3. Collect the routes the server-specific routes builder produces.
  4. Mount the middleware route, then the other routes, onto the Express application.
  5. Hand the mounted application to #buildServerRootApp(), which returns it unchanged unless a derived class overrides it.
  6. Create an HTTP server from what step 5 returns. The server is returned without listening.

Contribution

Bug reports, feature requests, and code contributions are welcome.

Feel free to contact us through GitHub Issues.

git clone https://github.com/openreachtech/renchan-express.git
cd renchan-express
npm install
npm run lint
npm test

License

This project is released under the Apache License 2.0.

For more details, please see in the LICENSE file.

Developer

Open Reach Tech Inc.

Copyright

© 2026 Open Reach Tech Inc.