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

cf-framework-strategy

v2.7.0

Published

A Minimalist Node.js Framework Abstraction

Downloads

40

Readme

cf-framework-strategy

A Minimalist Node.js Framework Abstraction

** Work in Progress**

This node web framework abstraction strives to provide a consistent, pragmatic, and smart standard for interacting with node's native http module through the various competing high performing frameworks such as Express and Hapi.

Why is it that with every new major framework version, we are left with painful code rewriting? How come when you start a new project and you decide on a different framework, you are left with less than ideal amounts of code reuse from previous projects even though you're doing the exact same things? I mean, how many different ways do we know to send a response and read from a request? This should all be standardized by now. The responsible thing for new framework creators to do would be heed the inherent advice from previous frameworks rather than introduce new interfaces simply because the author prefers a particular wording or syntax. Unless the change in interface is purely for performance gains, which, I would argue, the interface should be decoupled from this ANYWAYS, consistency should be a primary goal.

In the case where a framework interface must change due to some performance (or security) implication, you can be confident that your client projects can be updated with a quick change in dependency. Another benefit is the ability to load test your application on various leading frameworks at the click of a button, as well as go back in time and try new framework versions out on older code in order to compare performance.

Meet cf-framework-strategy. It goes a little something like this:

YourProjectA__                             __Express
              \                           /
               respond.with(200, 'Hello')---AnotherFutureFramework
YourProjectB__/                           \__Hapi

Perhaps this project will grow into a number of separate libraries all inheriting from some base interface; this way, different versionings of each framework can be supported exclusive to each other. If community backing ever grows on this, that is a real consideration, but for now, I'm hapi, err, I mean happy with the latest versions of every framework I use.

Example Express Usage

let FrameworkStrategy = require('cf-framework-strategy').express;

let framework = new FrameworkStrategy({
  http: {
    port: 3000
  }
});

framework
  .start()
  .then(() => {

    framework.addRoute('/', {
      post: (request, respond) => {
        console.log(request.getBody());
        respond.with(200, 'Hello Express');
      }
    });

  });

Example Hapi Usage

let FrameworkStrategy = require('cf-framework-strategy').hapi;

let framework = new FrameworkStrategy({
  http: {
    port: 3000
  }
});

framework
  .start()
  .then(() => {

    framework.addRoute('/', {
      post: (request, respond) => {
        console.log(request.getBody());
        respond.with(200, 'Hello Hapi');
      }
    });

  });

Responding With a File

  respond.withFile(location);

Get Object of Cookies

  request.getCookies();

Forcing HTTPS

This will redirect all http requests to https. You may define the ports of each as follows:

let framework = new FrameworkStrategy({
  http: {
    port: 80
  },
  https: {
    port: 443,
    force: true,
    options: {
      key: fs.readFileSync('./ssl/my.key'),
      cert: fs.readFileSync('./ssl/my.crt')
    }
  }
});