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

fundamen

v0.4.1

Published

Foundation code base for various SquizzLabs projects

Readme

Init

The app's .env file must have the following defined:

  • BASEPATH location of the app

(optional)

  • WATCH_FILES a comma delimited list of files to stop execution when modified

Cron

fundamen implements an easy to use method for javascript files to run in a cron-like fashion for the following files

./cron/*.js

.env

  • WATCH_FILES_CRON a comma delimited list of files to stop execution when modified

Parameters

Each file should return an export with the following format

|parameter|type|description| |---------|---|:---| |exec |function|The function that will be executed multiple times with span intervals |init |function|The function that will be executed only once when the application starts| |timespan |integer |The modulus timespan in seconds to execute the exec function. For example, every 5 minutes would be 900, once an hour 3600| |offset |integer |The offset to apply to span. For example, if you'd like a cron to run once a day at noon, use a span of 86400 and an offset of -43200|

Starting

It is recommended to start the application's cronjobs seperate from www, and this can be done with the following:

node ./bin/cron.js

If you'd like to debug a specific cronjob:

node ./bin/cron.js filename

www

The whole point of fundamen was to abstract many of the things needed to be done with express and just allow one to start writing code.

The following .env variables will affect fundamen

REQUIRED

  • PORT the port to listen on

Optional

  • WEBSOCKET_LOAD whether or not to load the websocket, defaults to false

  • WEBSOCKET_PORT the port to listen to for the websocket, defaults to 18888

  • ENABLE_ETAG false allows incoming requests to provide etag value for caching

  • HTTP_COOKIE_SECRET none

  • HTTP_COOKIE_SECURE 'test'

  • HTTP_COOKIE_HTTPONLY true

  • HTTP_COOKIE_SAMESITE 'strict'

  • HTTP_COOKIE_TIMEOUT_SECONDS 0

  • HTTP_EXTENDED_LIMIT extends express' bodyparser maximum size to this limit, e.g. 50mb

  • WATCH_FILES_WWW a comma delimited list of files to stop execution when modified

  • http_caching_enabled, defaults to false, if enabled will utilize redis for caching GET requests only

  • http_logging false, whether or not to emit log events for web requests

  • www_public - the directory where public files will be located, defaults to BASEPATH/www/public/

Utility

  • env2res Comma delimited list of keys who's values will be passed to pug renders directly

Example:

env2res=copyrightyear,googleauth
copyrightyear=2025
googleauth=AE8000EA

There is a value that will always be present, server_started, and that is the Date.now() value for when the server was... started. This is useful in instances such as the following (pug):

link(rel="stylesheet" href="/css/app.css?v=" + server_started)

www

fundamen will load *.js files in the www/controllers directory and route them with the following format:

{
    paths: string, [string1, string2, etc...],
    method: function,
    priority: integer (defaults 0),
}
  • The path to listen to, example, /
  • The following methods are valid: connect, delete, get, head, options, patch, post, put, trace
  • the function to execute for this path and method
  • the function will be executed and passed the following parameters app, req, and res

The callback is expected to be an object that can contain the following parameters:

{
    content_type: string,
    ttl: integer > 0,
    cors: sets 'Access-Control-Allow-Origin' to this value,
    status_code: integer > 0,
    redirect: a redirect url, uses status_code 302 unless specified otherwise
    json: returns the given json object
    view: compiles and returns the result using the given pug file
    package: an object that contains the package to send, may be error prone if you have not set res manually
}
  • Any requests that have /api/ in the url will always be given cors

websocket

The websocket can be accessed using app.websocket