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

@basezero/sdk

v0.1.0

Published

Server-side identify and uninstall events for BaseZero

Readme

@basezero/sdk

Small, dependency-free server-side client for BaseZero app events. Requires an existing Shopify-mapped BaseZero Project and its API key. No install-state tracking in the app, no Shopify token sharing, no email automation.

import { BaseZero } from '@basezero/sdk';

const basezero = new BaseZero({
  baseUrl: 'https://YOUR_BASEZERO_HOST',
  apiKey: process.env.BASEZERO_API_KEY!,
});

// After authenticating a live shop request:
await basezero.identify({
  platformId: String(shop.id),
  myshopifyDomain: shop.myshopifyDomain,
  name: shop.name,
  email: shop.email,
});

// Only after authenticating an app/uninstalled webhook:
await basezero.uninstall(
  { platformId: String(payload.id) },
  {
    eventId: `shopify-uninstall:${shopifyEventId}`,
    occurredAt: new Date(shopifyTriggeredAt).toISOString(),
  },
);

Use Shopify's original X-Shopify-Event-Id (fallback X-Shopify-Webhook-Id) and X-Shopify-Triggered-At for uninstalls. Missing metadata must be recovered, not replaced with the retry time.

BaseZero derives an inferred install from the first identify, suppresses repeated identify lifecycle events, and derives an inferred reinstall after an uninstall. First identify is not proof of the original Shopify install date. Missed uninstall cycles cannot be inferred from identify alone. Don't identify shops by scanning stale stored sessions.

Delivery

Every call is awaited. Defaults: 3 attempts, 5-second request timeout, exponential retry delay. Network failures, 408, 429 and 5xx retry with identical event ID, time and content. Configure attempts (1–5), timeoutMs (1–30000), or a custom fetch. HTTPS is mandatory except localhost. Redirects and browser usage are rejected.

The retry budget may exceed Shopify's webhook acknowledgement deadline: prefer a durable webhook queue. Never acknowledge an uninstall successfully after swallowing an SDK error.

Retries are not durable across process death. To use your existing job/queue system:

import { createIdentifyEvent, createUninstallEvent } from '@basezero/sdk';

const event = createIdentifyEvent(customer);
// Persist the envelope once; retry the same saved object after failures/restarts.
await basezero.send(event);

const removal = createUninstallEvent({ platformId: '123' }, {
  eventId: 'shopify-uninstall:original-event-id',
  occurredAt: '2026-01-01T00:00:00.000Z',
});
await basezero.send(removal);

BaseZeroError exposes code, status, and the original event for recovery. The event contains customer data; don't log the whole error. Reusing an ID with different contents is a 409 conflict. Never regenerate an occurrence time for a retry.

platformId is a numeric string or Shopify/Partner Shop GID. Profiles accept myshopifyDomain, optional name, and optional email; no access token or arbitrary metadata. The raw envelope is { eventId, occurredAt, type, customer }. Successful writes return { eventId, customerId, installationId } after durable persistence.

Install

npm install @basezero/sdk
# or
pnpm add @basezero/sdk

Build/install from this repository

For local development, from the BaseZero repository:

npm pack ./packages/sdk --pack-destination /tmp

Then in the app repository:

npm install /tmp/basezero-sdk-0.1.0.tgz

Provisioning, API reads, storage semantics and limitations: docs/app-events.md in the BaseZero repository.