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

@polytric/openws-ui

v0.0.3

Published

Polytric OpenWS UI, a generic web UI for exploring and exercising OpenWS specs

Readme

OpenWS UI

npm license

OpenWS UI is a generic web UI for exploring and exercising OpenWS specs - similar in spirit to Swagger UI, but for OpenWS/WebSocket-style message networks.

It renders an OpenWS spec into:

  • a left navigation tree (networks -> roles -> messages)
  • message "send" forms generated from payload schemas
  • a console view for sent/received traffic with filtering
  • a connect flow to select a host endpoint (when configured)

This package is framework-agnostic. It ships the UI assets and a small helper (openwsUiRoot) to let you serve them from any backend.

OpenWS UI main screen


Install

npm i @polytric/openws-ui

What you get

This package is intended to be used by server integrations (Fastify, Express, etc.):

  • openwsUiRoot: an absolute path to the built UI assets directory (so your server can serve them via its static-file middleware).

Serving OpenWS UI (framework-agnostic)

At runtime, OpenWS UI needs two things:

  1. A spec URL it can fetch (your server should expose this JSON).
  2. An index.html config injection so the UI knows where the spec is and (optionally) which roles are "hosts" for connection presets.

Runtime config format

OpenWS UI expects a JSON blob embedded in the page:

<script id="openws-ui-config" type="application/json">
    {
        "specUrl": "/openws/spec.json",
        "networkHosts": {
            "Chat": ["Server"]
        }
    }
</script>
  • specUrl (string): where the UI fetches your OpenWS spec JSON.
  • networkHosts (record): { [networkName: string]: string[] }, listing which roles are considered hosts for that network.
    • This is used to drive the "Connect" dialog presets.

Minimal server responsibilities

Your server should:

  • Serve static assets from openwsUiRoot (usually under /openws/)
  • Serve your spec JSON at something like /openws/spec.json
  • Serve the UI entry route /openws/ and inject the runtime config into index.html

Example: Injecting runtime config

Pseudo-code (the same approach works in Fastify/Express/Koa/etc.):

import fs from 'node:fs'
import path from 'node:path'
import { openwsUiRoot } from '@polytric/openws-ui'

const indexTemplate = fs.readFileSync(path.join(openwsUiRoot, 'index.html'), 'utf8')

function renderIndexHtml({
    specUrl,
    networkHosts,
}: {
    specUrl: string
    networkHosts: Record<string, string[]>
}) {
    return indexTemplate.replace(
        '<!--OPENWS_UI_CONFIG-->',
        `<script id="openws-ui-config" type="application/json">${JSON.stringify({ specUrl, networkHosts })}</script>`
    )
}

Important: the UI build includes an index.html with an <!--OPENWS_UI_CONFIG--> placeholder. Your server should replace that placeholder with the runtime config script tag.


Notes

  • OpenWS UI is a frontend - it does not implement server-side WebSocket logic.
  • The UI is driven entirely by the OpenWS spec you provide.
  • If you're using Fastify, see @polytric/fastify-openws-ui for a ready-to-use integration.

License

Licensed under the Apache License 2.0. See LICENSE.