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

@rpcbase/services

v0.12.0

Published

Tenant services are long-running Docker containers managed by rpcbase. Each tenant gets one services container that runs the app-owned services entrypoint.

Readme

@rpcbase/services

Tenant services are long-running Docker containers managed by rpcbase. Each tenant gets one services container that runs the app-owned services entrypoint.

Apps define their services runtime in:

src/services/
  Dockerfile
  index.ts
  service-1/
  service-2/

The app decides how index.ts starts and supervises its internal services. rpcbase only builds or runs one container per tenant and injects tenant context.

import { startTenantServices } from "@rpcbase/services"

await startTenantServices({
  configs: [
    {
      siteId: "rb-app",
      tenantId: "00000000",
      build: {
        context: "./sample-app",
        dockerfile: "src/services/Dockerfile",
        platform: "linux/amd64",
        src: ["package.json", "package-lock.json", "src/services"],
      },
      egress: {
        mode: "tailscaleExitNode",
        exitNode: "home-exit-node",
      },
    },
  ],
  pruneStale: true,
})

Egress modes:

  • direct: the services container uses the configured Docker network.
  • tailscaleExitNode: rpcbase starts one Tailscale sidecar for the tenant and the services container shares its network namespace.

build.src is optional. When set, only those paths are sent to the Docker daemon for the build context. When omitted, the whole build context is sent.

Data:

Each services container gets a /data bind mount by convention. The host path is:

<build.context>/infrastructure/data/rb-services-<tenantId>

For example, tenant ca-roule stores service data under infrastructure/data/rb-services-ca-roule. Apps should write service-owned persistent state below /data inside the container. If a config already binds /data or a /data/... subpath, rpcbase leaves that bind untouched.

Tenant service RPC

Apps can expose short control commands from a tenant services process and call them from an API process without opening an HTTP port or using Redis. rpcbase runs a small CLI inside the tenant services container with Docker exec; that CLI forwards the request to the already-running service process through a private Unix socket.

Service entrypoint:

import {
  isTenantServiceRpcCliCommand,
  runTenantServiceRpcCliFromProcessArgs,
  startTenantServiceRpcServer,
} from "@rpcbase/services"

if (isTenantServiceRpcCliCommand()) {
  await runTenantServiceRpcCliFromProcessArgs()
} else {
  const rpc = await startTenantServiceRpcServer()
  rpc.register("service.command", async (payload) => {
    return { payload }
  })
}

API side:

import { callTenantServiceRpc } from "@rpcbase/services"

const response = await callTenantServiceRpc({
  projectName: "rb-services",
  siteId: "rb-app",
  tenantId: "00000000",
  command: "service.command",
  payload: { value: 1 },
})

The RPC response is { ok: true, data?: unknown } or { ok: false, error: { message, code? } }. Payload validation belongs to the app command handler.