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

simple-octokit

v1.0.0

Published

Preconfigured GitHub API client with GraphQL and REST

Readme

simple-octokit

Preconfigured GitHub API client with GraphQL and REST. Bundles common @octokit plugins into a simple factory function.

npm status node Test JavaScript Style Guide

Table of Contents

Highlights :sparkles:

  • Typical usage requires only a single option
  • Builtin retry (for network errors and rate limiting)
  • Includes REST (until GraphQL has full coverage) with automatic pagination
  • Suitable for use in Actions like @actions/github, but not only in Actions
  • Respects HTTP(S)_PROXY and NO_PROXY (and lowercase equivalents).

Usage

const simpleOctokit = require('simple-octokit')
const octokit = simpleOctokit('my-github-token')

Query the GitHub GraphQL API:

const { createIssue } = await octokit.graphql(`
  mutation($repositoryId:ID!, $title:String!) {
    createIssue(input: { repositoryId: $repositoryId, title: $title }) {
      issue { number }
    }
  }`,
  { repositoryId, title }
)

console.log(createIssue.issue.number)

Query the GitHub REST API:

const response = await octokit.issues.listForRepo({
  owner: 'octocat',
  repo: 'hello-world',
  per_page: 100
})

for (const issue of response.data) {
  console.log(issue.number)
}

The above example only fetches the first page of 100 issues. Lazily fetch all pages using for await...of:

const iterable = octokit.issues.listForRepo.all({
  owner: 'octocat',
  repo: 'hello-world',
  per_page: 100
})

for await (const response of iterable) {
  for (const issue of response.data) {
    console.log(issue.number)
  }
}

API

octokit = simpleOctokit([options])

The options argument can be a string as a shorthand for { auth } or an object with:

  • auth (string): personal access token, defaults to GITHUB_TOKEN environment variable. Can also be an object to be combined with a custom authStrategy.
  • keepAlive (boolean): reuse connections between requests, defaults to false
  • baseUrl (string): defaults to GITHUB_API_URL environment variable or https://api.github.com
  • userAgent (string): defaults to simple-octokit/${version}.

Other options are forwarded to @octokit/core.

octokit.graphql(query[, variables])

Query the GitHub GraphQL API. Takes a query string and an optional variables object. Returns a promise for the query result. It's recommended to use variables rather than template literals as those would make your code vulnerable to query injection attacks. The variables object can also contain custom request headers. For example to enable the deletePackageVersion mutation which is in preview at the time of writing:

const { deletePackageVersion } = await octokit.graphql(`
  mutation ($id: String!) {
    deletePackageVersion(input:{packageVersionId:$id}) {
      success
    }
  }
`, {
  id,
  headers: {
    accept: `application/vnd.github.package-deletes-preview+json`
  }
})

See @octokit/graphql for further details. You may also like the Explorer. The query result displayed there is exactly what you'll get from octokit.graphql().

octokit[scope][method]()

Query the GitHub REST API through a programmatic API. See docs for a complete list of methods.

octokit.request(route, options)

Query the GitHub REST API through a low-level method. Returns a promise for the response. See @octokit/request for details. You may prefer the programmatic API above.

Usage In Actions

Add an input to your action.yml:

inputs:
  token:
    default: ${{ github.token }}
const simpleOctokit = require('simple-octokit')
const octokit = simpleOctokit(process.env.INPUT_TOKEN)

Or require consumers of your action to (more explicitly) set the token in their env:

- uses: example-action
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
const simpleOctokit = require('simple-octokit')
const octokit = simpleOctokit()

Install

With npm do:

npm install simple-octokit

License

MIT © Vincent Weevers