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

openalex-js

v1.0.5

Published

TypeScript client for the OpenAlex API

Downloads

14

Readme

openalex-js

A JavaScript client for the OpenAlex API. OpenAlex is an open and comprehensive catalog of scholarly papers, authors, institutions, and more.

Installation

npm install openalex-js

Usage

const OpenAlex = require("openalex-js");

// Initialize the client
const openalex = new OpenAlex({
  email: "[email protected]", // Optional but recommended
});

// Get a specific work by ID
const work = await openalex.getWork("W2741809807");

// Search for works with filters
const works = await openalex.getWorks({
  filter: "publication_year:2020",
  search: "machine learning",
});

// Get an author by ID
const author = await openalex.getAuthor("A2208157607");

// Search for authors
const authors = await openalex.getAuthors({
  filter: "works_count:>100",
  search: "Smith",
});

API Reference

Configuration

The OpenAlex client accepts the following configuration options:

  • email (optional): Your email address for the polite pool
  • perPage (optional): Number of results per page (default: 25)

Methods

All methods return promises that resolve to the API response.

Works

  • getWork(id): Get a single work by ID
  • getWorks(params): Get a list of works with optional parameters

Authors

  • getAuthor(id): Get a single author by ID
  • getAuthors(params): Get a list of authors with optional parameters

Sources

  • getSource(id): Get a single source by ID
  • getSources(params): Get a list of sources with optional parameters

Institutions

  • getInstitution(id): Get a single institution by ID
  • getInstitutions(params): Get a list of institutions with optional parameters

Topics

  • getTopic(id): Get a single topic by ID
  • getTopics(params): Get a list of topics with optional parameters

Publishers

  • getPublisher(id): Get a single publisher by ID
  • getPublishers(params): Get a list of publishers with optional parameters

Funders

  • getFunder(id): Get a single funder by ID
  • getFunders(params): Get a list of funders with optional parameters

Parameters

All list methods accept an optional parameters object that can include:

  • filter: Filter results using OpenAlex syntax
  • search: Search within results
  • sort: Sort results
  • page: Page number for pagination
  • per_page: Results per page (overrides constructor setting)

Examples

// Get works from a specific institution
const works = await openalex.getWorks({
  filter: "institutions.id:I136199984", // Harvard University
  sort: "cited_by_count:desc",
});

// Search for authors at a specific institution
const authors = await openalex.getAuthors({
  filter: "last_known_institution.id:I136199984",
  search: "biology",
});

// Get highly-cited papers from 2023
const papers = await openalex.getWorks({
  filter: "publication_year:2023,cited_by_count:>100",
});

Rate Limits

OpenAlex has a rate limit of 100,000 requests per day and 10 requests per second. For better performance, provide your email address when initializing the client to get into the "polite pool."

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.