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

@juniorcitizen/express-web-server

v0.0.1-alpha.13

Published

express web server implemented based on clean architecture

Downloads

50

Readme

@juniorcitizen/express-web-server

express web server implemented based on clean architecture

HIGHLIGHTS

  • Express.js web server written in typescript

  • based on clean architecture

  • popular Express.js middlewares are available as plug-ins

  • accept external middleware plug-ins and server extensions

  • plug-in routing system

INSTALLATION

npm install --save @juniorcitizen/express-web-server

USAGE

import {
  StartWebServerUseCaseDriver as UseCaseDriver,
  StartWebServerServiceFactory as ServiceFactory,
  RouterPlugIn, // router plugin
  Morgan, // middleware plugins
} from '@juniorcitizen/express-web-server'

// factory for extending server functionalities
const serviceFactory = new ServiceFactory()

// add morgan logger plugin
const PROD_MODE = process.env.NODE_ENV==='production'
serviceFactory.plugIn(new Morgan({PROD_MODE: false}))

// add a router
const appRouter = new RouterPlugIn('/')
appRouter.addAllHandlers([middleware..., route handler...])

// add a second router
const testRouter = new RouterPlugIn('/test')
testRouter.addPostHandlers([middleware..., route handler...])

// attach testRouter to the appRouter
appRouter.attachChild(testRouter)

// attach appRouter to Express server
serviceFactory.plugIn(appRouter)

// instantiate server service
const startWebServer = new StartWebServer(serviceFactory)

// start server
startWebServer.execute({PORT: 3000})

PLUGINS AND EXTENSIONS

Available plugIns & extensions

How to roll your own plugIns & extensions

import EnvironmentVariables from '@juniorcitizen/environment-variables'
import {
  StartWebServer,
  StartWebServerServiceFactory as ServiceFactory,
  AbstractServicePlugIn, // extend the plugin base class
} from '@juniorcitizen/express-web-server'

// example of a global route-middleware plugIn
class MyPlugIn extends AbstractServicePlugIn {
  // dependencies can be injected
  // through the constructor
  constructor(thing, someFunction) {
    super()
    this.thing = thing
    this.someFunction = someFunction
    this._middlware = (req, res, next) => {
      this.someFunction()
      console.log(this.thing)
      next()
    }
  }
  // expose the '_middleware' private member
  // useful if this middleware is used on particular routes (non-global)
  // ***implementation of this getter is required if writing typescript***
  // ***for global middlewares, just return undefined***
  getter middleware() {
    return this._middleware
  }
  // an instance of the Express app is exposed
  // to the 'execute' method, enable middleware
  // and extension to the Express server
  // ***implementation of this method is required***
  execute(app) {
    app.use(this._middleware)
  }
}

const serviceFactory = new ServiceFactory() // service factory
// make your plug-in dependencies
const someFunction = () => {
  console.log('someFunction is executed')
}
const thing = 'I am the thing'
const myPlugIn = new MyPlugIn(thing, someFunction) // instantiate your plug-in
serviceFactory.plugIn(myPlugIn) // register your plug-in
const startWebServer = new StartWebServer(serviceFactory) // instantiate server
// setup and plug-in your routers...
// ...
// ...
startWebServer.execute({PORT: 3000}) // start server

ROUTER PLUGIN SYSTEM

to be completed... see the 'USAGE' section for example

API

to be completed... see the 'USAGE' section for example