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

libmalan

v0.0.24

Published

Functions to interact with a Malan backend

Readme

Lib Malan

Some JavaScript/TypeScript utility functions for accessing the Malan Authentication Service

Examples:

Note this is not a production-ready example, more of a "how to I start playing with this" example.

import * as malan from 'libmalan'

let malanConfig = {
  host: "http://127.0.0.1",
  api_token: "",
}

// Log in with username and password
const { id, api_token, user_id } = await malan.login(malanConfig, "username", "password")

// Save API token for later use
malanConfig.api_token = resp.api_token

// Get the user object
const user = (await malan.getUser(malanConfig, user_id)).data

// Get the session object
let session = await malan.getSession(malanConfig, user.id, session_id)

// Validate that the current user token has admin role
const isAdmin = await malan.isValidWithRole(malanConfig, user.id, session_id, "admin")

// Log the user out (this will invalidate the API token)
session = await malan.logout(malanConfig, user.id, session_id)

Running the tests

Automated process

The easiest way to run the tests is to use the script that CI uses:

npm run test:ci

This requires that docker and docker-compose be installed. It will pull the latest malan image, initialize it and its database, invoke the tests with npm, and stop the malan and database containers.

This is useful if you just want to run tests once with minimal effort. If you are developing though, it will have a lot of overhead. I recommend you use the manual described next.

Manual process

The tests expect a malan to be running on localhost:4000. It is highly advised that you do not run them against a staging or production instance of malan because some test data will most certainly not be cleaned up properly.

1. Get a malan instance running

The fastest way to get started is to use the docker-compose file to start a malan instance:

docker-compose up malan

Note: If you're on an ARM device, you need to switch the malan image in docker-compose.yml otherwise malan will crash on startup. The image name is already there but is commented out. You just need to switch the images.

If you prefer a native run (instead of in docker), make sure Elixir and postgres are installed, then run:

git clone https://github.com/FreedomBen/malan
cd malan
mix deps.get
mix phx.server

2. Run the tests

npm run test

Release Process

Authentication with npm

To publish, you'll need an npm auth token. There are numerous different ways to accomplish this, such as running npm login. If you have 2 factor enabled (which you should if you don't), the easiest way is to issue an automation token.

Put that automation token in the environment variable NPM_TOKEN then add to libmalan/.npmrc

echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> .npmrc

To release a new version:

  1. Update version number in package.json
  2. Install latest packages: npm install
  3. Build a tarball you can verify: npm pack
  4. Commit updated package.json and package-lock.json
  5. Tag new version: Ex: git tag v0.0.17
  6. Push commits and tags: git push && git push --tags
  7. Build and publish latest version: npm publish