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

@destink/substack-sdk

v0.3.0

Published

TypeScript API client for interacting with Substack webservice

Readme

Substack SDK

License: MIT TypeScript

A modern, type-safe TypeScript client for the Substack API. Connects directly to Substack's endpoints using CycleTLS to bypass Cloudflare bot detection. No third-party proxy or gateway required.

Why This Fork?

This project is based on substack-api by Jakub Slys. The original library routes all API requests through a third-party gateway proxy (substack-gateway.vercel.app), which means your Substack session cookies pass through a server you don't control. That's a dealbreaker for anyone handling user data or building a production application.

This fork takes a different architectural approach:

| | substack-api | substack-sdk | |---|---|---| | HTTP layer | Plain axios through a gateway proxy | CycleTLS directly to Substack (bypasses Cloudflare) | | Authentication | Cookies sent to a third-party proxy | Cookies sent directly to Substack | | Credentials | Single base64-encoded token | Two explicit cookies (substack.sid + substack.lli) | | TLS handling | Relies on gateway to handle Cloudflare | Spoofs browser TLS fingerprints via CycleTLS | | Infrastructure | Requires the gateway to be running | No external dependencies |

The entity-based API, async iterators, and io-ts runtime validation from the original are preserved.

QuickStart

pnpm add @destink/substack-sdk
import { SubstackClient } from '@destink/substack-sdk';

const client = new SubstackClient({
  substackSid: process.env.SUBSTACK_SID!,
  substackLli: process.env.SUBSTACK_LLI!,
  publicationUrl: 'https://yoursite.substack.com',
  handle: 'yourhandle'
});

// Get your profile and iterate through posts
const profile = await client.ownProfile();
for await (const post of profile.posts({ limit: 5 })) {
  console.log(`"${post.title}" - ${post.publishedAt?.toLocaleDateString()}`);
}

// Test connectivity
const isConnected = await client.testConnectivity();

// Always close when done (shuts down the CycleTLS subprocess)
await client.close();

Authentication

All requests go directly to Substack's API. Authentication requires two session cookies from your browser.

Step 1: Obtain your session cookies

  1. Log in to substack.com in your browser.
  2. Open DevTools > Application > Cookies > substack.com.
  3. Copy the values of substack.sid and substack.lli.

Step 2: Pass the cookies to the client

const client = new SubstackClient({
  substackSid: '<value of substack.sid cookie>',
  substackLli: '<value of substack.lli cookie>',
  publicationUrl: 'https://yoursite.substack.com',
  handle: 'yourhandle'  // required for ownProfile()
});

Documentation

License

MIT