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

openplay-sdk

v0.1.0

Published

Type-safe TypeScript SDK for the OpenPlay Music API

Readme

openplay-sdk

Type-safe TypeScript SDK for the OpenPlay Music API.

Installation

npm install openplay-sdk
# or
pnpm add openplay-sdk
# or
yarn add openplay-sdk

Quick Start

import { createClient } from 'openplay-sdk'

const client = createClient({
  apiKeyId: process.env.OPENPLAY_API_KEY_ID!,
  apiSecretKey: process.env.OPENPLAY_API_SECRET_KEY!,
})

// Search releases
const releases = await client.releases.search({ q: 'album name' })

// Get a specific artist
const artist = await client.artists.get('artist-id')

// Auto-paginate through all artists
for await (const artist of client.artists.searchAll()) {
  console.log(artist.name)
}

Features

  • Full TypeScript support with complete type definitions
  • Auto-pagination helpers for large result sets
  • Webhook signature verification
  • Bulk job utilities with polling
  • Presigned URL upload support
  • Comprehensive error handling

API Coverage

The SDK covers the following OpenPlay API resources:

  • Artists - Create, read, update, delete, and search artists
  • Labels - Manage record labels
  • Publishers - Manage publishing entities
  • Projects - Handle project/album metadata
  • Releases - Manage release metadata and distribution
  • Tracks - Track-level operations
  • Works - Musical work/composition management
  • Cover Art - Upload and manage artwork
  • Art Resources - Additional artwork management

Environment Variables

You can use createClientFromEnv() which reads from these environment variables:

  • OPENPLAY_API_KEY_ID - Your API key ID
  • OPENPLAY_API_SECRET_KEY - Your API secret key
  • OPENPLAY_BASE_URL (optional) - Custom API base URL
import { createClientFromEnv } from 'openplay-sdk'

const client = createClientFromEnv()

Pagination

Manual Pagination

const page1 = await client.artists.search({ limit: 50 })
const page2 = await client.artists.search({ limit: 50, offset: 50 })

Auto-Pagination

// Iterate through all results
for await (const artist of client.artists.searchAll()) {
  console.log(artist.name)
}

// Collect all results into an array
import { collectAll } from 'openplay-sdk'

const allArtists = await collectAll(client.artists.searchAll())

Error Handling

The SDK provides typed errors for different failure scenarios:

import {
  AuthenticationError,
  NotFoundError,
  RateLimitError,
  ValidationError,
  OpenPlayError,
} from 'openplay-sdk'

try {
  await client.artists.get('invalid-id')
} catch (error) {
  if (error instanceof NotFoundError) {
    console.log('Artist not found')
  } else if (error instanceof RateLimitError) {
    console.log(`Rate limited, retry after ${error.retryAfter}s`)
  } else if (error instanceof AuthenticationError) {
    console.log('Invalid credentials')
  }
}

Webhooks

Verify incoming webhook signatures:

import { verifyWebhookSignature } from 'openplay-sdk/webhooks'

const isValid = verifyWebhookSignature({
  payload: requestBody,
  signature: request.headers['x-openplay-signature'],
  secret: process.env.OPENPLAY_WEBHOOK_SECRET!,
})

Bulk Operations

Submit bulk jobs and poll for completion:

import { submitAndWait } from 'openplay-sdk'

const result = await submitAndWait(
  () => client.releases.bulkCreate(releases),
  (jobId) => client.releases.getBulkStatus(jobId),
  { timeoutMs: 60000, pollIntervalMs: 2000 }
)

License

MIT