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

@moodinary/sdk

v0.1.0

Published

Typed client for the Moodinary public API

Readme

@moodinary/sdk

A typed server-side client generated from Moodinary's canonical OpenAPI contract. Uses openapi-fetch, with no automatic retries. Keep organization-scoped API keys on your server, never in browser bundles or logs.

import { createMoodinaryClient } from "@moodinary/sdk";

const token = process.env.MOODINARY_API_KEY;
if (!token) throw new Error("Missing Moodinary API key");
const moodinary = createMoodinaryClient({ token });
const { data, error, response } = await moodinary.GET("/org");
if (error) throw new Error(`Moodinary returned ${response.status}`);

The default base URL is https://api.moodinary.com/v1. Override baseUrl for a local server or pass fetch for a custom runtime or tests. Paths are relative to the version prefix, such as /org, not /v1/org.

Read resources

Typed GET covers /org, /teams, /pulses, /stats, /stats/daily, /alerts, /actions, and /comments. Query parameters, bodies, path parameters, and response types come from the generated schema.

const page = await moodinary.GET("/pulses", {
  params: { query: { limit: 50 } },
});
if (page.data?.nextCursor) {
  const nextPage = await moodinary.GET("/pulses", {
    params: { query: { limit: 50, cursor: page.data.nextCursor } },
  });
}

const teams = await moodinary.GET("/teams");
const stats = await moodinary.GET("/stats");
const daily = await moodinary.GET("/stats/daily");
const alerts = await moodinary.GET("/alerts");
const actions = await moodinary.GET("/actions");
const comments = await moodinary.GET("/comments");

Create and update

Create requests require a caller-generated Idempotency-Key. Generate one UUID for each logical operation and persist it alongside the request before sending. If you reconcile or retry that same operation yourself, reuse its key and exact body. Never silently retry a mutation with a new key. The SDK rejects missing or blank create keys before sending.

const teamKey = crypto.randomUUID();
const team = await moodinary.POST("/teams", {
  params: { header: { "Idempotency-Key": teamKey } },
  body: { name: "Support" },
});

const actionKey = crypto.randomUUID();
const action = await moodinary.POST("/actions", {
  params: { header: { "Idempotency-Key": actionKey } },
  body: { title: "Schedule weekly check-ins" },
});

const updated = await moodinary.PATCH("/actions/{id}", {
  params: { path: { id: "your-action-id" } },
  body: { title: "Schedule monthly check-ins" },
});

Non-2xx responses preserve the API error in error and the original HTTP response in response. Network failures reject the promise. There is no automatic retry for either case. Rate-limit headers and other response headers are available through response.headers.

Contract generation

From packages/sdk, run bun run generate after the server's canonical apps/server/openapi.json changes. This invokes openapi-typescript to regenerate src/schema.gen.ts. Commit the generated file together with the spec. Do not hand-edit it. Run bun run test for mocked transport tests; type checking runs in CI.

This workspace package currently exports TypeScript source, matching the monorepo convention. It is not yet a precompiled standalone npm distribution.