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

@sitesurge/client

v0.2.5

Published

Typed headless HTTP client (SDK) for the SiteSurge CMS API.

Readme

@sitesurge/client

The headless, typed TypeScript client for any SiteSurge CMS backend — one cms.* namespace surface over HTTP, with token lifecycle, an SWR cache, typed errors, and optional SolidJS bindings. Zero runtime dependencies; works in Node ≥ 18 and modern browsers.

Doctrine: all client-side API requests for SiteSurge route through this package — @sitesurge/admin, external apps, and Node/agent scripts alike.

Install

In-repo it is already wired as a workspace dependency:

{ "dependencies": { "@sitesurge/client": "workspace:*" } }

Publish-ready (ESM + CJS + .d.ts, exports map with . and ./solid); no npm publish yet.

30-second example

import { createClient } from '@sitesurge/client';

const cms = createClient({ baseUrl: 'https://cms.example.com', auth: { apiKey: 'ssk_…' } });
const posts = await cms.posts.list({ status: 'all' });   // typed, paginated, cached

// Or a Bearer session — login persists tokens (localStorage by default):
const app = createClient({ baseUrl: 'https://cms.example.com' });
await app.auth.login({ email: '[email protected]', password: 'secret' });
const me = await app.auth.me();

Full reference

See docs/Overview.md — config reference, auth modes, caching (SWR), the error hierarchy, the SolidJS adapter, and a per-module method table for all 26 namespaces.

Integration smoke test

test-integration/smoke.test.ts exercises the built client against a REAL, running API. It is manual — excluded from npm test (it lives outside src/, which the unit vitest config globs) and from CI. The run is skipped unless SMOKE_API_KEY is set, so it never fails a server-less environment.

Run it against a local API on the side port 3101 (ports 3000/3001 may host another project):

# 1. Point the API at the side port (back up first — restore byte-identical).
cp packages/api/.env /tmp/cc-smoke-env-backup
sed -i 's/^PORT=3001$/PORT=3101/' packages/api/.env

# 2. Boot the API and wait for http://localhost:3101/api/v1/health/live.
( cd packages/api && npx tsx src/index.ts & )

# 3. Seed an admin-scoped API key (sha256 of the plaintext lands in key_hash).
HASH=$(node -e "console.log(require('crypto').createHash('sha256').update('ssk_smoketest0000000000000000000000000000000000').digest('hex'))")
psql "$DATABASE_URL" -c "INSERT INTO api_keys (name, key_hash, key_prefix, scopes) VALUES ('cc-smoke', '$HASH', 'ssk_smoketes', '{admin}')"

# 4. Build the client, then run the smoke test.
npm run build -w packages/cms-client
SMOKE_API_KEY='ssk_smoketest0000000000000000000000000000000000' npm run test:integration -w packages/cms-client

# 5. Teardown: kill the API, delete the key, restore .env byte-identical.
pgrep -f 'tsx src/index.ts' | xargs kill
psql "$DATABASE_URL" -c "DELETE FROM api_keys WHERE name='cc-smoke'"
cp /tmp/cc-smoke-env-backup packages/api/.env

The test asserts: posts.list({ status: 'all' }) returns an array (admin via key); a second identical list is served from the memory cache (one network call across both); health.live() works; and posts.getById('000…') rejects with NotFoundError.

Drift check

npm run check:drift -w packages/cms-client asserts every route in docs/api-manifest.json is reachable by a client method (or explicitly allowlisted in src/modules/coverage.ts).

References