All projects

QuranicLens

Live & public

A research platform that explores any Quranic verse through six lenses — tafsir, hadith, Seerat un Nabi, science, world history, and Abrahamic scripture parallels — synthesized by a 4-agent LLM pipeline that is strictly forbidden from inventing a source.

Open Live Demo Fully public — no login required. Try searching any verse or asking a question in plain language.

1 The Problem

The Quran speaks to science, psychology, history, and the cosmos — but a reader has no easy way to ask "how does this verse connect to X?" without either a scholar's library or a general-purpose LLM that will happily fabricate a hadith or misquote a verse to sound authoritative. For religious content specifically, a hallucinated citation isn't just wrong — it's a trust failure.

The challenge: build something that explores those connections honestly, cites only real sources, and says "I don't know" when the data doesn't support a claim.

2 The Approach

Every source — Quran, tafsir, hadith, Seerat, Bible, Torah, world history, and curated science facts — is embedded into PostgreSQL with pgvector ahead of time. At query time, the app never lets the model answer from memory: it retrieves real rows from the database first, then hands them to the model as context. The one exception is the science lens, where live web search is explicitly permitted to surface current discoveries — every other lens is retrieval-only.

The system prompt is contractual: the model must cite only what's in the provided context, must follow the source hierarchy (Quran → Hadith/Seerat → Science/History/Scripture), and must end every response with an AI disclaimer. If a lens has no relevant data for a query, it's simply omitted — never filled in with a guess.

3 Architecture — the 4-agent pipeline

Four agents share a single context object (the "backpack"), each adding to it before handing off:

① Intent
DeepSeek V3
Parses the raw query into verse keys, keywords, and themes — cheap and fast, so expensive models never see noisy input.
② Database
Claude Sonnet 4.6
Plans a per-table search strategy; app code runs pgvector semantic search across all 6 source tables.
③ Search (parallel)
Gemini 2.5 Flash
Live web search — science lens only — with Google Search grounding.
④ Scholar
Claude Opus 4.6
Reads the full backpack, weaves every available source into one unified, cited answer, and streams it to the browser over SSE.

No pre-seeded link tables connect the sources — every connection is discovered dynamically per query via vector similarity, so "patience" surfaces hadith about "sabr" even without an exact keyword match.

4 Tech Stack

Next.js 16 React 19 TypeScript Tailwind CSS v4 Drizzle ORM PostgreSQL + pgvector (Supabase) gemini-embedding-2 (768-dim) OpenRouter (DeepSeek / Claude) Gemini 2.5 Flash NextAuth v5 Quran Foundation OAuth2 SSE streaming

5 Result

A publicly explorable research tool covering the full Quran plus five supporting source categories, with every claim traceable to a real record.

6,236Quran verses, 4 translations
34,000+Ahadith (Sahih Sittah)
31,000+Bible verses (KJV + NIV)
78,000+Total embedded records

6 Links