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

koa-shell

v1.0.0

Published

Configurable REST server and web app for executing shell scripts

Readme

koa-shell

Build Status NPM version Prettier License

koa-shell is a configurable REST-based web server used to execute shell commands, bundled with a web application for convenience.

This can be used to remotely send commands to a computer running on the local network, e.g. one used to manage a smart home network or host a network drive. This can be done through the REST API directly or through the bundled web application.

koa-shell is intended to only be used from within the the local network. I would not recommend exposing this server to the Internet without additional security layers.

Sample

Usage

Install koa-shell with either of the following, depending on your preferred package manager:

  • yarn global add koa-shell
  • npm install --global koa-shell

Then use it like the following:

$ koa-shell --help
Usage: koa-shell [config.json path (default: config.json)]

$ cd ~/desired/config/json/directory

$ echo '{"name":"My Server","port":80,"commands":['\
>  '{"id":"ping","description":"PONG","script":"echo PONG"},'\
>  '{"id":"lights-on","description":"Turn on the lights","script":"lighton"}'\
>  ']}' > config.json

$ koa-shell
Listening on port 80

$ # ...then in another terminal
$ curl -X POST http://localhost/api/commands/ping
{"success":true,"output":"PONG"}

Configuration

  • name - Name of the server. Used for the web application's title.
  • port - Port to host the server on.
  • commands - Array of available commands to execute.
    • id - Unique identifier for the command. This is can only contain alphanumeric characters, hyphens, and underscores.
    • description - Text describing what this command achieves.
    • script - The script to be executed on the host.

REST Endpoints

GET /

Loads the web page shown in the screenshot above. This can be used from anything with a modern web browser, including mobile devices.

GET /api/config

Gets the config.json which is currently used by the server.

$ curl http://localhost/api/config
{"name":"My Server","port":80,"commands":[{"id":"ping","description":"PONG","scr
ipt":"echo PONG"},{"id":"lights-on","description":"Turns on the lights","script"
:"some-script"}]}

GET /api/commands

Gets information on all commands which can be run on the server.

$ curl http://localhost/api/commands
[{"id":"ping","description":"PONG","script":"echo PONG"},{"id":"lights-on","desc
ription":"Turns on the lights","script":"some-script"}]

GET /api/commands/{id}

Gets information on the command with the provided id.

$ curl http://localhost/api/commands/ping
{"id":"ping","description":"PONG","script":"echo PONG"}

POST /api/commands/{id}

Executes the command with the provided id.

$ curl -X POST http://localhost/api/commands/ping
{"success":true,"output":"PONG"}

Notes

  • koa-shell can be imported as a library.
  • You may want to use a process manager such as runit to manage the server.