Complete Sahih al-Bukhari โ 7,277 hadiths with full Arabic text and English translations. Data loaded from CDN. CLI + Python library.
Project description
๐ Sahih al-Bukhari
One repo ยท one dataset ยท two packages โ npm and PyPI
๐ Complete Sahih al-Bukhari โ 7,277 hadiths, full Arabic + English.
Tiny installs, data from CDN. CLI + Node.js + React/Vue + Python.
๐ Monorepo Structure
sahih-al-bukhari/
โ
โโโ bin/
โ โโโ bukhari.json โ ๐ SHARED โ single source of truth for JS + Python
โ โโโ index.js โ JS CLI entry
โ
โโโ chapters/ โ ๐ SHARED โ generated by `node build.mjs`
โ โโโ meta.json โ used by CDN loader (JS browser) and Python CDN fallback
โ โโโ 1.json โ
โ โโโ ... โ
โ
โโโ sahih_al_bukhari/ โ Python package
โ โโโ __init__.py
โ โโโ bukhari.py โ reads bin/bukhari.json automatically
โ โโโ cli.py
โ
โโโ index.js โ JS ESM (browser-safe, class only)
โโโ index.cjs โ JS CommonJS (Node, reads bin/bukhari.json)
โโโ index.node.js โ JS Node ESM (reads bin/bukhari.json)
โโโ index.browser.js โ JS browser (CDN, auto-generated)
โโโ index.d.ts โ TypeScript definitions
โโโ build.mjs โ generates chapters/ from bin/bukhari.json
โ
โโโ package.json โ npm config
โโโ pyproject.toml โ Python/Poetry config
โโโ MANIFEST.in โ Python sdist: include data, exclude JS files
โโโ .npmignore โ npm publish: exclude Python files
โโโ .gitignore
๐ Shared Data Files
| File | Used by |
|---|---|
bin/bukhari.json |
JS (Node CJS/ESM CLI) + Python (auto-detected) |
chapters/ |
JS browser (CDN fetch) + Python CDN fallback |
You never need to duplicate or convert data. Both packages read the same file.
๐ Installation
# JavaScript / Node.js
npm install sahih-al-bukhari
# Python
pip install sahih-al-bukhari
๐จ JavaScript Usage
// CommonJS
const bukhari = require('sahih-al-bukhari');
// ESM (Node)
import bukhari from 'sahih-al-bukhari';
bukhari.get(1)
bukhari.getByChapter(1)
bukhari.search('prayer')
bukhari.getRandom()
bukhari[0]
bukhari.length
bukhari.metadata
bukhari.chapters
React Hook
cd my-react-app
bukhari --react # generates src/hooks/useBukhari.js
import { useBukhari } from '../hooks/useBukhari';
function HadithOfTheDay() {
const bukhari = useBukhari();
if (!bukhari) return <p>Loading...</p>;
const h = bukhari.getRandom();
return <p>{h.english.narrator}: {h.english.text}</p>;
}
๐ Python Usage
API is identical to the npm package (same camelCase method names):
from sahih_al_bukhari import Bukhari
bukhari = Bukhari() # auto-reads bin/bukhari.json if in monorepo, else CDN
bukhari.get(1)
bukhari.getByChapter(1)
bukhari.search("prayer")
bukhari.search("prayer", limit=5)
bukhari.getRandom()
bukhari[0]
bukhari.length
bukhari.metadata
bukhari.chapters
# Array-style methods
bukhari.find(lambda h: h.id == 23)
bukhari.filter(lambda h: h.chapterId == 1)
bukhari.map(lambda h: h.narrator)
bukhari.slice(0, 10)
Custom path
bukhari = Bukhari(data_path="/absolute/path/to/bukhari.json")
๐ฅ๏ธ CLI (works from both npm and pip)
bukhari 1
bukhari 2345 -a # Arabic only
bukhari 2345 -b # Arabic + English
bukhari --search "prayer"
bukhari --search "fasting" --all
bukhari --chapter 5
bukhari --random
bukhari --react # (JS only) generates React hook
๐ง Development
git clone https://github.com/SENODROOM/sahih-al-bukhari.git
cd sahih-al-bukhari
npm install
# Regenerate chapters/ from bin/bukhari.json
node build.mjs
# Publish JS
npm publish
# Publish Python
pip install build twine
python -m build
python -m twine upload dist/*
๐ License
GNU Affero General Public License v3.0 (AGPL-3.0)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sahih_al_bukhari-3.1.1.tar.gz.
File metadata
- Download URL: sahih_al_bukhari-3.1.1.tar.gz
- Upload date:
- Size: 6.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08d97befd70962d06e0e72eeaf0bceee7ab39c6dab86de23dda139bfe2d35d33
|
|
| MD5 |
dbac1fc83ff4304d0759021ba38a407c
|
|
| BLAKE2b-256 |
6c3a25ab2b46d4a3177b40e064c074726c76c74dd55503d46e4f21970dfc5c69
|
File details
Details for the file sahih_al_bukhari-3.1.1-py3-none-any.whl.
File metadata
- Download URL: sahih_al_bukhari-3.1.1-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26f676fdebc82d77da1bbf28de09437dab30d01654de3ce4fbd9a4f0dd1a80aa
|
|
| MD5 |
07e807ca5077cc4ab6df2d135850c3f7
|
|
| BLAKE2b-256 |
7855bb8c68e5e65af06694464516c373595b26146d53d819ea223258439f776d
|