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

@skystate/core

v0.1.0

Published

Framework-agnostic SkyState client for public state, auth token storage, and per-user state.

Readme

@skystate/core

Framework-agnostic SkyState client for public state, auth token storage, and per-user state.

Install

Public npm installation is pending. The intended package name is @skystate/core.

In this repository:

npm install
npm run build
npm run typecheck
npm test

Basic Usage

import { createSkyStateClient } from '@skystate/core';

const client = createSkyStateClient({
  account: 'acc_example',
  project: 'my-app',
  environment: 'production',
});

await client.init();

const banner = client.publicState.get('banner', { enabled: false });

client.setAuthTokens({ idToken, refreshToken });

const theme = client.userState.get('theme', 'dark');
client.userState.set('theme', 'light');

account, project, and environment are required. apiUrl defaults to https://api.skystate.io.

Public API

| API | Signature | Description | |---|---|---| | createSkyStateClient | (options: SkyStateClientOptions) => SkyStateClient | Creates a framework-agnostic client. | | client.init | () => Promise<void> | Initializes public state and auth state. | | client.dispose | () => void | Releases client resources. | | client.publicState.get | (key: string, fallback?: unknown) => unknown | Reads a public-state key. | | client.setAuthTokens | ({ idToken, refreshToken }) => void | Attaches hosted-auth tokens. | | client.clearAuthTokens | (error?: AuthError) => void | Clears local auth state. | | client.logout | () => Promise<void> | Signs out through SkyState. | | client.userState.get | (key: string, fallback?: unknown) => unknown | Reads a user-state key. | | client.userState.set | (key: string, value: unknown) => void | Writes a user-state key. | | client.userState.subscribe | (key: string, listener: () => void) => () => void | Subscribes to a user-state key. | | client.userState.draft | <T>(key: string, fallback?: T) => UserStateDraftHandle<T> | Creates a local draft handle for edit-then-save UI. |

User State

User state requires end-user SkyState auth tokens. After tokens are set, the client can read, write, and draft keyed values for the signed-in user.

client.setAuthTokens({ idToken, refreshToken });

const theme = client.userState.get('theme', 'dark');
client.userState.set('theme', 'light');

const draft = client.userState.draft('profile', { displayName: '' });
draft.set((current) => ({ ...current, displayName: 'Ada' }));
draft.push();

Writes update local subscribers immediately and are persisted by the SDK. Temporary network, sign-in renewal, concurrent update, validation, and permission issues are surfaced through snapshots and provider error callbacks in wrapper SDKs.

Draft handles expose get, committed, hasDraft, getDraft, set, push, discard, subscribe, and dispose.

Value-Only SDK Contract

The v1 SDK surface is intentionally value-only. Public snapshots expose status, data, and errors; keyed SDK accessors return values. Use the console, CLI, or REST API when you need inspection, audit, or history metadata.

Exports

| Export | Description | |---|---| | createSkyStateClient() | Creates a SkyStateClient. | | SkyStateError, SkyStateErrorCode | Typed SDK errors and error-code union. | | SkyStateClient, SkyStateClientOptions, ClientSnapshot, ClientLifecycle | Client and lifecycle types. | | PublicStateSnapshot, AuthSnapshot, UserStateSnapshot, AuthError | Snapshot and auth error types. | | PublicStateAccessor, UserStateAccessor, UserStateDraftHandle | Public accessor and draft types. | | decodeJwtPayload() | Decode a JWT payload for inspection. | | buildStorageKey(), createLocalStorage(), createMemoryStorage(), AuthTokenStorage | Auth token storage helpers and type. | | toJsonPointer(), resolvePointer() | Lower-level JSON Pointer helpers. State accessors take top-level keys. | | INITIAL_SNAPSHOT | Initial client snapshot constant. | | assertNever() | Exhaustiveness helper for discriminated unions. | | RefreshOutcome | Token-refresh outcome type for advanced integrations. |

Docs

See the public docs at /docs/sdk/core/.