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

@arsenicjs/core

v0.5.0

Published

A node.js lightweight web framework

Readme

arsenicjs-core

Core module of the ArsenicJS suite.

This is a early stage alpha project.

ArsenicJS is a lightweight node.js web framework.

sample usage

const {arsenic} = require('@arsenicjs/core')

const DEFAULT_PORT = 8010
const port = process.env.PORT || DEFAULT_PORT

const app = arsenic()


// simple filter. req and resp can be altered to had features
const loggingFilter = (req, resp, next) => {
    console.log("- " , req.path);
    next(req, resp);
}

// simple GET route
app
    .route("/message/:id")
    .method("GET")
    .target((req, res) => { 
      res.header("Content-Type: text/plain").body("this is message " + req.pathparams.id).end()
    })

// more advanced PUT route with a content type restriction
app
    .route("/message/:id")
    .method("PUT")
    .contentType("application/json")
    .target((req, res) => { 
      // do something with message
      res.header("Content-Type: text/plain").body("message " + req.pathparams.id + " updated").end()
    })

app.listen(port)

advanced usage with JSON handling

Here is a more advanced sample with JSON handling and JSON validation (using external libraries).

yarn add body jsonschema

The JSON schemas are defined and exported from some schema.js file.

const { arsenic } = require('@arsenicjs/core')

// load json frameworks
const jsonBody = require('body/json')
const validate = require('jsonschema').validate

const schemas = require('./schemas')

const app = arsenic()

// a filter that parses the body. Need more validation and error handling
const jsonFilter = (req, res, next) => {
    jsonBody(req.req, res.res, function (err, body) {
        if (err) {
            res.status(400, "bad request").header("Content-Type","text/plain").body("could not parse JSON").end()
        } else {
            req.json = body
            next(req, res)
        }
    })
}

const jsonValidateFilter = schema => (req, res, next) => {
    const result = validate(req.json, schema)
    if (result.errors.length == 0) {
        next(req, res)
    } else {
        res.status(400, "bad request").header("Content-Type","text/plain").body("schema validation failed").end()
        // would need to send back a JSON structure with the error messaged from the validation lib
    }
}

app.route("/register/submit")
    .method("POST")
    .contentType("application/json")
    .filter(jsonFilter)
    .filter(jsonValidateFilter(schemas.registerSubmitSchema))
    .target((req, res) => {
      // some handling here, body.json contains the data.
    });

const port = process.env.PORT || 8080
console.log(`listening at http://localhost:${port}/`)

app.listen(port)    

releases

release 0.5.0

  • add route wildcard pattern

release 0.4.1

  • fixed an issue with app level filtering (was only applied on known route, now applied)

release 0.4.0

  • app level filtering with the app.filter() method

release 0.3.0

  • more advanced sample in README
  • fix filters applied in the wrong order

release 0.2.0

  • add route-level filtering

release 0.1.0

  • initial release

todos

  • make the framework more robust
  • add app level error handlers
  • make a nice README like this one : https://www.npmjs.com/package/commander