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

@camstack/sdk

v1.2.60

Published

The client library for talking to a **CamStack hub**.

Readme

@camstack/sdk

The client library for talking to a CamStack hub.

It gives you System — a connected client that owns the transport (tRPC over WebSocket, or HTTP), the login flow, a warm cache of the hub's devices, and live event subscriptions — plus the shared TypeScript types (detections, timeline, devices, cameras) that the hub's API speaks.

This is what the CamStack Viewer app is built on.

Install

npm install @camstack/sdk @camstack/types @trpc/client

@camstack/types and @trpc/client are not bundled: the published build imports both at runtime, so they must be installed alongside.

Quickstart

import { createSystem } from '@camstack/sdk'
import { EventCategory } from '@camstack/types'

// Log in (a tokenless System is enough — `login` is a public procedure).
const { token } = await createSystem({ serverUrl: 'http://hub.local:4443' })
  .login('admin', 'hunter2')

const system = createSystem({
  serverUrl: 'http://hub.local:4443',
  token,
  onConnectionChange: (state) => console.info('transport:', state),
})

// Warm-boot the device mirror, then read devices synchronously.
await system.init()
for (const info of system.listDeviceInfos()) {
  console.info(info.id, info.name, info.online)
}

// Fully typed calls against the hub's tRPC router.
const snapshot = await system.trpcClient.snapshot.getSnapshot.query({ deviceId: 42 })

// Live events, one subscription per category, fanned out to all listeners.
const unsubscribe = system.subscribeEvent(EventCategory.MotionOnMotionChanged, (event) => {
  console.info(event.source, event.data)
})

// …later
unsubscribe()
system.close()

If login returns requiresTotp, the returned token is a challenge — pass it to system.loginVerifyTotp(challengeToken, code) to exchange it for a session token. Passkeys have an equivalent pair of methods.

What's exported

packages/sdk/src/index.ts is the authoritative list. In broad strokes:

| Surface | What it is | | --- | --- | | System, createSystem, SystemConfig | The client. Connection lifecycle, auth, devices, live events. | | raceFastestEndpoint | Probes candidate base URLs against /trpc/health and returns the first to answer. For clients that reach the same hub over several routes. | | BackendAppRouter (alias AppRouter) | Type-only. The hub's tRPC router type — use it to type your own tRPC client if you don't want System. | | DetectionClass + classifiers | The detection-class vocabulary (isPersonClassname, getParentClass, timeline presets, …). | | Device types | CanonicalDeviceType, getCanonicalDeviceType, and the raw→canonical maps. | | Timeline / NVR / camera types | Type-only shapes for events, clusters, recordings, clips, PTZ, camera status. | | FEATURE_MATRIX, isFeatureAvailable | Static table of which features a given source/platform supports. |

System also exposes the hub's system-scoped capabilities as typed namespaces (system.storage, system.userManagement, system.streamBroker, …), and system.trpcClient as the escape hatch for anything not wrapped.

What it is not

  • Not a REST wrapper. Everything goes over tRPC to a CamStack hub. There is no stable HTTP surface here to call by hand.
  • Not a standalone NVR client. It does not talk to Frigate, Scrypted, ONVIF or a camera directly — the hub does that. Names like CameraSourceType are how the hub describes a source, not clients for it.
  • Not versioned independently of the hub. The router types are generated from the server, so an SDK build matches the hub it was built against. Expect to keep the two roughly in step; no compatibility window is promised.

License

MIT