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.0.0

Published

Express bindings for renchan

Readme

@openreachtech/renchan-express

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

Concept

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

| part | responsibility | provided by | | :-- | :-- | :-- | | engine | holds the config, and collects the middleware and the Express settings | the application | | routes builder | produces the routes the server answers on | the application | | 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 routes builder a derived server builder names. The server builder itself knows nothing about it.

BaseExpressServerBuilder is the one place express and http are reached through, so that a major version of either is answered in a single file.

Installation

Requires Node.js 20.x 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.

express ^4.22.3 and @types/express ^4.17.25 are peer dependencies. The application provides them.

Usage

import express from 'express'

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

// The engine: config, middleware and Express settings.
class AlphaServerEngine {
  static async createAsync () {
    return new this()
  }

  get config () {
    return {}
  }

  collectMiddleware () {
    return [
      express.json(),
    ]
  }

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

// The routes builder: the routes the server answers on.
class AlphaRoutesBuilder {
  constructor ({
    engine,
  }) {
    this.engine = engine
  }

  static async createAsync ({
    engine,
  }) {
    return new this({
      engine,
    })
  }

  buildRoutes () {
    return [
      GetMethodExpressRoute.create({
        path: '/health',
        handlers: [
          (req, res) => {
            res.json({
              status: 'ok',
            })
          },
        ],
      }),
    ]
  }
}

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

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

serverBuilder.buildHttpServer()
  .listen(3000)

The shapes the engine and the routes builder have to take are declared as ExpressType.ServerEngine and ExpressType.RoutesBuilder in types/express-type.d.ts.

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 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.