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

@thenewlabs/locus-server

v0.3.8

Published

One-command self-contained Locus server: hosted workbench SPA + preview origin + entangle blind relay on a single port

Readme

@thenewlabs/locus-server

One command stands up a complete, self-contained Locus deployment: the hosted workbench SPA, the preview origin, and the entangle blind relay — all on a single port.

npm i -g @thenewlabs/locus-server
locus-server --port 8080

The published package is fully standalone. Everything is bundled at build time:

  • dist/relay.js — the entangle blind relay (WebSocket agent registration + relay pipes), bundled from entangle source.
  • dist/entangle-client.js — the entangle browser client, injected into the served SPA so window.entangle exists before the app boots.
  • dist/cli.js — the launcher.
  • web/ — the built locus-web SPA (index.html, preview.html, sw.js, assets/, __locus/bootstrap.js, __locus/agent.js).

There are no runtime dependencies on the entangle source tree.

What it serves

On one plain-HTTP port, distinguished by the Host header:

  • View origin — the Locus workbench SPA. Capability URLs (/cap/<id>) fall through to the SPA so the client reads the capability from the URL.
  • Preview host — a preview. subdomain that serves the preview bootstrap and the Service-Worker tunnel bridge.
  • Blind relay — WebSocket upgrades at /agent/register and /relay/<capId>.

Options

| Flag | Default | Description | | --- | --- | --- | | --port <n> | 8080 | Port to listen on | | --host <addr> | 0.0.0.0 | Address to bind | | --domain <domain> | — | Convenience: sets --view-origin https://<domain> and --preview-host preview.<domain> unless those are given explicitly | | --view-origin <url> | — | Explicit view origin (e.g. https://locus.example.com) | | --preview-host <host> | — | Explicit preview host (e.g. preview.locus.example.com) | | --output-mode <text\|json> | text | Log output mode |

Production deployment (behind a TLS proxy)

locus-server listens on plain HTTP and expects TLS termination at a front proxy (e.g. Caddy). The proxy must forward the x-forwarded-proto header so the relay can derive the correct frame-ancestors / view origins for the preview iframe.

locus-server --domain locus.thenewlabs.com --port 8080

DNS: point both hostnames at the machine —

locus.thenewlabs.com          A/AAAA -> <host>
preview.locus.thenewlabs.com  A/AAAA -> <host>

Example Caddyfile (Caddy auto-provisions TLS for both names):

locus.thenewlabs.com, preview.locus.thenewlabs.com {
    reverse_proxy 127.0.0.1:8080
}

Caddy sets x-forwarded-proto automatically. If you use a different proxy, ensure that header is forwarded.

Connecting an agent

Once the server is up, point the Locus CLI at it:

locus <dir> --relay https://locus.thenewlabs.com

(That relay is the default once your deployment is configured, so locus <dir> alone works too.)

Build (from the monorepo)

The bundling reads the entangle source and the built locus-web SPA:

npm run build --workspace=@thenewlabs/locus-web     # build the SPA first
npm run build --workspace=@thenewlabs/locus-server  # bundle everything

License

MIT