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

@inventhq/plugin-sdk

v0.1.1

Published

TypeScript SDK for plugin-runtime connector and event-handler plugins

Downloads

96

Readme

Plugin Runtime SDK

TypeScript SDK + CLI for building event-handler and connector plugins that run inside secure V8 isolates.

What's in this package

sdk/
├── cli/                 CLI tool (plugin init, build, deploy, dev, logs)
├── src/                 SDK source (types, helpers, providers, validation)
├── dist/                Built type definitions (ambient types for plugins)
├── examples/            Working example plugins
├── AI_CONTEXT.md        Machine-readable reference for AI coding assistants
├── DEVELOPER_GUIDE.md   Full human developer guide
└── package.json

Quick Start

1. Install

npm install -g .    # from inside this sdk/ folder
# or link for development:
npm link

2. Create a plugin

plugin init my-plugin
# Prompts: pick a template, set your tenant prefix, set runtime URL
cd my-plugin

3. Edit → Build → Deploy

# Edit src/plugin.ts — full autocomplete via ambient types, no imports needed
plugin validate       # type-check
plugin build          # compile TS → JS
plugin deploy         # register with runtime (saves plugin_id to plugin.json)
plugin logs           # view execution logs
plugin dev            # watch mode — rebuild + deploy on save

Runtime URL

By default the CLI points to http://localhost:3050. To change it:

  • During plugin init — interactive prompt asks for the URL
  • In plugin.json — set "runtime_url": "https://your-runtime.example.com"
  • Via environment variable — PLUGIN_RUNTIME_URL=https://...

Key Concepts

  • No importsdefinePlugin, defineConnector, RuntimeHelper, defineTable, etc. are globals injected into every plugin's V8 isolate
  • plugin.json — config file created by plugin init. Contains name, events, tenant, runtime_url, allowed_domains
  • allowed_domainsruntime.fetch() is blocked by default. List the API hostnames your plugin needs in plugin.json
  • Params are strings — all event params and emit params must be strings. RuntimeHelper.emit() auto-coerces for you

Plugin Types

Event Handler — reacts to events from the SSE pipeline:

export default definePlugin({
  name: "my-plugin",
  events: ["order.created"],
  async onEvent(event: Event, runtime: Runtime) {
    const rt = new RuntimeHelper(runtime);
    await rt.emit("order.processed", { order_id: event.params.order_id });
  },
});

Connector — ingests data via webhooks, polling, and backfill:

export default defineConnector({
  name: "my-connector",
  webhook: { verify(...) {}, normalize(...) {} },
  poller:  { fetch(...) {}, normalize(...) {} },
});

Available Runtime APIs

| Method | Description | |--------|-------------| | runtime.emit(type, params) | Emit a derived event | | runtime.fetch(url, opts?) | HTTP request (domain-restricted) | | runtime.dbExec(sql, params?) | Write to plugin database | | runtime.dbQuery(sql, params?) | Read from plugin database | | runtime.getState(key) | Read plugin state (KV) | | runtime.setState(key, value) | Write plugin state (KV) | | runtime.getConfig() | Read plugin config JSON | | runtime.log.info/warn/error(msg) | Structured logging |

Documentation

Examples

  • examples/e2e-stripe-charge-processor/ — event handler that processes Stripe charges
  • examples/stripe-connector/ — full connector with webhooks, polling, and backfill