Ilm عِلْم

Search the Quran & Sunnah. Deeply.

A semantic search platform for Islamic scholarship — explore the Quran with tafsir, 34K+ hadiths with narrator chains, and interactive isnad graphs. Powered by meaning, not just keywords.

Free & Open Source Semantic Search Bilingual Open Data AI-Powered
114 Surahs
6,236 Ayahs
34K+ Hadiths
18K+ Narrators

Everything you need to study

Search & Reading

Unified search across Quran and Hadith

Intelligent Search

Find verses and hadiths by what they mean, not just keywords. Hybrid search fuses BM25 full-text with 1024-dimension semantic vectors.

Quran reader with tajweed and tafsir

Quran Reader

114 Surahs with Tajweed-colored Arabic, Sahih International translation, and expandable Tafsir Ibn Kathir commentary — per ayah.

Hadith & Isnad

Hadith browsing with narrator chains

Hadith Explorer

Browse 34K+ hadiths from 926 books across 6 canonical collections, each with full narrator chains and source attribution.

Hadith text diff comparison

Hadith Diff

Compare wording across transmission chains with word-level highlighting. See exactly where narrators diverge.

Quran & Tafsir

Multi-tafsir comparison view

Multi-Tafsir Comparison

Compare Ibn Kathir, al-Tabari, and more side-by-side for any ayah. Switch between classical exegeses in one view.

Early Quranic manuscript

Early Manuscripts

View early Quranic manuscripts per ayah from the Corpus Coranicum archive — Berlin-Brandenburg Academy of Sciences.

Narrator Science

Interactive narrator graph

Narrator Networks

Interactive graph of 18K+ narrators with isnad chains, teacher-student relationships, and Ibn Hajar reliability grades.

Narrator biography from Tahdhib al-Tahdhib

Narrator Biographies

Read Ibn Hajar's Tahdhib al-Tahdhib entries for 7,800+ narrators. Full Arabic text with structured metadata.

Classical Library

Book reader with PageIndex navigation

Book Reader

Browse 9 classical texts from Turath with hierarchical PageIndex navigation. Fath al-Bari, Tahdhib al-Tahdhib, and more.

Sharh commentary linked to hadith

Sharh & Commentary

Every hadith links to its sharh passage — Fath al-Bari, Nawawi, Tuhfat al-Ahwadhi, and more.

Study Tools

Personal study notes

Personal Study Notes

Annotate any ayah or hadith with @mentions, tags, color highlights, and rich embeds. Collect evidence by topic.

Book chat with page citations

Book Chat

Ask questions about any classical text. Answers cite specific pages with one-click navigation back to the source.

Cross-Encoder Reranking

Neural reranking pass that reorders search results by deep semantic relevance — not just keyword overlap.

PageIndex Navigation

Hierarchical table-of-contents trees built from Turath metadata for instant navigation within classical texts.

Data Sources

Built on open scholarly datasets. Every hadith, ayah, and narrator is traceable to its source.

34K

SemanticHadith KG

Hadiths with narrator chains and knowledge graph from 6 canonical collections

6,236

QUL (Tarteel)

QPC Hafs Arabic + Sahih International English from Quranic Universal Library

6,236

Tafsir Ibn Kathir

Classical exegesis per ayah via QUL

33K

Sunnah.com

Human-verified English translations across 6 canonical collections

18K

AR-Sanad

Narrators with Ibn Hajar's reliability classifications

Corpus Coranicum

Early manuscript images per ayah from Berlin-Brandenburg Academy

Run it locally

Ilm runs entirely on your machine — no cloud, no accounts, full privacy.

What gets installed

  • Rust 1.85+ (backend)
  • Node.js v20+ (frontend)
  • Python 3 + uv (data scripts)
  • Ollama (optional, for Ask AI)

macOS & Linuxmake setup handles everything automatically.
Windows — install the prerequisites manually, then switch to the Windows tab for cargo commands.

Get the Code
# Clone
git clone https://github.com/arriqaaq/ilm.git
cd ilm

# Install all prerequisites
make setup

# Check your environment
make doctor

# Ingest all data (hadiths, Quran, books)
make pipeline-full

# Build & run
make dev
# Clone
git clone https://github.com/arriqaaq/ilm.git
cd ilm

# Required env var (SurrealDB needs extra stack)
set RUST_MIN_STACK=8388608

# Build frontend
cd frontend && npm install && npm run build && cd ..

# Prepare data
uv run --with rdflib python3 scripts/build_semantic_data.py
python3 scripts/prepare_quran_data.py

# Ingest hadiths
cargo run -- ingest

# Ingest Quran
cargo run -- ingest-quran
cargo run -- ingest-quran-hadith-refs
cargo run -- ingest-morphology
cargo run -- ingest-quran-similar --qul-dir qul

# Hadith analysis
cargo run -- analyze --families
cargo run -- analyze --mustalah

# Fetch books from turath.io
python3 scripts/fetch_tafsir.py --pages
python3 scripts/fetch_tabari.py --pages
python3 scripts/fetch_fathulbari.py --pages
python3 scripts/fetch_nawawi.py --pages
python3 scripts/fetch_tuhfat_ahwadhi.py --pages
python3 scripts/fetch_sahih_nasai.py --pages
python3 scripts/fetch_awn_mabud.py --pages
python3 scripts/fetch_ibn_majah.py --pages
python3 scripts/fetch_tahdhib.py --pages

# Build book mappings
python3 scripts/build_hadith_mapping.py
python3 scripts/build_muslim_mapping.py
python3 scripts/build_tirmidhi_mapping.py
python3 scripts/build_nasai_mapping.py
python3 scripts/build_abu_dawud_mapping.py
python3 scripts/build_ibn_majah_mapping.py
python3 scripts/build_narrator_book_mapping.py

# Ingest books
cargo run -- ingest-turath --pages-file data/tafsir_ibn_kathir_pages.json --headings-file data/tafsir_ibn_kathir_headings.json --book-id 23604 --name-ar "تفسير القرآن العظيم" --name-en "Tafsir Ibn Kathir" --author-ar "ابن كثير" --tafsir-mapping data/tafsir_verse_mapping.json --category quran --book-type tafsir
cargo run -- ingest-turath --pages-file data/tafsir_tabari_pages.json --headings-file data/tafsir_tabari_headings.json --book-id 7798 --name-ar "تفسير الطبري جامع البيان" --name-en "Tafsir al-Tabari" --author-ar "الطبري" --tafsir-mapping data/tafsir_tabari_verse_mapping.json --category quran --book-type tafsir
cargo run -- ingest-turath --pages-file data/fath_al_bari_pages.json --headings-file data/fath_al_bari_headings.json --book-id 1673 --name-ar "فتح الباري بشرح البخاري" --name-en "Fath al-Bari" --author-ar "ابن حجر العسقلاني" --sharh-mapping data/fath_al_bari_hadith_mapping.json --sharh-collection-id 1 --category hadith --book-type sharh
cargo run -- ingest-turath --pages-file data/nawawi_on_muslim_pages.json --headings-file data/nawawi_on_muslim_headings.json --book-id 1711 --name-ar "شرح النووي على مسلم" --name-en "Sharh Nawawi on Muslim" --author-ar "النووي" --sharh-mapping data/nawawi_on_muslim_hadith_mapping.json --sharh-collection-id 2 --category hadith --book-type sharh
cargo run -- ingest-turath --pages-file data/tuhfat_ahwadhi_pages.json --headings-file data/tuhfat_ahwadhi_headings.json --book-id 21662 --name-ar "تحفة الأحوذي" --name-en "Tuhfat al-Ahwadhi" --author-ar "المباركفوري" --sharh-mapping data/tuhfat_ahwadhi_hadith_mapping.json --sharh-collection-id 4 --category hadith --book-type sharh
cargo run -- ingest-turath --pages-file data/sahih_nasai_pages.json --headings-file data/sahih_nasai_headings.json --book-id 1147 --name-ar "صحيح سنن النسائي" --name-en "Sahih Sunan al-Nasai" --author-ar "الألباني" --sharh-mapping data/sahih_nasai_hadith_mapping.json --sharh-collection-id 5 --category hadith --book-type collection
cargo run -- ingest-turath --pages-file data/awn_mabud_pages.json --headings-file data/awn_mabud_headings.json --book-id 5760 --name-ar "عون المعبود شرح سنن أبي داود" --name-en "Awn al-Mabud" --author-ar "العظيم آبادي" --sharh-mapping data/awn_mabud_hadith_mapping.json --sharh-collection-id 3 --category hadith --book-type sharh
cargo run -- ingest-turath --pages-file data/ibn_majah_pages.json --headings-file data/ibn_majah_headings.json --book-id 98138 --name-ar "سنن ابن ماجه" --name-en "Sunan Ibn Majah" --author-ar "ابن ماجه" --sharh-mapping data/ibn_majah_hadith_mapping.json --sharh-collection-id 6 --category hadith --book-type collection
cargo run -- ingest-turath --pages-file data/tahdhib_pages.json --headings-file data/tahdhib_headings.json --book-id 1278 --name-ar "تهذيب التهذيب" --name-en "Tahdhib al-Tahdhib" --author-ar "ابن حجر العسقلاني" --narrator-mapping data/tahdhib_narrator_mapping.json --category narrator --book-type biography

# PageIndex (book chat navigation)
git clone https://github.com/VectifyAI/PageIndex.git ../PageIndex
pip install -r ../PageIndex/requirements.txt
python3 scripts/index_books.py

# Start server
cargo run -- serve --port 3000
Lite Mode

No GPU? No problem.

Don't have a high-end laptop for running ONNX embeddings or Ollama? Lite mode skips all AI features and builds without fastembed — no large model downloads, no GPU needed. You still get everything that matters for study.

What you keep

  • Quran reading with tafsir & tajweed
  • 34K+ hadiths with narrator chains
  • Full-text search (Arabic & English)
  • Narrator graphs & isnad chains
  • Book viewer (sharh, tafsir, bios)
  • Hadith diff & personal notes
  • Early manuscript images

Run it

# Ingest without embeddings
make pipeline-lite

# Build & serve (no ONNX, no Ollama)
make dev-lite
# Required env var
set RUST_MIN_STACK=8388608

# Build frontend
cd frontend && npm install && npm run build && cd ..

# Prepare data
uv run --with rdflib python3 scripts/build_semantic_data.py
python3 scripts/prepare_quran_data.py

# Ingest hadiths (no embeddings)
cargo run --no-default-features -- ingest

# Ingest Quran
cargo run --no-default-features -- ingest-quran
cargo run --no-default-features -- ingest-quran-hadith-refs
cargo run --no-default-features -- ingest-morphology
cargo run --no-default-features -- ingest-quran-similar --qul-dir qul

# Fetch books from turath.io
python3 scripts/fetch_tafsir.py --pages
python3 scripts/fetch_tabari.py --pages
python3 scripts/fetch_fathulbari.py --pages
python3 scripts/fetch_nawawi.py --pages
python3 scripts/fetch_tuhfat_ahwadhi.py --pages
python3 scripts/fetch_sahih_nasai.py --pages
python3 scripts/fetch_awn_mabud.py --pages
python3 scripts/fetch_ibn_majah.py --pages
python3 scripts/fetch_tahdhib.py --pages

# Build book mappings
python3 scripts/build_hadith_mapping.py
python3 scripts/build_muslim_mapping.py
python3 scripts/build_tirmidhi_mapping.py
python3 scripts/build_nasai_mapping.py
python3 scripts/build_abu_dawud_mapping.py
python3 scripts/build_ibn_majah_mapping.py
python3 scripts/build_narrator_book_mapping.py

# Ingest books
cargo run --no-default-features -- ingest-turath --pages-file data/tafsir_ibn_kathir_pages.json --headings-file data/tafsir_ibn_kathir_headings.json --book-id 23604 --name-en "Tafsir Ibn Kathir" --tafsir-mapping data/tafsir_verse_mapping.json --category quran --book-type tafsir
cargo run --no-default-features -- ingest-turath --pages-file data/tafsir_tabari_pages.json --headings-file data/tafsir_tabari_headings.json --book-id 7798 --name-en "Tafsir al-Tabari" --tafsir-mapping data/tafsir_tabari_verse_mapping.json --category quran --book-type tafsir
cargo run --no-default-features -- ingest-turath --pages-file data/fath_al_bari_pages.json --headings-file data/fath_al_bari_headings.json --book-id 1673 --name-en "Fath al-Bari" --sharh-mapping data/fath_al_bari_hadith_mapping.json --sharh-collection-id 1 --category hadith --book-type sharh
cargo run --no-default-features -- ingest-turath --pages-file data/nawawi_on_muslim_pages.json --headings-file data/nawawi_on_muslim_headings.json --book-id 1711 --name-en "Sharh Nawawi on Muslim" --sharh-mapping data/nawawi_on_muslim_hadith_mapping.json --sharh-collection-id 2 --category hadith --book-type sharh
cargo run --no-default-features -- ingest-turath --pages-file data/tuhfat_ahwadhi_pages.json --headings-file data/tuhfat_ahwadhi_headings.json --book-id 21662 --name-en "Tuhfat al-Ahwadhi" --sharh-mapping data/tuhfat_ahwadhi_hadith_mapping.json --sharh-collection-id 4 --category hadith --book-type sharh
cargo run --no-default-features -- ingest-turath --pages-file data/sahih_nasai_pages.json --headings-file data/sahih_nasai_headings.json --book-id 1147 --name-en "Sahih Sunan al-Nasai" --sharh-mapping data/sahih_nasai_hadith_mapping.json --sharh-collection-id 5 --category hadith --book-type collection
cargo run --no-default-features -- ingest-turath --pages-file data/awn_mabud_pages.json --headings-file data/awn_mabud_headings.json --book-id 5760 --name-en "Awn al-Mabud" --sharh-mapping data/awn_mabud_hadith_mapping.json --sharh-collection-id 3 --category hadith --book-type sharh
cargo run --no-default-features -- ingest-turath --pages-file data/ibn_majah_pages.json --headings-file data/ibn_majah_headings.json --book-id 98138 --name-en "Sunan Ibn Majah" --sharh-mapping data/ibn_majah_hadith_mapping.json --sharh-collection-id 6 --category hadith --book-type collection
cargo run --no-default-features -- ingest-turath --pages-file data/tahdhib_pages.json --headings-file data/tahdhib_headings.json --book-id 1278 --name-en "Tahdhib al-Tahdhib" --narrator-mapping data/tahdhib_narrator_mapping.json --category narrator --book-type biography

# PageIndex (book chat navigation)
git clone https://github.com/VectifyAI/PageIndex.git ../PageIndex
pip install -r ../PageIndex/requirements.txt
python3 scripts/index_books.py

# Start server (text search only)
cargo run --no-default-features -- serve --port 3000

Upgrade to full mode anytime by re-running the full pipeline commands.

Under the Hood

A modern stack built for Islamic scholarship.

Architecture

Frontend
SvelteKit

Quran · Hadith · Search · Narrators · Graphs

JSON API
Backend
Rust / Axum
Search
Ingest
RAG
Database
SurrealDB

Graph · HNSW vectors · BM25

Embeddings
FastEmbed

bge-m3 · 1024-dim

Training Pipeline

1
Raw Data SemanticHadith 34K · QUL · Sunnah.com
2
Parse & Enrich Join translations + narrator bios + tafsir
3
Generate QA ChatML pairs matching RAG prompt pattern
4
LoRA Fine-tune MLX on Phi-4-mini / Command-R
5
GGUF → Ollama Quantize Q4_K_M · ollama create · serve