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

ratemyprofessors-client

v2.1.5

Published

Typed, retrying, rate-limited unofficial client for RateMyProfessors.

Readme

RateMyProfessors API Client (TypeScript)

npm downloads docs

A typed, retrying, rate-limited unofficial client for RateMyProfessors.

Looking for Python? Check out the Python version.

Requirements

  • Node.js 18 or later
  • Works in both TypeScript and JavaScript projects (types included)

Installation

npm install ratemyprofessors-client

Available Functions

Create a client and call any of these methods. See the full docs for parameters, return types, and examples.

import { RMPClient } from "ratemyprofessors-client";
const client = new RMPClient();

Schools

  • searchSchools(query) — Search schools by name. Returns paginated results.
  • getSchool(schoolId) — Get a single school by its numeric ID.
  • getCompareSchools(schoolId1, schoolId2) — Fetch two schools side by side.
  • getSchoolRatingsPage(schoolId) — Get one page of school ratings (cached after first fetch).
  • iterSchoolRatings(schoolId) — Async iterator over all ratings for a school.

Professors

  • searchProfessors(query) — Search professors by name. Returns paginated results.
  • listProfessorsForSchool(schoolId) — List professors at a given school.
  • iterProfessorsForSchool(schoolId) — Async iterator over all professors at a school.
  • getProfessor(professorId) — Get a single professor by their numeric ID.
  • getProfessorRatingsPage(professorId) — Get one page of professor ratings (cached after first fetch).
  • iterProfessorRatings(professorId) — Async iterator over all ratings for a professor.

Low-level

  • rawQuery(payload) — Send a raw GraphQL payload to the RMP endpoint.

Lifecycle

  • close() — Close the client, abort in-flight requests, and clear caches.

Errors and What They Mean

All errors extend RMPError. Catch and narrow with instanceof:

  • HttpError — The server returned a non-2xx status code (e.g. 404, 500).
  • ParsingError — The response couldn't be parsed (e.g. professor/school not found).
  • RateLimitError — The client's local rate limiter blocked the request.
  • RetryError — The request failed after all retry attempts. Contains the last underlying error.
  • RMPAPIError — The GraphQL API returned an errors array in the response.
  • ConfigurationError — Invalid client configuration (e.g. missing URL).
import { RMPClient, HttpError, ParsingError } from "ratemyprofessors-client";

try {
  const prof = await client.getProfessor(id);
} catch (e) {
  if (e instanceof ParsingError) console.error("Not found:", e.message);
  else if (e instanceof HttpError) console.error("HTTP", e.status_code);
  else throw e;
}

Types

All methods return typed data. Import any of these interfaces:

import type {
  School,
  Professor,
  Rating,
  SchoolRating,
  ProfessorSearchResult,
  SchoolSearchResult,
  ProfessorRatingsPage,
  SchoolRatingsPage,
  CompareSchoolsResult,
} from "ratemyprofessors-client";
  • School — ID, name, location, overall quality, category ratings (reputation, safety, etc.)
  • Professor — ID, name, department, school, overall rating, difficulty, percent take again
  • Rating — Date, comment, quality, difficulty, tags, course, thumbs up/down
  • SchoolRating — Date, comment, overall score, category ratings, thumbs up/down
  • ProfessorSearchResult / SchoolSearchResult — Paginated list with has_next_page and next_cursor
  • ProfessorRatingsPage / SchoolRatingsPage — One page of ratings with cursor pagination
  • CompareSchoolsResult — A pair of schools

Extras

Optional helpers for data pipelines are available under the extras subpath:

import {
  normalizeComment,
  isValidComment,
  cleanCourseLabel,
  buildCourseMapping,
  analyzeSentiment,
} from "ratemyprofessors-client/extras";
  • normalizeComment(text, options?) — Normalize text for deduplication (trim, strip HTML, lowercase, collapse whitespace; optionally strip punctuation)
  • isValidComment(text, minLen?) — Validate a comment and return { valid, issues } with diagnostics (empty, too short, all caps, excessive repeats, no alpha)
  • cleanCourseLabel(raw) — Clean scraped course labels (remove counts, normalize whitespace)
  • buildCourseMapping(scraped, valid) — Map scraped labels to known course codes
  • analyzeSentiment(text) — Analyze comment sentiment using the AFINN-165 lexicon (returns score, comparative, and label)