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 🙏

© 2024 – Pkg Stats / Ryan Hefner

beanify

v3.0.34

Published

micro-services nats nats-micro-services

Downloads

77

Readme

Beanify's inspiration came from working with Hemera. After 3 versions of iteration, it has become a low-cost, high load capacity microservice framework. With beanify, you can start any number of services on different hosts to ensure maximum availability.

Requirements

Node.js v10 LTS (10.16.0) or later.

Features

  • Lightweight: The Beanify is small as possible and provide an extensive plugin system.
  • Location transparency: A service may be instantiated in different locations at different times. An application interacting with an service and does not know the service physical location.
  • Service Discovery: You don't need a service discovery all subscriptions are managed by NATS.
  • Load Balancing: Requests are load balanced (random) by NATS mechanism of "queue groups".
  • High performant: NATS is able to handle million of requests per second.
  • Scalability: Filtering on the subject name enables services to divide work (perhaps with locality).
  • Fault tolerance: Auto-heals when new services are added. Configure cluster mode to be more reliable.
  • Extendible: Beanify is fully extensible via its hooks, plugins and decorators.
  • Developer friendly: the framework is built to be very expressive and help the developer in their daily use, without sacrificing performance and security.
  • Request & Reply: By default point-to-point involves the fastest or first to respond.
  • Publish & Subscribe: Beanify supports all features of NATS. This includes wildcards in subjects and normal publish and queue mechanism.

Environment

  • BEANIFY_NATS_URL: will be mapped to the nats.url
  • BEANIFY_NATS_SERVERS: will be mapped to the nats.servers
  • BEANIFY_NATS_USER: will be mapped to the nats.user
  • BEANIFY_NATS_PASS: will be mapped to the nats.pass
  • BEANIFY_NATS_TOKEN: will be mapped to the nats.token
  • BEANIFY_PINO_LEVEL: will be mapped to the pino.level
  • BEANIFY_PINO_PRETTY: will be mapped to the pino.printPretty
  • BEANIFY_ROUTER_PREFIX: will be mapped to the router.prefix

Install

If installing in an existing project, then Beanify can be installed into the project as a dependency:

Install with npm:

npm i beanify --save

Install with yarn:

yarn add beanify

Example

const beanify = require('beanify')({
  // nats:{}
  // pino:{}
  // errio:{}
  // router:{}
})

beanify
  .route({
    url: 'math.add',
    handler (req, rep) {
      const { a, b } = req.body
      rep.send(a + b)
    }
  })
  .route({
    url: 'math.sub',
    handler (req, rep) {
      const { a, b } = req.body
      rep.send(a - b)
    }
  })
  .ready(() => {
    beanify.inject({
      url: 'math.add',
      body: {
        a: 1,
        b: 2
      },
      handler (e, sum) {
        console.log(e, sum)
      }
    })
  })

with async-await:

const beanify = require('beanify')({
  // nats:{}
  // pino:{}
  // errio:{}
  // router:{}
})

beanify
  .route({
    url: 'math.add',
    async handler (req) {
      const { a, b } = req.body
      return a + b
    }
  })
  .route({
    url: 'math.sub',
    async handler (req) {
      const { a, b } = req.body
      return a - b
    }
  })
  .ready(async () => {
    const sum = await beanify.inject({
      url: 'math.add',
      body: {
        a: 1,
        b: 2
      }
    })
    console.log({ sum })
  })

Documentation

Ecosystem