Skip to content

Repository files navigation

 sunnah

One command. Every major Hadith collection.
Interactive package manager for the entire Sunnah ecosystem — npm + PyPI.


   

 


🌙 What is Sunnah?

sunnah is an interactive CLI package manager for the major hadith collections of Islam. Install, manage, and update every book in the Sunnah ecosystem from a single terminal command — for both npm (Node.js/React) and pip (Python).

npm install -g sunnah   # Node.js CLI
pip install sunnah      # Python CLI
sunnah                  # open interactive TUI

📦 Available Packages

Book npm pip Hadiths CLI
Sahih al-Bukhari sahih-al-bukhari sahih-al-bukhari 7,563 bukhari
Sahih Muslim sahih-muslim sahih-muslim 7,470 muslim
Sunan Abi Dawud sunan-abi-dawud sunan-abi-dawud 5,274 dawud
Jami al-Tirmidhi jami-al-tirmidhi jami-al-tirmidhi 3,956 tirmidhi
Sunan Ibn Majah sunan-ibn-majah sunan-ibn-majah 4,341 majah
Sunan al-Nasa'i sunan-al-nasai sunan-al-nasai 5,768 nasai

🚀 Installation

# JavaScript / Node.js
npm install -g sunnah

# Python
pip install sunnah

🖥️ Interactive TUI

sunnah

Opens a full-screen terminal UI. Navigate with ↑↓, toggle with space, press enter to install.

════════════════════════════════════════════════════════════
  📿 Sunnah Package Manager  v1.5.0
  ↑↓ nav  space select  a all  i info  u uninstall  U update  enter install  q quit
════════════════════════════════════════════════════════════

  ▶ [✓]  Sahih al-Bukhari   ● npm  (up to date)
         Imam Muhammad ibn Ismail al-Bukhari
         Most authentic hadith collection, second only to the Quran.
         Hadiths: 7,563   CLI: bukhari --help   npm: sahih-al-bukhari   pip: sahih-al-bukhari

    [ ]  Sahih Muslim        ○ not installed
    [ ]  Sunan Abi Dawud     ○ not installed
    ...

Keyboard Controls

Key Action
Navigate
space Toggle select
a Select all / deselect all
i Show package info
u Uninstall selected
U Update selected
enter Install selected
q Quit

⚡ Commands

npm packages

sunnah list                          # all packages + npm/pip status
sunnah install bukhari               # npm install -g sahih-al-bukhari
sunnah install bukhari nasai majah   # install multiple at once
sunnah uninstall dawud               # uninstall
sunnah update                        # check for updates
sunnah update --install              # auto-install all updates

Python (pip) packages

sunnah pip install bukhari           # pip install sahih-al-bukhari
sunnah pip install bukhari nasai     # install multiple
sunnah pip uninstall dawud           # uninstall
sunnah pip list                      # show Python package status
sunnah pip update                    # check for pip updates
sunnah pip update --install          # auto-install pip updates

🔍 NEW: Cross-book search

sunnah search "prayer"               # search all installed books (top 3 each)
sunnah search "fasting" --all        # show all results

🎲 NEW: Random hadith

sunnah random                        # random hadith from a random installed book
sunnah random bukhari                # random hadith specifically from Bukhari

ℹ️ NEW: Book info

sunnah info nasai                    # detailed info: versions, CLI, Python import
sunnah info jami-al-tirmidhi         # works with full npm name too

⚛️ React hook generator

sunnah --react                       # generate useSunnah() for all installed books
sunnah --react bukhari muslim        # specific books only

🐍 Python API

After pip install sunnah, you also get the individual book packages:

sunnah pip install bukhari muslim nasai
from sahih_al_bukhari import Bukhari
from sahih_muslim      import Muslim
from sunan_al_nasai    import Nasai

bukhari = Bukhari()
bukhari.get(1)
bukhari.search("prayer", limit=5)
bukhari.getRandom()
bukhari.getByChapter(1)

🟨 JavaScript / Node.js

sunnah install bukhari muslim
import bukhari from 'sahih-al-bukhari';
import muslim  from 'sahih-muslim';

bukhari.get(1).english.text
muslim.search('prayer', 5)

📊 Version Stats

sunnah --version
────────────────────────────────────────────────────────────
  📿 sunnah  v1.5.0
────────────────────────────────────────────────────────────
  Available  : 6
  npm inst.  : 4 / 6
  pip inst.  : 3 / 6
  Collection : Sahih al-Bukhari, Sahih Muslim, Sunan al-Nasa'i, Jami al-Tirmidhi
  Hadiths    : 24,257

🗂️ Monorepo Structure

sunnah/
├── bin/index.js              ← npm CLI (interactive TUI + all commands)
├── python/sunnah_cli/        ← Python CLI (mirrors npm CLI exactly)
│   ├── __init__.py
│   ├── cli.py                ← main Python CLI entry
│   ├── packages.py           ← package registry (single source of truth)
│   ├── npm_utils.py          ← npm helpers
│   └── pip_utils.py          ← pip helpers
├── package.json
├── pyproject.toml
└── .github/workflows/        ← auto-publish to npm + PyPI on release

📄 License

GNU Affero General Public License v3.0 (AGPL-3.0)


Made with ❤️ for the Muslim community · Seeking knowledge together

Stars

📦 npm🐍 PyPI🐛 Issues

About

A lightweight Javascript + Python library for accessing authentic Sunnah (Hadith) data

Topics

Resources

Stars

10 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages