widequran
v0.1.1
Published
TypeScript SDK for WideQuran -- 114 surahs, 31,240 ayahs, 7,604 hadith, tafsir commentary, and Islamic encyclopedia. Zero dependencies.
Maintainers
Readme
widequran
TypeScript SDK for WideQuran — access 114 surahs, 31,240 ayahs across 5 translations, 7,604 hadith from Sahih al-Bukhari, 1,896 tafsir entries from Ibn Kathir, and a comprehensive Islamic encyclopedia through a typed API. Zero runtime dependencies, uses native fetch.
WideQuran is part of the WideHoly multi-religion scripture platform, providing structured Quranic data, hadith collections, tafsir commentary, and encyclopedic content about prophets, topics, and Islamic terminology.
Explore the Quran at widequran.com — Surahs, Translations, Hadith, Tafsir, People
Table of Contents
- Install
- Quick Start
- What You'll Find on WideQuran
- API Reference
- TypeScript Types
- Learn More About the Quran
- Also Available for Python
- WideHoly Scripture Platform
- License
Install
npm install widequranQuick Start
import { WideQuran } from "widequran";
const api = new WideQuran();
// List all 114 surahs of the Quran
const surahs = await api.listSurahs();
console.log(surahs.results[0].name); // Al-Fatihah
// Get surah details — Al-Baqarah, the longest surah with 286 ayahs
const baqarah = await api.getSurah("al-baqarah");
console.log(baqarah.verse_count); // 286
console.log(baqarah.revelation_type); // medinan
// Search ayahs across all translations
const results = await api.search("mercy");
console.log(results.count); // Number of matching ayahs
// Browse hadith from Sahih al-Bukhari
const collections = await api.listHadithCollections();
console.log(collections.results[0].name); // Sahih al-BukhariWhat You'll Find on WideQuran
Surahs & Ayahs
The Quran contains 114 surahs (chapters) with 6,236 ayahs (verses). Surahs range from the 7-ayah Al-Fatihah (the Opening) to the 286-ayah Al-Baqarah (the Cow). Each surah is classified by its place of revelation — Meccan surahs (revealed before the Hijra, 86 surahs) tend to focus on faith and the afterlife, while Medinan surahs (revealed after the Hijra, 28 surahs) address community law and social guidance.
WideQuran provides 31,240 ayahs across 5 translations, allowing comparative study of Quranic text.
| Translation | Language | Focus | |-------------|----------|-------| | Sahih International | English | Clear, accurate modern English | | Yusuf Ali | English | Classical commentary with footnotes | | Pickthall | English | Literal rendering of meaning | | Al-Hilali & Khan | English | Saudi-standard translation | | Arabic (Uthmani) | Arabic | Original Uthmani script |
import { WideQuran } from "widequran";
const api = new WideQuran();
// Filter surahs by revelation type — 86 Meccan surahs
const meccan = await api.listSurahs("meccan");
console.log(meccan.count); // 86
// Get Al-Fatihah — the most recited surah in daily prayers
const fatihah = await api.getSurah("al-fatihah");
console.log(fatihah.name_arabic); // الفاتحة
console.log(fatihah.name_translation); // The Opening
console.log(fatihah.revelation_order); // 5
// Retrieve a specific ayah by ID
const ayah = await api.getAyah(1);
console.log(ayah.text_arabic); // بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيمِ
console.log(ayah.text_translation); // In the name of Allah...
// Search for ayahs containing "patience"
const patience = await api.search("patience");
console.log(patience.count); // Ayahs mentioning patience (sabr)Learn more: Browse All Surahs · Quran Translations
Juz & Hizb Divisions
The Quran is divided into 30 equal parts called juz (plural: ajza), each containing roughly 20 pages. This division facilitates reading the entire Quran in one month — one juz per day during Ramadan is a widespread practice. Each juz is further divided into 2 hizbs (60 total), and each hizb into 4 quarters (240 total), used as markers for structured recitation.
import { WideQuran } from "widequran";
const api = new WideQuran();
// List all 30 juz divisions
const juzList = await api.listJuz();
console.log(juzList.count); // 30
// Get Juz 1 — starts with Al-Fatihah, ends in Al-Baqarah
const juz1 = await api.getJuz(1);
console.log(juz1.start_surah); // al-fatihah
console.log(juz1.end_surah); // al-baqarah
// List hizb markers within a specific juz
const hizbs = await api.listHizbs(1);
console.log(hizbs.count); // Hizbs in Juz 1Learn more: Juz Overview · Reading Guide
Hadith Collections
Hadith are recorded sayings, actions, and approvals of Prophet Muhammad (peace be upon him). WideQuran indexes 7,604 hadith from major collections. Sahih al-Bukhari, compiled by Imam al-Bukhari (810-870 CE), is considered the most authentic hadith collection in Sunni Islam, containing 7,563 hadith across 97 books after rigorous verification from an initial pool of 600,000 narrations.
Each hadith includes the isnad (chain of narrators), matn (text), and grading (sahih, hasan, da'if).
| Collection | Compiler | Hadith Count | Period | |------------|----------|-------------|--------| | Sahih al-Bukhari | Imam al-Bukhari | 7,563 | 846 CE | | Sahih Muslim | Imam Muslim | — | 875 CE | | Sunan Abu Dawud | Abu Dawud | — | 889 CE | | Jami at-Tirmidhi | Imam at-Tirmidhi | — | 892 CE |
import { WideQuran } from "widequran";
const api = new WideQuran();
// List available hadith collections
const collections = await api.listHadithCollections();
for (const c of collections.results) {
console.log(`${c.name}: ${c.hadith_count} hadith`);
}
// Get a specific hadith by ID
const hadith = await api.getHadith(1);
console.log(hadith.narrator); // Narrator chain
console.log(hadith.text_english); // English translation
console.log(hadith.grade); // Sahih, Hasan, etc.
// Search hadith for specific topics
const prayer = await api.searchHadith("prayer");
console.log(prayer.count); // Hadith about prayer (salat)
// Filter search within a specific collection
const bukhari = await api.searchHadith("fasting", "bukhari");
console.log(bukhari.count); // Bukhari hadith about fastingLearn more: Hadith Collections · Hadith Search
Tafsir Commentary
Tafsir is the scholarly exegesis and interpretation of the Quran. WideQuran provides 1,896 tafsir entries from Ibn Kathir (1300-1373 CE), one of the most widely referenced tafsir works in Islamic scholarship. Tafsir Ibn Kathir explains verses using other Quranic passages, hadith, and reports from the Companions, following a methodology known as tafsir bil-ma'thur (interpretation through transmitted tradition).
import { WideQuran } from "widequran";
const api = new WideQuran();
// List available tafsir collections
const tafsirs = await api.listTafsirs();
for (const t of tafsirs.results) {
console.log(`${t.name} by ${t.author}: ${t.entry_count} entries`);
}
// Get tafsir entries for a specific surah
const fatihahTafsir = await api.getTafsirEntries("ibn-kathir", "al-fatihah");
for (const entry of fatihahTafsir.results) {
console.log(`Ayah ${entry.ayah_start}-${entry.ayah_end}: ${entry.text.slice(0, 100)}...`);
}Learn more: Tafsir Ibn Kathir · Tafsir Methodology
Prophets & Quranic Figures
The Quran mentions 25 prophets by name, from Adam to Muhammad (peace be upon them all). WideQuran catalogs these prophets and other significant figures with their Arabic names, mention counts, and biographical descriptions. The most frequently mentioned prophet in the Quran is Musa (Moses), appearing in 136 ayahs across 34 surahs.
import { WideQuran } from "widequran";
const api = new WideQuran();
// List all Quranic people
const people = await api.listPeople();
console.log(people.count); // Total prophets and figures
// Filter to prophets only — 25 prophets mentioned by name
const prophets = await api.listPeople(true);
for (const p of prophets.results) {
console.log(`${p.name} (${p.name_arabic}): ${p.mention_count} mentions`);
}
// Get details about Prophet Ibrahim (Abraham)
const ibrahim = await api.getPerson("ibrahim");
console.log(ibrahim.name_arabic); // إبراهيم
console.log(ibrahim.is_prophet); // true
console.log(ibrahim.mention_count); // Mentions across the QuranLearn more: Prophets in the Quran · Prophet Stories
Topics & Glossary
WideQuran organizes Quranic content into thematic topics — mercy (rahmah), justice (adl), patience (sabr), charity (sadaqah), and more. Each topic links to relevant ayahs across multiple surahs, enabling thematic study of the Quran.
The glossary provides definitions for essential Islamic and Arabic terms, including transliterations and original Arabic script. Terms like "taqwa" (God-consciousness), "dhikr" (remembrance), and "ummah" (community) are explained with their Quranic usage context.
import { WideQuran } from "widequran";
const api = new WideQuran();
// Browse Quranic topics and themes
const topics = await api.listTopics();
for (const t of topics.results) {
console.log(`${t.name}: ${t.ayah_count} related ayahs`);
}
// Browse Islamic glossary terms
const glossary = await api.listGlossary();
for (const term of glossary.results) {
console.log(`${term.term} (${term.term_arabic}): ${term.definition.slice(0, 80)}...`);
}Learn more: Quranic Topics · Islamic Glossary
API Reference
| Method | Parameters | Returns | Description |
|--------|-----------|---------|-------------|
| listSurahs | revelationType? | PaginatedResponse<Surah> | List all 114 surahs |
| getSurah | slug | Surah | Surah details by slug |
| getAyah | ayahId | Ayah | Get ayah by ID |
| search | query, surah? | PaginatedResponse<Ayah> | Search ayahs by text |
| listJuz | — | PaginatedResponse<Juz> | List all 30 juz |
| getJuz | number | Juz | Juz details by number |
| listHizbs | juz? | PaginatedResponse<Hizb> | List hizb markers |
| listTafsirs | — | PaginatedResponse<Tafsir> | List tafsir collections |
| getTafsirEntries | tafsir?, surah? | PaginatedResponse<TafsirEntry> | Get tafsir entries |
| listHadithCollections | — | PaginatedResponse<HadithCollection> | List hadith collections |
| getHadith | hadithId | Hadith | Get hadith by ID |
| searchHadith | query, collection? | PaginatedResponse<Hadith> | Search hadith text |
| listPeople | isProphet? | PaginatedResponse<QuranicPerson> | List Quranic people |
| getPerson | slug | QuranicPerson | Person details by slug |
| listTopics | — | PaginatedResponse<Topic> | List Quranic topics |
| listGlossary | — | PaginatedResponse<GlossaryTerm> | List glossary terms |
TypeScript Types
All response types are fully exported:
import type {
Surah,
Ayah,
Juz,
Hizb,
Tafsir,
TafsirEntry,
HadithCollection,
Hadith,
QuranicPerson,
Topic,
GlossaryTerm,
PaginatedResponse,
} from "widequran";| Type | Key Fields |
|------|-----------|
| Surah | slug, number, name, name_arabic, verse_count, revelation_type |
| Ayah | id, surah, ayah_number, text_arabic, text_translation, juz |
| Juz | number, start_surah, start_ayah, end_surah, end_ayah |
| Hizb | number, juz, quarter, start_surah, start_ayah |
| Tafsir | slug, name, author, language, entry_count |
| TafsirEntry | id, tafsir, surah, ayah_start, ayah_end, text |
| HadithCollection | slug, name, compiler, hadith_count |
| Hadith | id, collection, hadith_number, narrator, text_english, grade |
| QuranicPerson | slug, name, name_arabic, is_prophet, mention_count |
| Topic | slug, name, ayah_count |
| GlossaryTerm | slug, term, term_arabic, transliteration, definition |
| PaginatedResponse<T> | count, next, previous, results |
Learn More About the Quran
- Browse: Surahs · Translations · Juz
- Study: Tafsir · Topics · People
- Reference: Hadith Collections · Glossary
- API: REST API Docs · OpenAPI Spec
- Python: PyPI Package
Also Available for Python
| Platform | Install | Link |
|----------|---------|------|
| PyPI | pip install widequran | PyPI |
WideHoly Scripture Platform
Part of the WideHoly multi-religion scripture platform.
| Site | Domain | Focus | |------|--------|-------| | WideQuran | widequran.com | 114 surahs, 31,240 ayahs, 7,604 hadith, tafsir, Islamic encyclopedia | | WideBible | widebible.com | 66 books, 31,102 verses, cross-references, biblical encyclopedia | | WideGita | widegita.com | 18 chapters, 700 shlokas, Bhagavad Gita commentary | | WideTorah | widetorah.com | Torah, Talmud, Jewish scripture and commentary | | WideSutra | widesutra.com | Buddhist sutras, Pali Canon, Mahayana texts | | WideHoly | wideholy.com | Multi-religion scripture hub and cross-reference |
License
MIT
