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

@jsontech/sdk-js

v0.0.69

Published

JavaScript/TypeScript SDK for ShipIt feature flags.

Downloads

7,463

Readme

@jsontech/sdk-js

JavaScript/TypeScript SDK for ShipIt feature flags.

Installation

npm install @jsontech/sdk-js
# or
pnpm add @jsontech/sdk-js
# or
yarn add @jsontech/sdk-js

Usage

Basic Example

import { ShipItClient } from '@jsontech/sdk-js';

// SDK automatically uses production API URL
// Set SHIPIT_CLIENT_KEY or SHIPIT_SERVER_KEY env var, or pass sdkKey explicitly
const shipit = new ShipItClient({
  sdkKey: 'your-sdk-key-here'
});

const enabled = await shipit.bool('new-nav', { id: 'user-123' }, false);
console.log(enabled);

Environment Variables

The SDK automatically reads from environment variables if sdkKey is not provided:

  • SHIPIT_CLIENT_KEY - Client SDK key (for browser/mobile)
  • SHIPIT_SERVER_KEY - Server SDK key (for backend)
// In Node.js, this will use SHIPIT_CLIENT_KEY or SHIPIT_SERVER_KEY from env
const shipit = new ShipItClient();

API Base URL

The SDK automatically determines the API base URL:

  • Browser: Uses window.location.origin (assumes API is on same origin)
  • Node.js: Uses the production ShipIt API endpoint

The API URL cannot be overridden.

User Payload

import { ShipItClient, type ShipItUserPayload } from '@jsontech/sdk-js';

const user: ShipItUserPayload = {
  id: 'user-123',        // Required: unique user identifier
  email: '[email protected]',
  name: 'John Doe',
  country: 'US',
  meta: {                // Custom attributes for targeting
    companyId: 'acme',
    plan: 'pro'
  }
};

const enabled = await shipit.bool('feature-flag', user, false);

API Reference

ShipItClient

Constructor

new ShipItClient(options?: ShipItClientOptions)

Options:

  • sdkKey?: string - SDK key (client or server). If not provided, reads from SHIPIT_CLIENT_KEY or SHIPIT_SERVER_KEY env vars.
  • projectKey?: string - Legacy: project key (requires envKey). Not recommended.
  • envKey?: string - Environment key (default: 'production'). Only used with projectKey.

Methods

bool(flagKey: string, user: ShipItUserPayload, defaultValue?: boolean): Promise<boolean>

Evaluates a boolean feature flag for a user.

  • flagKey: The flag key to evaluate
  • user: User payload with id or key (required)
  • defaultValue: Default value if evaluation fails (default: false)

Returns Promise<boolean> - The flag value for the user.

Example:

const enabled = await shipit.bool('new-nav', { id: 'user-123' }, false);

Error Handling

If the API request fails (network error, non-2xx status), the SDK returns the defaultValue. Network errors (DNS, timeout, connection refused) will throw; wrap calls in try/catch if you want to handle them.

try {
  const enabled = await shipit.bool('flag', user, false);
} catch (error) {
  // Handle network errors
  console.error('Failed to evaluate flag:', error);
}

SDK Keys

Each environment has two SDK keys:

  • Server key: Secret. Use only in trusted server environments.
  • Client key: Not a secret. Intended for browser/mobile SDKs.

Get your SDK keys from your ShipIt Console → Environments.

License

MIT