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

@sourceregistry/sveltekit-actionbus

v1.1.0

Published

[![npm version](https://img.shields.io/npm/v/@sourceregistry/sveltekit-actionbus?logo=npm)](https://www.npmjs.com/package/@sourceregistry/sveltekit-actionbus) [![License](https://img.shields.io/npm/l/@sourceregistry/sveltekit-actionbus)](https://github.co

Readme

@sourceregistry/sveltekit-actionbus

npm version License CI codecov

Typed, component-first live updates for SvelteKit. ActionBus gives an app one shared WebSocket connection, typed channel subscriptions, authorized server broadcasts, and Svelte stores for client-side reactive state.

V1 is intentionally server-to-client for business data. Client WebSocket messages are limited to subscribe/unsubscribe control messages; mutations should remain SvelteKit actions or endpoints.

Features

  • One root Svelte 5 <ActionBus> provider
  • Typed channels and per-channel events through App.ActionEvents
  • Runtime channel/event-name validation generated by the Vite plugin
  • Authorized server-side subscriptions
  • Reference-counted client subscriptions
  • Svelte readable stores, subscription-scoped errors, and reducer-based eventStore
  • Best-effort delivery with reconnect and automatic resubscribe

Installation

npm install @sourceregistry/sveltekit-actionbus

Setup

Register the Vite plugin.

// vite.config.ts
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { actionbus } from '@sourceregistry/sveltekit-actionbus/vite';

export default defineConfig({
	plugins: [sveltekit(), actionbus()]
});

Declare the channels and events your app can use.

// src/app.d.ts
declare global {
	namespace App {
		interface ActionEvents {
			'project:${string}': {
				'task.updated': { id: string; title: string };
				'task.deleted': { id: string };
			};

			'user:${string}:notifications': {
				'notification.created': { id: string; message: string };
			};
		}
	}
}

export {};

Client Usage

Mount one bus near the root of the app.

<!-- src/routes/+layout.svelte -->
<script lang="ts">
	import ActionBus from '@sourceregistry/sveltekit-actionbus/ActionBus.svelte';

	let { children } = $props();
</script>

<ActionBus url="/actionbus">
	{@render children()}
</ActionBus>

Subscribe from descendants with the module export from ActionBus.svelte.

<script lang="ts">
	import { subscribe } from '@sourceregistry/sveltekit-actionbus/ActionBus.svelte';

	const actionbus = subscribe('project:123', 'user:me:notifications');
	const project = actionbus.channel('project:123');
	const errors = actionbus.errors;

	const tasks = project.eventStore(data.tasks, {
		'task.updated': (tasks, message) => {
			return upsert(tasks, message.event.payload);
		},
		'task.deleted': (tasks, message) => {
			return tasks.filter((task) => task.id !== message.event.payload.id);
		}
	});
</script>

subscribe(...) can retain multiple channels with one shared connection. Use subscription.channel(channel) when reducers should be scoped to one channel, especially when different channels can emit the same event name.

You can also use the convenience component.

<script lang="ts">
	import ActionSubscription from '@sourceregistry/sveltekit-actionbus/ActionSubscription.svelte';
</script>

<ActionSubscription channels={['project:123'] as const}>
	{#snippet children({ events, errors, eventStore, state })}
		<!-- render with the subscription stores -->
	{/snippet}
</ActionSubscription>

Server Usage

Create one server-side bus and import it from server code that broadcasts events.

// src/lib/server/actionbus.ts
import { createActionBus } from '@sourceregistry/sveltekit-actionbus/server';

export const actionbus = createActionBus({
	path: '/actionbus',
	authorize: async ({ channel, request }) => {
		return canSubscribe(request, channel);
	}
});

Broadcast typed events to subscribed clients.

actionbus.broadcast('project:123', {
	type: 'task.updated',
	payload: { id: 't1', title: 'New title' }
});

Local Example

This repository includes a runnable showcase under src/routes.

npm run dev

Open the local app in two browser tabs. The page subscribes to project:demo; submitting the form in one tab broadcasts a typed task.updated event to the other tab through the shared ActionBus socket.

Deployment Notes

ActionBus uses WebSockets through @sourceregistry/sveltekit-websockets. It needs a SvelteKit deployment target that supports persistent WebSocket upgrades. Serverless or edge-only platforms that do not support WebSocket upgrades are out of scope for V1.