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

source-githubstats

v1.0.7

Published

Get a user github states without need to open browser and use them in your work!!

Readme

GitHub Stats

A simple package to fetch GitHub user stats without needing to open a browser. Use this in your Node.js applications to retrieve public GitHub user information such as followers, public repositories, and more!

Installation

You can install the package via npm or yarn:

npm install source-githubstats
yarn add source-githubstats

Usage

You can use githubstats with CommonJS or ES Modules.

CommonJS (Classic Node.js)

const { GithubStats } = require("githubstates");
const dotenv = require("dotenv");
dotenv.config();
const token = process.env.token;

const stats = new GithubStats(token);
async function getStats(username) {
  try {
    const Stats = await stats.getUserStats(username);
    console.log(Stats);
  } catch (error) {
    console.error("Error fetching stats:", error);
  }
}
getStats("odqin");

ES Modules (ESM)

import { GithubStats } from "githubstates";
import dotenv from "dotenv";
dotenv.config();
const token = process.env.token;

const stats = new GithubStats(token);
async function getStats(username) {
  try {
    const Stats = await stats.getUserStats(username);
    console.log(Stats);
  } catch (error) {
    console.error("Error fetching stats:", error);
  }
}
getStats("odqin");

Example Output

{
  login: 'odqin',
  id: 144062404,
  node_id: 'U_kgDOCJY3xA',
  avatar_url: 'https://avatars.githubusercontent.com/u/144062404?v=4',
  gravatar_id: '',
  url: 'https://api.github.com/users/odqin',
  html_url: 'https://github.com/odqin',
  followers_url: 'https://api.github.com/users/odqin/followers',
  following_url: 'https://api.github.com/users/odqin/following{/other_user}',
  gists_url: 'https://api.github.com/users/odqin/gists{/gist_id}',
  starred_url: 'https://api.github.com/users/odqin/starred{/owner}{/repo}',
  subscriptions_url: 'https://api.github.com/users/odqin/subscriptions',
  organizations_url: 'https://api.github.com/users/odqin/orgs',
  repos_url: 'https://api.github.com/users/odqin/repos',
  events_url: 'https://api.github.com/users/odqin/events{/privacy}',
  received_events_url: 'https://api.github.com/users/odqin/received_events',
  type: 'User',
  user_view_type: 'public',
  site_admin: false,
  name: 'Odqin',
  company: 'Source',
  blog: '',
  location: null,
  email: null,
  hireable: true,
  bio: 'Full-Stack Dev',
  twitter_username: null,
  public_repos: 1,
  public_gists: 0,
  followers: 1,
  following: 1,
  created_at: '2023-09-04T19:49:26Z',
  updated_at: '2025-04-03T05:07:38Z'
}

Methods

getUserStats(username : string) Fetches the public GitHub stats for the given username.

  • Args username (String) — The GitHub username of the user whose stats you want to fetch.
  • Retruns A Promise with the user stats as a JSON object (like followers, public repos, etc.).

Authentication

To fetch GitHub user stats, you need a GitHub personal access token. You can generate one by following these instructions:

  • Go to GitHub: https://github.com/settings/tokens

  • Generate a new token with the appropriate scopes (usually repo, user).

Once you have the token, use it as shown in the examples.

Contributing

If you have suggestions or improvements, feel free to open issues or pull requests. We welcome contributions!

Bugs and Issues

If you encounter any bugs or issues, please open an issue on the GitHub repository.

Created with ❤️ by Odqin

npm npm npm github