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

repl2http

v1.0.13

Published

A Node.js REPL server that runs over HTTP from any directory

Downloads

398

Readme

REPL2HTTP

A Node.js REPL server that runs over HTTP, allowing you to execute JavaScript code in your current directory context from any client.

Features

  • 🚀 Run JavaScript code in your project's context via HTTP
  • 🔄 Automatically resolves require() statements relative to your current directory
  • 📦 Works with local modules and installed npm packages
  • 🔒 Captures and returns console output
  • 🛠️ Simple HTTP API for integration with any client

Important Notes

Working Directory

REPL2HTTP uses the directory from which it was started as the current working directory. All relative paths in require() statements will be resolved relative to this directory.

For example, if you start the server from your project root:

cd /path/to/my/project
npx repl2http

Then require('./lib/myModule') will look for the module at /path/to/my/project/lib/myModule.js.

If you start it from a subdirectory:

cd /path/to/my/project/src
npx repl2http

Then require('./utils') will look for the module at /path/to/my/project/src/utils.js.

Installation

# Install globally
npm install -g repl2http

# Or run directly with npx
npx repl2http

Usage

Starting the Server

# Start with default settings (port 3000)
npx repl2http

# Specify a custom port
npx repl2http --port 8080

# Enable debug logging
npx repl2http --debug

# Show detailed environment information
npx repl2http --verbose

Command Line Options

  • -p, --port PORT - Set the port number (default: 3000)
  • -d, --debug - Enable debug logging
  • -v, --verbose - Show detailed environment information
  • -h, --help - Display help information

HTTP API

Server Info

GET /

Returns information about the server, including:

  • Server status
  • API usage information
  • Node.js version
  • Current working directory

Execute Code

POST /repl
Content-Type: application/json

{
  "code": "const result = 2 + 2; console.log('Calculation result:', result); result;"
}

Returns:

{
  "result": 4,
  "output": ["[log] Calculation result: 4"],
  "cwd": "/your/current/directory"
}

Examples

Basic Arithmetic

{ "code": "2 + 2" }

Working with Files

{ "code": "const fs = require('fs'); fs.readdirSync('.')" }

Requiring Local Modules

{ "code": "const myModule = require('./lib/myModule'); myModule.doSomething()" }

Async/Await Support

{ "code": "async function test() { return 'async result'; }; return await test()" }

Security Considerations

⚠️ Important: REPL2HTTP executes arbitrary JavaScript code in your environment. Only use it in trusted environments (like development) and never expose it to the public internet.

License

MIT