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

@evjs/runtime

v0.0.1-rc.9

Published

Client and server runtime for the evjs framework

Readme

@evjs/runtime

Core runtime for the ev framework. Provides client-side routing, data fetching, and server-side handling via Hono.

Installation

npm install @evjs/runtime

Exports

@evjs/runtime/client

| Export | Description | |--------|-------------| | createApp | Bootstrap TanStack Router + Query + DOM | | query(fn) | Universal query proxy for server functions | | mutation(fn) | Universal mutation proxy for server functions | | createQueryProxy(module) | Module-level query proxy | | createMutationProxy(module) | Module-level mutation proxy | | initTransport | One-time transport configuration (endpoint, custom transport, codec) | | ServerFunctionError | Structured error class for server function failures | | jsonCodec | Default JSON codec | | createRootRoute, createRoute, Link, Outlet, ... | Re-exports from @tanstack/react-router | | useQuery, useMutation, useQueryClient, ... | Re-exports from @tanstack/react-query |

@evjs/runtime/server

| Export | Description | |--------|-------------| | createApp | Create a Hono app with server function handler | | createHandler | Standalone Hono sub-app for server function dispatch | | dispatch | Protocol-agnostic dispatcher for custom transports (WebSocket, IPC) | | registerMiddleware | Register middleware for all server function calls | | registerServerFn | Register a server function in the registry | | ServerError | Throwable error with structured data and custom status | | jsonCodec | Default JSON codec |

@evjs/runtime/server/node

| Export | Description | |--------|-------------| | serve | Start the app on Node.js (default port 3001) |

@evjs/runtime/server/ecma

| Export | Description | |--------|-------------| | createFetchHandler | Wrap Hono app for Deno, Bun, or any Fetch-compatible runtime |

Usage

Client

import { createApp, createRootRoute, query, mutation } from "@evjs/runtime/client";
import { getUsers, createUser } from "./api/users.server";

function Users() {
  const { data } = query(getUsers).useQuery();
  const { mutate } = mutation(createUser).useMutation({
    invalidates: [getUsers],  // auto-invalidate on success
  });
}

const rootRoute = createRootRoute({ component: Root });
const app = createApp({ routeTree: rootRoute });
app.render("#app");

Server

import { createApp } from "@evjs/runtime/server";
import { serve } from "@evjs/runtime/server/node";

const app = createApp();
serve(app, { port: 3001 });

Custom Transport

import { initTransport } from "@evjs/runtime/client";

// Custom endpoint
initTransport({
  baseUrl: "https://api.example.com",
  endpoint: "/server-function",  // default: "/api/fn"
});

// Custom protocol (e.g. WebSocket)
initTransport({
  transport: {
    send: async (fnId, args) => { /* your protocol */ },
  },
});

// Custom serialization
initTransport({
  codec: { serialize: msgpack.encode, deserialize: msgpack.decode, contentType: "application/msgpack" },
});

Server Middleware

import { registerMiddleware } from "@evjs/runtime/server";

registerMiddleware(async (ctx, next) => {
  console.log(`Calling ${ctx.fnId}`);
  const start = Date.now();
  const result = await next();
  console.log(`${ctx.fnId} took ${Date.now() - start}ms`);
  return result;
});

Typed Errors

import { ServerError } from "@evjs/runtime/server";

export async function getUser(id: string) {
  const user = db.find(id);
  if (!user) throw new ServerError("User not found", { status: 404, data: { id } });
  return user;
}

Query Proxy Patterns

// Direct wrapper
const { data } = query(getUsers).useQuery();

// With args
const { data } = query(getUser).useQuery(userId);

// Query invalidation
query(getUsers).invalidate();

// queryOptions (for prefetching)
const options = query(getUsers).queryOptions();
queryClient.prefetchQuery(options);

// Module proxy
import * as UsersAPI from "./api/users.server";
const api = createQueryProxy(UsersAPI);
const { data } = api.getUsers.useQuery();

Custom Transport (WebSocket)

import { initTransport } from "@evjs/runtime/client";

initTransport({
  transport: {
    send: async (fnId, args) => {
      return new Promise((resolve, reject) => {
        ws.send(JSON.stringify({ id: ++reqId, fnId, args }));
        pending.set(reqId, { resolve, reject });
      });
    },
  },
});

See examples/websocket-fns for a full working example.