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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@microfox/reddit

v1.7.0

Published

A TypeScript SDK for interacting with the Reddit API, providing functionalities for user data retrieval, search operations (users, posts, communities), post and comment processing, moderation, and comprehensive data access.

Readme

Reddit TypeScript SDK

A TypeScript SDK for interacting with the Reddit API, providing functionalities for user data retrieval, search operations (users, posts, communities), post and comment processing, moderation, and comprehensive data access.

Installation

npm install @microfox/reddit

Environment Variables

The following environment variables are used by this SDK:

  • REDDIT_CLIENT_ID: Your Reddit application's client ID. (Required)
  • REDDIT_CLIENT_SECRET: Your Reddit application's client secret. (Required)
  • REDDIT_ACCESS_TOKEN: The access token for authenticating requests. (Required)
  • REDDIT_REFRESH_TOKEN: The refresh token obtained during initial authorization. (Required)
  • SCOPES: A comma-separated list of scopes defining the permissions requested. (Required)

Additional Information

To use this SDK, you need to obtain OAuth credentials from Reddit. Follow these steps:

  1. Go to https://www.reddit.com/prefs/apps

  2. Click on 'create app' or 'create another app' at the bottom

  3. Fill in the required information:

    • Name: Your app's name

    • App type: Choose 'web app' for most cases

    • Description: Brief description of your app

    • About URL: Your app's website (if applicable)

  4. Click 'create app'

  5. You'll receive a Client ID and Client Secret. Keep these secure.

Environment variables:

  • REDDIT_CLIENT_ID: Your Reddit application's client ID

  • REDDIT_CLIENT_SECRET: Your Reddit application's client secret

To set up environment variables:

  1. Create a .env file in your project root (if not already present)

  2. Add the following lines to the .env file:

    REDDIT_CLIENT_ID=your_client_id_here

    REDDIT_CLIENT_SECRET=your_client_secret_here

  3. Use a package like dotenv to load these variables in your application

Important notes:

  • Reddit's OAuth implementation uses comma-separated scopes instead of space-separated

  • Access tokens expire after 1 hour (3600 seconds)

  • To get a refresh token, include 'duration=permanent' in the initial authorization request

  • Rate limits: https://github.com/reddit-archive/reddit/wiki/API#rules

    • 60 requests per minute

    • OAuth2 clients may make up to 600 requests per 10 minutes

    • Monitor the X-Ratelimit headers in API responses for current limits and usage

For more detailed information, refer to the Reddit API documentation: https://www.reddit.com/dev/api/oauth