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

@deployagram/environment

v1.0.0

Published

Finds or starts the Deployagram Collector and HTTP Proxy for Node.js tests: reuses a running one (by URL or Docker image), otherwise starts it with testcontainers.

Readme

@deployagram/environment

Finds, or starts, the Deployagram Collector and HTTP Proxy for Node.js tests. It is the Node.js equivalent of the Java deployagram-environment module.

For each service it tries, in order:

  1. A URL, from the options or from DEPLOYAGRAM_LOGGER_URL / DEPLOYAGRAM_PROXY_URL. If set, it must be reachable, or the call fails. It does not fall back to starting one.
  2. A running container whose image starts with the expected name and publishes port 8080. Found with the Docker API.
  3. A new container, started with testcontainers, if neither of the above exists.

Your normal setup, with the Collector started by hand, is covered by step 1 or 2. Nothing has to be started for the tests.

npm install @deployagram/environment
import { startDeployagramEnvironment, stopDeployagramEnvironment } from '@deployagram/environment';

const env = await startDeployagramEnvironment();
env.logger.url;  // e.g. http://localhost:1152
env.proxy?.url; // e.g. http://localhost:9080, or undefined with proxy: false

// later, when the run is over
await stopDeployagramEnvironment();

startDeployagramEnvironment runs once per process and returns the same environment after that. In Vitest, call it from a globalSetup file and call stopDeployagramEnvironment in its teardown.

Options

| Option | Default | Meaning | |---|---|---| | loggerUrl | DEPLOYAGRAM_LOGGER_URL | Collector URL to use. Must be reachable. | | proxyUrl | DEPLOYAGRAM_PROXY_URL | Proxy URL to use. Must be reachable. | | proxy | true | false starts and finds no Proxy, for a Collector-only test with in-process stubs such as MSW or Nock | | loggerImage | the owner's collector image | Image name matched by prefix | | proxyImage | the owner's proxy image | Image name matched by prefix | | network | deployagram | Docker network for started containers. Created if missing. | | loggerEnvironment | {} | Extra environment for a started Collector, such as KAFKA_BROKER_LOCATION_MODE=RUNTIME | | proxyConfig | {} | Proxy configuration to start the Proxy with | | env | process.env | Environment variables to read | | cwd | current directory | Where to find the .deployagram licence file |

Licence and credentials

To start a container, the licence and key are required:

  • DEPLOYAGRAM_LICENSE, or the .deployagram file in the working directory
  • DEPLOYAGRAM_LICENSE_KEY

Cloud credentials (DEPLOYAGRAM_CLIENT_ID, DEPLOYAGRAM_CLOUD_USERNAME, DEPLOYAGRAM_CLOUD_PASSWORD) are passed to a started Collector. Reusing a running service needs none of these.

Differences from the Java module

  • The Java module starts the Proxy on a fixed host port when proxyPort is set. Here the Proxy is given a random port, and tests read its URL from the environment, so no fixed port is needed.
  • A URL that is set but unreachable is an error. The Java module has no URL setting.
  • A started Proxy reaches a started Collector through the Docker network alias diagram-logger. A Collector found in Docker is reached by container id on the same network, as in Java. A Collector given by URL is reached through host.docker.internal.

Requirements

  • Docker, to find or start containers. A URL-only setup needs no Docker.
  • To start containers, the owner's collector and proxy images, pulled from the private registry.

Testing

npm test

Tests use fake dependencies and an HTTP stub (MSW). They need no Docker and start no containers. The Docker lookup and the testcontainers start are not covered by unit tests. They were checked by hand against the running Collector.