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

@nice-code/devtools-vite

v0.58.0

Published

Readme

@nice-code/devtools-vite

Docs: nicecode.io — guides, integrations, and the full API surface. Working with an AI assistant? Point it at nicecode.io/llms.txt — the complete, current docs flattened into plain text.

A Vite dev-server plugin that makes opening the nice-code devtools the entire setup.

Add it once, and the first time anyone clicks devtools the local relay starts itself. Every other client of that app — a second tab, a private window, another browser, a phone on your LAN — finds it and joins the same devtools window. No relay to run in a second terminal, no relayUrl to configure, and no console noise in the sessions that never open devtools at all.

import { niceDevtools } from "@nice-code/devtools-vite";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [react(), niceDevtools()],
});

That's it. Dev-only: the plugin is apply: "serve", so a production build contains none of it.

What it actually does

It serves two same-origin routes on your dev server:

| Route | Method | Meaning | | --- | --- | --- | | /__nice_devtools/status | GET | Is a relay running? Never starts one. | | /__nice_devtools/ensure | POST | Start one if it isn't. Idempotent. |

Your app's devtools bridge asks status when it loads and joins the relay if there is one. Clicking the devtools launcher POSTs ensure. That is the whole protocol.

Why an endpoint rather than letting the browser probe the relay's port directly? The page is served from localhost:5173 and the relay lives on localhost:5199 — a cross-origin request, which would force the relay to grow CORS headers and an opinion about who may ask it questions. The dev server is already same-origin with the app, and it is the only process that can start a relay anyway.

Options

niceDevtools({
  port: 5199,              // the relay's well-known port
  host: "127.0.0.1",       // pass "0.0.0.0" for the phone-on-your-LAN workflow
  autoStart: "on-demand",  // "eager" | "never"
});
  • autoStart: "on-demand" (default) — the relay starts on the first devtools click. Most dev sessions never open devtools, and they should not pay a port and a server for it.
  • autoStart: "eager" — start it when the dev server boots.
  • autoStart: "never" — only report whether a relay is running; you start it yourself with bunx @nice-code/devtools-relay (e.g. to pass flags this plugin doesn't expose).

One relay, many dev servers

The port is well-known because discovery needs exactly one place to look — which means two dev servers inevitably race for it. That race is resolved, not prevented:

probe → if a relay answers, use it → else bind → if the bind loses, probe again.

Losing the bind means somebody else won it in the intervening moments, so their relay is the one everyone should use. Hosting one relay per dev server would instead re-partition clients by whichever port their app happens to be served from, which is the exact split the relay exists to heal.

The relay runs in-process, inside whichever dev server started it, so it dies with that process — there is no orphan to hunt down. If that dev server exits while others are still running, surviving clients ask their dev server to stand a new one up, and reconnect to it. No page reload.

Liveness is not identity

Before concluding "a relay is already running", the plugin checks that the thing answering on the port really is one (/health carries a service marker). If some unrelated dev server holds 5199, you get a warning that says so and names the fix — rather than devtools that silently never connect with nothing in any log to explain it.

Security

The relay binds 127.0.0.1 by default: a relay nobody consciously started should not be reachable from the network. Pass host: "0.0.0.0" to let a phone on your LAN join the devtools window (your Vite server.host must expose the app too). If a LAN client asks a loopback-bound relay's dev server for status, it is told there is no relay — rather than handed a URL that can never connect — and the dev server logs the one-line fix.

The relay itself is unauthenticated and ephemeral — local dev only. It keeps no history and logs no content. See @nice-code/devtools-relay.

Not using Vite?

Discovery is a Vite-dev-server feature. A React Native client, a non-Vite dev server, or a relay running somewhere other than this machine should set relayUrl on the devtools config explicitly — an explicit URL always wins, and the client dials it directly without asking anyone.