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

@vasilevich/simple-toggle

v1.3.0

Published

Simple remote toggle and value control server with a reusable Node.js client.

Readme

Simple Toggle

A tiny authenticated server for remote toggles and single-value controls, with a web UI and Node.js client.

Client

Requires Node.js 18+.

npm install github:vasilevich/simple-toggle

CommonJS

const BotControl = require('bots-status-manager');

BotControl.configure({
  url: 'https://toggle.example.com',
  token: process.env.SIMPLE_TOGGLE_TOKEN
});

ESM

import BotControl from 'bots-status-manager';

BotControl.configure({
  url: 'https://toggle.example.com',
  token: process.env.SIMPLE_TOGGLE_TOKEN
});

You can also configure it positionally:

BotControl.init('https://toggle.example.com', process.env.SIMPLE_TOGGLE_TOKEN);

Values

Each value control has two different credentials:

  • Permanent value token — long-lived access to that value. It remains valid until the value card is deleted.
  • One-time set code — short /t/... URL that can set the value once and is then destroyed.

The permanent value API is:

GET  /v/<permanent-value-token>
POST /v/<permanent-value-token>

It does not require the global admin token because the permanent value token itself is the credential.

const values = await BotControl.getValues();
const valuesByKey = await BotControl.getValuesMap();

console.log(valuesByKey.feature_message);

const value = await BotControl.getValueByKey('feature_message', 'default');
await BotControl.setValueByKey('feature_message', 'hello');

If you already have a permanent value token:

const value = await BotControl.getValueOnlyValue(valueToken, 'default');
await BotControl.setValue(valueToken, 'new value');

console.log(BotControl.getPermanentValueUrl(valueToken, true));

Deleting the value itself is still an admin operation:

await BotControl.deleteValue(valueToken);

Short one-time setter links

Create a short public URL for an existing value control. The URL contains no admin token, can be submitted once, and is invalidated immediately after a successful set. The value itself remains stored and the permanent token remains valid.

It expires after 7 days by default.

const link = await BotControl.createTemporarySetUrl(valueToken);
console.log(link.url); // https://toggle.example.com/t/aB93xK7q

Or locate the value by key:

const link = await BotControl.createTemporarySetUrlByKey('customer_reply');

Pass 0 to disable the time expiry while keeping the link single-use:

const link = await BotControl.createTemporarySetUrl(valueToken, 0);

You can also create a brand-new value control and its temporary link in one call:

const crm = new BotControl('crm');
const link = await crm.generateTemporaryUrl('customer_reply', 'Reply from customer');

console.log(link.permanent_access_token); // keep this
console.log(link.temporary_url);          // give this to the one-time setter

The web UI exposes the same split with Permanent URL and One-time link actions on every Value card.

Toggles

const worker = new BotControl('worker-name');

await worker.enable();
await worker.disable();
const status = await worker.getStatus();

Generate a value control

const worker = new BotControl('worker-name');
const link = await worker.generateUrl('message', 'Message shown by the worker', 'hello');

console.log(link.permanent_access_token);
console.log(link.user_url);
console.log(link.get_value_url);
console.log(link.set_value_url);

Server

npm start

Server configuration lives in config/default.json and can be overridden through the config package as before.