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

@galitz-matt/nih-sdk

v0.1.0

Published

Type-safe TypeScript SDK for querying the NIH RePORTER Project API.

Readme

NIH RePORTER SDK

Type-safe TypeScript SDK for querying the NIH RePORTER Project API.

The NIH RePORTER API provides powerful search capabilities for federally funded biomedical research projects, but constructing request payloads manually can be tedious and error-prone.

This SDK provides:

  • Fluent query builders
  • Type-safe request construction
  • Generated NIH lookup enums
  • Built-in request validation
  • Rate-limited API access
  • Direct execution from query builders

Installation

npm install nih-sdk

Quick Start

Import the SDK entry point:

import nih from "nih-sdk";

Build and execute a query:

const results = await nih.projects
    .query()
    .fiscalYears(2024, 2025)
    .activityCodes("R01", "AY2")
    .limit(25)
    .execute();

That's it.


Usage

Fluent Query Builder

Queries are constructed using a builder API.

import nih from "nih-sdk";

const results = await nih.projects
    .query()
    .orgStates("NJ", "AL", "CA")
    .activityCodes("R01", "R21")
    .awardAmountRange(100000, 5000000)
    .execute();

Each call adds criteria to the underlying NIH request.


Using Generated Enums

Many NIH lookup values are available as generated enums.

import {
    OrgState,
    ActivityCode,
    FundingMechanism
} from "nih-reporter-sdk";

const results = await nih.projects
    .query()
    .organizationStates(
        OrgState.CA,
        OrgState.NY
    )
    .activityCodes(
        ActivityCode.R01,
        ActivityCode.R21
    )
    .fundingMechanisms(
        FundingMechanism.ResearchCenters // "RC"
    )
    .execute();

This provides autocomplete and compile-time safety.


Selecting Response Fields

Request only the fields you need.

import { Field } from "nih-reporter-sdk";

const results = await nih.projects
    .query()
    .includeFields([
        Field.ProjectTitle,
        Field.AwardAmount,
        Field.PrincipalInvestigators,
        Field.Organization
    ])
    .execute();

Pagination

const results = await nih.projects
    .query()
    .offset(100)
    .limit(50)
    .execute();

Advanced Text Search

import { Field } from "nih-sdk"

const results = await nih.projects
    .query()
    .advancedTextSearch({
        kind: "and",
        field: Field.AbstractText
        terms: ["machine", "learning"]
    })
    .execute();

Principal Investigator Search

const results = await nih.projects
    .query()
    .piNames([
        {
            firstName: "John",
            lastName: "Smith"
        }
    ])
    .execute();

Organization Search

const results = await nih.projects
    .query()
    .organizationNames([
        "Stanford University"
    ])
    .execute();

Project Number Search

const results = await nih.projects
    .query()
    .projectNumbers([
        "1R01GM123456-01"
    ])
    .execute();

Executing Raw Requests

If you already have a valid NIH RePORTER request payload, you can execute it directly.

const results = await nih.projects.execute({
    criteria: {
        fiscal_years: [2025],
        activity_codes: ["R01"]
    },
    limit: 25,
    offset: 0
});

This is useful when migrating existing codebases or dynamically generating requests.


Query Lifecycle

const query = nih.projects
    .query()
    .fiscalYears([2025])
    .activityCodes(["R01"]);

const results = await query.execute();

Each call to query() creates a fresh builder instance.

Builders are not shared across requests.


Features

  • Fluent Builder API
  • Full TypeScript Support
  • Generated NIH Lookup Enums
  • Request Validation
  • Built-in Rate Limiting
  • Direct Query Execution
  • Raw Request Execution
  • NIH RePORTER Project API Support

Example

import nih, {
    ActivityCode,
    OrgState,
    Field
} from "nih-reporter-sdk";

const results = await nih.projects
    .query()
    .fiscalYears([2025])
    .activityCodes(
        ActivityCode.R01
    )
    .organizationStates(
        OrgState.CA
    )
    .includeFields(
        Field.ProjectTitle,
        Field.AwardAmount,
        Field.PrincipalInvestigators
    )
    .limit(10)
    .execute();

results.toTextFile("my-results.txt");

Roadmap

  • Project Search API
  • Publications Search API
  • Patents Search API
  • Additional NIH lookup generators
  • Query serialization/deserialization
  • Response model improvements