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

ejs-fw

v0.2.0

Published

EJS live framework — SSR first paint, WebSocket soft-nav, automatic form POST, room HTML broadcast

Readme

ejs-fw

EJS live module — server-rendered first paint, then WebSocket-only navigation and form POSTs. No separate JSON API. Rooms broadcast HTML patches to every connected peer (Discord-style chat).

HTTP is used only for the initial full-page SSR. After that, the client never reloads the document unless the user refreshes manually.

Install

npm install ejs-fw
# local
npm install file:./ejs-fw --install-links

Peer: express >= 4. Dependency: ws.

Host app (module consumer)

You build the app; ejs-fw supplies runtime + WS hub. Register pages/posts — no per-page client WebSocket code.

const http = require('http');
const express = require('express');
const ejsfw = require('ejs-fw');

const app = express();
app.set('view engine', 'ejs');

const server = http.createServer(app);
const fw = ejsfw.install(app, {
  server,
  // optional: authenticate: async (req) => ({ id: req.session?.userId }),
});

fw.page('/chat/:room', async (ctx) => ({
  view: 'chat',
  locals: {
    title: 'Chat',
    messages: await loadMessages(ctx.params.room),
  },
  room: `chat:${ctx.params.room}`,
}));

// <form method="post" action="/chat/general/messages"> → here over WebSocket
fw.post('/chat/:room/messages', async (ctx) => {
  const msg = await saveMessage(ctx.params.room, ctx.data.text, ctx.user);
  const html = await ctx.render('partials/message', { msg });
  return {
    broadcast: {
      target: '[data-seyfo-stream="messages"]',
      html,
      mode: 'append',
    },
    ack: { clearForm: true },
  };
});

app.get('/chat/:room', (req, res) => fw.renderDefinedPage(req, res));

server.listen(3000);

fw.post is not app.post — it only runs over the WebSocket. The browser never issues an HTTP POST for intercepted forms.

Layout contract

<root id="seyfo">
  <%- body %>
</root>

<script type="application/json" id="seyfo-data"><%- JSON.stringify({
  title: title,
  path: currentPath,
  room: typeof room !== 'undefined' ? room : currentPath,
  wsPath: '/ejs-fw/ws'
}).replace(/</g, '\\u003c') %></script>
<script type="module" src="/ejs-fw/runtime.js"></script>
<a href="/chat/general" data-seyfo-link>General</a>

Automatic form POST

Any form with method="post" (or data-seyfo-post / data-seyfo-action) is intercepted by the runtime:

<ul data-seyfo-stream="messages">
  <% messages.forEach(function (msg) { %>
    <%- include('partials/message', { msg: msg }) %>
  <% }) %>
</ul>

<form method="post" action="/chat/general/messages">
  <input name="text" autocomplete="off" />
  <button type="submit">Send</button>
</form>
  • preventDefault — no full-page submit
  • Form fields → WebSocket { type: 'post', path, data }
  • Opt out: data-seyfo-native or data-seyfo-ignore
  • Named action override: data-seyfo-action="chat.send" → fw.action('chat.send', …)

API

| Export / return | Role | |-----------------|------| | install(app, { server, wsPath?, authenticate? }) | Middleware, static client, WS hub | | fw.page(pattern, handler) | SSR + WS navigation resolver | | fw.post(pattern, handler) | WS form POST handler | | fw.action(name, handler) | Optional named WS action | | fw.renderPage(req, res, view, locals) | Full SSR (or legacy HTTP partial) | | fw.renderDefinedPage(req, res) | Run matched fw.page for HTTP GET | | fw.renderToHtml(view, locals) | EJS → HTML string | | fw.broadcast(room, message) | Raw room broadcast | | fw.broadcastPatch(room, patch) | { target, html, mode } to room | | scriptTag() | <script type="module" src="/ejs-fw/runtime.js"> |

Handler results

return {
  broadcast: { target: '#list', html, mode: 'append' | 'prepend' | 'replace' },
  ack: { clearForm: true },
  patch: { target, html, mode },   // sender only
  page: { view, locals, path, room }, // full #seyfo swap
  redirect: '/other',
};

ctx.render(view, locals), ctx.user, ctx.data, ctx.params, ctx.room, ctx.broadcast(patch) are available inside handlers.

Protocol (WebSocket JSON)

Client → server: join | nav | prefetch | post | action
Server → client: page | prefetch | patch | ack | error | redirect

Default WS path: /ejs-fw/ws.

License

MIT