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

@rootly/ts

v0.1.0

Published

Type-safe TypeScript SDK for the Rootly API

Readme

@rootly/ts

Type-safe TypeScript SDK for the Rootly API, powered by openapi-typescript and openapi-fetch.

  • Zero runtime overhead — types are generated at build time, not runtime
  • Full type safety — every endpoint, parameter, and response is typed from the OpenAPI spec
  • Tiny footprint — openapi-fetch is ~6 KB, wraps native fetch
  • ESM and CommonJS support

Installation

npm install @rootly/ts

Quick Start

import { RootlyClient } from "@rootly/ts";

const rootly = new RootlyClient({
  token: process.env.ROOTLY_API_TOKEN!,
});

List Incidents

const { data, error } = await rootly.client.GET("/v1/incidents", {
  params: {
    query: {
      "page[number]": 1,
      "page[size]": 10,
      "filter[status]": "started",
    },
  },
});

Get an Incident

const { data, error } = await rootly.client.GET("/v1/incidents/{id}", {
  params: { path: { id: "abc123" } },
});

Create an Incident

const { data, error } = await rootly.client.POST("/v1/incidents", {
  body: {
    data: {
      type: "incidents",
      attributes: {
        title: "Service degradation",
        kind: "normal",
        summary: "Users are experiencing elevated latency",
        severity_id: "sev-1",
      },
    },
  },
});

Update an Incident

const { data, error } = await rootly.client.PATCH("/v1/incidents/{id}", {
  params: { path: { id: "abc123" } },
  body: {
    data: {
      type: "incidents",
      attributes: {
        summary: "Root cause identified",
      },
    },
  },
});

Error Handling

const { data, error } = await rootly.client.GET("/v1/incidents/{id}", {
  params: { path: { id: "abc123" } },
});

if (error) {
  // error is typed — 401, 404, etc.
  console.error("Request failed:", error);
  return;
}

// data is typed as incident_response
console.log(data);

Using Types

import type { components } from "@rootly/ts";

type Incident = components["schemas"]["incident"];
type IncidentResponse = components["schemas"]["incident_response"];
type NewIncident = components["schemas"]["new_incident"];
type Service = components["schemas"]["service"];
type ErrorsList = components["schemas"]["errors_list"];

Configuration

Custom Base URL

const rootly = new RootlyClient({
  token: "your-token",
  baseUrl: "https://custom.rootly.com",
});

Custom Fetch

const rootly = new RootlyClient({
  token: "your-token",
  fetch: customFetchImplementation,
});

Advanced Usage

For direct access to the underlying openapi-fetch client with full type inference:

import { createClient, type paths } from "@rootly/ts";
import { createAuthMiddleware } from "@rootly/ts";

const client = createClient<paths>({
  baseUrl: "https://api.rootly.com",
});

client.use(createAuthMiddleware("your-token"));

Requirements

  • Node.js >= 20 (native fetch required)

Development

make generate   # Regenerate types from OpenAPI spec
make build      # Build ESM + CJS
make typecheck  # Type-check
make test       # Run tests
make clean      # Remove dist/

License

MIT