Hadith is the second source of Islamic law after the Quran. It is the sayings and actions of Prophet Muhammed (PBUH).
An extensive JSON-formatted database is available, containing the Hadiths - Prophet Muhammed's (PBUH) sayings and actions - in both Arabic and English. The database encompasses 17 books of Hadiths.
قاعدة بيانات شاملة بصيغة JSON، تحتوي على الأحاديث النبوية الشريفة باللغتين العربية والإنجليزية. تشمل القاعدة 17 كتاباً من كتب السنة النبوية.
- Total Hadiths: 50,884 Hadiths.
- Sahih al-Bukhari صحيح البخاري
- Sahih Muslim صحيح مسلم
- Sunan Abi Dawud سنن أبي داود
- Jami` at-Tirmidhi جامع الترمذي
- Sunan an-Nasa'i سنن النسائي
- Sunan Ibn Majah سنن ابن ماجه
- Muwatta Malik موطأ مالك
- Musnad Ahmad مسند أحمد
- Sunan ad-Darimi سنن الدارمي
- Riyad as-Salihin رياض الصالحين
- Shamail al-Muhammadiyah الشمائل المحمدية
- Bulugh al-Maram بلوغ المرام
- Al-Adab Al-Mufrad الأدب المفرد
- Mishkat al-Masabih مشكاة المصابيح
- The Forty Hadith of al-Imam an-Nawawi الأربعون النووية
- The Forty Hadith Qudsi الأربعون القدسية
- The Forty Hadith of Shah Waliullah أربعون الشاه ولي الله
- Node.js
- TypeScript
- Cheerio.js
- Axios
- cli-progress
The data was scrapped from Sunnah.com, and was converted to JSON format using a custom script. All scripts are available in the src
folder.
The data is available in two formats:
- By Book: The Hadiths are grouped by book. See all Books in the
db/by_book
folder. - By Chapter: The Hadiths are grouped by chapter. See all Chapters in the
db/by_chapter
folder. - Next INSHALLAH will add more formats.
See all Types in the types/index.d.ts
file.
Every Hadih is an object with the following format:
interface Hadith {
id: number;
chapterId: number;
bookId: number;
arabic: string;
english: {
narrator: string;
text: string;
};
}
npm install
- Installs the dependencies.npm run build
- Compiles the TypeScript files to JavaScript.npm run start
- Starts the script that scrapes the data from Sunnah.com.npm run dev:build
- Compiles the TypeScript files to JavaScript in watch mode.npm run dev:start
- Starts the script that scrapes the data from Sunnah.com in watch mode.
.
├── db
│ ├── by_book
│ │ │ ├── the_9_books
│ │ │ │ ├── bukhari.json
│ │ │ │ ├── muslim.json
│ │ │ │ ├── ...
│ │ │ ├── forties
│ │ │ │ ├── nawawi40.json
│ │ │ │ ├── ...
│ │ │ ├── ...
│ ├── by_chapter
│ │ ├── the_9_books
│ │ │ ├── bukhari
│ │ │ │ ├── 1.json
│ │ │ │ ├── 2.json
│ │ │ │ ├── ...
│ │ │ ├── muslim
│ │ │ │ ├── ...
│ │ │ ├── ...
│ │ ├── forties
│ │ │ ├── nawawi40
│ │ │ │ ├── 1.json
│ │ │ │ ...
│ │ │ other_books
│ │ │ │ RyadSalihin
│ │ │ │ │ ├── 1.json
│ │ ...
│ ├── by_book
│ src
│ │ ├── index.ts
│ │ ├── types
│ │ ├── helpers
│ ...
- In Musnad Ahmed, the chapters from 8 to 30 are missing in the source data. If you know better source for this book, please let us know.
- The source code for scraping in the
src
directory is not perfect. I wrote it when I was a beginner to practice scraping. It needs refactoring. (BTW, it works fine 😅)
Contributions are welcome. Please open an issue or a pull request.
May Allah accept this work and make it beneficial for all Muslims. Ameen.