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 🙏

© 2025 – Pkg Stats / Ryan Hefner

harno-kernel-web

v0.0.1

Published

Npm module that helps you to build your web-like js projects

Readme

Harno-kernel-web

Npm module that helps you to build your web-like js projects. This module is basically the same as harno-kernel, but it also contains a lot of usefull services for web

Install

npm install harno-kernel-web

Usage (SORRY, IT IS NOT QUITE RIGHT, WILL BE UPDATE SOON)

Basic

main.js
// you can export WebKernel instance
const { YourService } = require('./your.file.js')
const webKernel = require('harno-kernel-web').default

export default class App {
  constructor () {
    // you can init all default services and it's dependencies
    webKernel.registerDefaultServices()
    webKernel.initDefaultServicesDependencies()

    // some services have logger service as their dependencies, so before initing them, it would be great to configure logger
    webKernel.getService('logger').config({ ... })

    // call init methods of some services
    webKernel.initDefaultServices()

    // you can register your services like this
    webKernel.registerService('yourAnyName', YourService)

    // you can init dependencies for your service like this
    webKernel.initDependencies({
      yourAnyName: ['express', 'config']
    })

    // you can get any service by its name like this
    const yourAnyName = webKernel.getService('yourAnyName')
    // or
    const yourAnyName = webKernel.s.yourAnyName
  }
}

Advanced

main.js
// you can export WebKernel class, or any other available service
const { YourService } = require('./your.file.js')
const { WebKernel, ConfigService, ExpressService, ... } = require('harno-kernel-web').default

export default class App {
  constructor () {
    this.kernel = new WebKernel()

    // you can register services
    this.kernel.registerService('express', ExpressService)
    this.kernel.registerService('config', ConfigService)
    this.kernel.registerService('yourAnyName', YourService)

    // you can init dependencies for any service (for some default services you must do that)
    this.kernel.initDependencies({
      yourAnyName: ['express', 'config']
    })

    // you need to call init function of some default services
    this.kernel.s.express.init()

    // in this example YourService would have property _dependencies or _d with links to express and config services
    const yourAnyName = this.kernel.getService('yourAnyName')

    // look at the your.file.js bellow
    console.log(yourAnyName.afterInitDependencies())
    // output: My dependencies is: express and config
  }

  async start () {
    // you can get services like this
    this.kernel.getService('configService').readJson('./path.to.json')

    // or like this
    const port = this.kernel.s.configService.c.port
    await this.kernel.s.expressService.start(port)
  }
}
your.file.js
class YourService {
  afterInitDependencies () {
    // after init your service will have property _dependencies or _d, that will contain all inited dependencies
    const express = this._d.express
    const config = this._d.config

    if (express && config) {
      console.log('My dependencies is: express and config')
    }
  }
}

export { YourService }

API

new WebKernel()

Creates new server kernel instance

webKernel.initDependencies(dependenciesConfig)

  • dependenciesConfig example:
  const dependenciesConfig = {
    serviceName1: ['serviceName2', 'serviceName3'],
    serviceName2: ['serviceName4'],
    ...
  }

Inits/sets services dependencies, so that in our example service serviceName1 will have property _dependencies or _d that would contain serviceName2, serviceName3 services

webKernel.registerService(name, Service)

  • name - service name (can be any string)
  • Service - any js class

Register/saves Service class instance under the name in the server kernel

webKernel.getService(name)

  • name - service name

Gets service that was created under that name

webKernel.s

Kernel property that contains all registered services

webKernel.registerDefaultServices()

Registers all default services under default names (look at Defaut services for more info)

webKernel.initDefaultServicesDependencies()

Inits all default services dependencies

webKernel.initDefaultServices()

Inits all default services. Calls init method of default services

Default services

TestService

  • Default name: testService
  • Dependencies: ['testService']
  • Description: Test class would be deleted
  • API: Work in progress, so more reliable api would be announced later

License

License