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

mumin-api-monorepo

v2.0.1

Published

The official, production-ready TypeScript SDK for the **Mumin Hadith API**. Build Islamic applications with confidence using our fully typed, cached, and robust client libraries.

Readme

🕌 Mumin API SDK

The official, production-ready TypeScript SDK for the Mumin Hadith API.
Build Islamic applications with confidence using our fully typed, cached, and robust client libraries.

License TypeScript Version


✨ Features

  • 🛡️ Type Safety: Full TypeScript support. No more guessing properties — getting hadith.translation.text is fully typed.
  • 🧠 Intelligent Caching: Built-in MemoryCache stores responses to reduce API calls and latency.
  • 🔁 Auto-Retry: Network glitches? The SDK automatically retries failed requests with exponential backoff.
  • 📦 Monorepo Architecture: Modular packages for Core (Node.js/JS), React hooks, and Vue composables.
  • ⚡ Lightweight: Zero-dependency core (uses native fetch).

📦 Installation

We provide separate packages depending on your framework:

Core (Node.js / Vanilla JS / Next.js API)

npm install @mumin/core

React

npm install @mumin/react @mumin/core

Vue 3

npm install @mumin/vue @mumin/core

🚀 Quick Start

1. Vanilla JS / Node.js

Perfect for server-side code or simple scripts.

import { MuminClient } from "@mumin/core";

const client = new MuminClient("YOUR_API_KEY");

async function main() {
  // Get a random hadith from Sahih al-Bukhari
  const random = await client.hadiths.random({ collection: "sahih-bukhari" });

  console.log("Hadith #", random.hadithNumber);
  console.log("Text:", random.translation?.text || random.arabicText);

  // Search for hadiths
  const results = await client.search.query("prayer", { limit: 5 });
  console.log("Found:", results.data.length);
}

main();

2. React

Use our dedicated hooks for easy data fetching.

App.tsx

import { MuminProvider } from "@mumin/react";

function App() {
  return (
    <MuminProvider apiKey="YOUR_API_KEY">
      <HadithCard />
    </MuminProvider>
  );
}

HadithCard.tsx

import { useHadith } from "@mumin/react";

export function HadithCard() {
  // Fetch Hadith #1 from Sahih Muslim
  const { data, loading, error } = useHadith(1, { lang: "en" });

  if (loading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return (
    <div className="card">
      <h3>
        {data?.collection?.name} - #{data?.hadithNumber}
      </h3>
      <p>{data?.translation?.text}</p>
    </div>
  );
}

3. Vue 3

Reactive composables for your Vue apps.

main.ts

import { createApp } from "vue";
import { MuminPlugin } from "@mumin/vue";
import App from "./App.vue";

const app = createApp(App);
app.use(MuminPlugin, { apiKey: "YOUR_API_KEY" });
app.mount("#app");

HadithView.vue

<script setup>
import { useHadith } from "@mumin/vue";

const { data, loading } = useHadith(1);
</script>

<template>
  <div v-if="loading">Loading...</div>
  <div v-else>
    {{ data?.translation?.text }}
  </div>
</template>

🛠️ Configuration

The MuminClient is highly configurable:

const client = new MuminClient("API_KEY", {
  baseURL: "https://api.hadith.mumin.ink/v1", // Custom API URL
  timeout: 5000, // 5s timeout
  retries: 3, // Retry 3 times on fail
  retryDelay: 1000, // Wait 1s between retries
  cache: new RedisCache(), // Implement your own cache if needed!
});

📚 Resources API

client.hadiths

  • .get(id) - Get a single hadith by global ID.
  • .random(filters) - Get a random hadith (filter by book, collection, grade).
  • .daily() - Get the "Hadith of the Day".
  • .list(filters) - Paginated list of hadiths.

client.collections

  • .list() - Get all available collections.
  • .get(slug) - Get details about a collection (e.g., sahih-bukhari).

client.search

  • .query(q, filters) - Full-text search across translations and Arabic text.

🚨 Error Handling

The SDK throws typed error classes for better handling:

import { AuthenticationError, RateLimitError } from "@mumin/core";

try {
  await client.hadiths.get(1);
} catch (error) {
  if (error instanceof AuthenticationError) {
    // Redirect to login or refresh token
  } else if (error instanceof RateLimitError) {
    // Wait a bit!
  }
}

⚖️ License

MIT © Mumin Team