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

@pressflow/sdk

v0.1.0

Published

TypeScript SDK for the Pressflow public API

Readme

@pressflow/sdk

TypeScript SDK for the Pressflow public API. Fetch articles, categories, and tags from your Pressflow blog with full type safety.

Installation

npm install @pressflow/sdk

Quick Start

import { PressflowClient } from "@pressflow/sdk"

const client = new PressflowClient({ baseUrl: "https://api.pressflow.io", apiKey: "pk_..." })
const { articles } = await client.listArticles({ limit: 10 })
const article = await client.getArticle("my-first-post")

API Reference

new PressflowClient(config)

Creates a new Pressflow client instance.

| Parameter | Type | Required | Default | Description | | --------- | -------- | -------- | ------- | ------------------------------------ | | baseUrl | string | Yes | - | Pressflow API base URL | | apiKey | string | Yes | - | Your public API key (starts with pk_) | | timeout | number | No | 10000 | Request timeout in milliseconds |

listArticles(params?)

Returns a paginated list of articles.

const response = await client.listArticles({ limit: 20, status: "published" })
console.log(response.articles)
console.log(response.pagination.next_cursor) // pass to next call for pagination

Parameters:

| Parameter | Type | Default | Description | | ------------- | -------------------------------------------- | ------- | ----------------------------- | | cursor | string | - | Pagination cursor | | limit | number | 20 | Results per page (1-100) | | status | "draft" \| "published" \| "archived" | - | Filter by article status | | category_id | string | - | Filter by category ID | | sort | "created_at" \| "published_at" \| "title" | - | Sort field | | order | "asc" \| "desc" | - | Sort direction |

Returns: ArticleListResponse

getArticle(slug)

Returns a single article by its URL slug.

const article = await client.getArticle("getting-started-with-pressflow")

| Parameter | Type | Required | Description | | --------- | -------- | -------- | ------------------ | | slug | string | Yes | The article's slug |

Returns: Article

listCategories()

Returns all categories for the blog.

const categories = await client.listCategories()

Returns: Category[]

listTags()

Returns all tags for the blog.

const tags = await client.listTags()

Returns: Tag[]

Types

Article

interface Article {
  id: string
  title: string
  slug: string
  content: string
  content_plain: string
  excerpt: string | null
  featured_image_url: string | null
  status: "draft" | "published" | "archived"
  meta_title: string | null
  meta_description: string | null
  og_image_url: string | null
  canonical_url: string | null
  category_id: string | null
  tags: Tag[]
  author: ArticleAuthor
  published_at: string | null
  created_at: string
  updated_at: string
}

ArticleAuthor

interface ArticleAuthor {
  id: string
  name: string
  avatar_url: string | null
}

Category

interface Category {
  id: string
  name: string
  slug: string
  description: string | null
  parent_id: string | null
  created_at: string
  updated_at: string
}

Tag

interface Tag {
  id: string
  name: string
  slug: string
  created_at: string
  updated_at: string
}

ArticleListResponse

interface ArticleListResponse {
  articles: Article[]
  pagination: {
    next_cursor: string | null
    limit: number
  }
}

PressflowError

class PressflowError extends Error {
  code: string    // e.g. "NOT_FOUND", "UNAUTHORIZED"
  message: string
  status: number  // HTTP status code (0 for timeouts)
}

Error Handling

All API methods throw PressflowError on failure.

import { PressflowClient, PressflowError } from "@pressflow/sdk"

try {
  const article = await client.getArticle("nonexistent")
} catch (err) {
  if (err instanceof PressflowError) {
    console.error(err.code)    // "NOT_FOUND"
    console.error(err.message) // "Article not found"
    console.error(err.status)  // 404
  }
}

Common error codes:

| Code | Status | Description | | -------------- | ------ | ------------------------------ | | UNAUTHORIZED | 401 | Invalid or missing API key | | NOT_FOUND | 404 | Resource does not exist | | RATE_LIMITED | 429 | Too many requests | | TIMEOUT | 0 | Request exceeded timeout limit |

License

MIT