Skip to content
Bradley Hanson
All work

Open source · npm

TypeScript libraries for SoundCloud

Three TypeScript packages for SoundCloud's official API and embeddable player. They power my music-discovery app, The Sub Delta.

Role
Author and maintainer
Period
2026 to present
Status
Published on npm

Overview

Most TypeScript SoundCloud clients are either unmaintained wrappers from before OAuth 2.1 or scrapers that pull undocumented client IDs from the website and break when SoundCloud ships a frontend update. I wrote these packages against the official, documented API instead.

The packages

  • soundcloud-api-ts. The API client. Zero runtime dependencies and native fetch, with OAuth 2.1 and PKCE, automatic token refresh, and an interactive CLI.
  • soundcloud-api-ts-next. React hooks and Next.js route handlers for the App Router and Pages Router. Hooks fetch through your own API routes, so client secrets stay on the server.
  • soundcloud-widget-react. A React wrapper for the SoundCloud HTML5 Widget API, with Promise-based getters, a useSCWidget hook for playback state, and SSR-safe script loading.

Design decisions

  • Official API only, so the packages don't break when SoundCloud changes its website.
  • No runtime dependencies in the client or the widget. You can pass in your own fetch for Cloudflare Workers, Bun, or Deno.
  • Retries with exponential backoff on 429 and 5xx responses, honoring Retry-After, with in-flight GET requests deduplicated.
  • A raw escape hatch that calls any endpoint in the spec, so a missing wrapper never blocks anyone.
  • The widget turns callback getters into Promises and prevents duplicate script injection under server rendering.

Technologies

  • TypeScript
  • React
  • Next.js
  • OAuth 2.1 and PKCE
  • tsup
  • Vitest
  • TypeDoc

Contact

Get in touch

I'm interested in senior product engineering work where the UI, the SDKs, and the services behind them are one problem. Email is the fastest way to reach me.