HidayahAI is a state-of-the-art web application that leverages advanced AI and authentic Islamic sources to provide clear, referenced answers to your questions about Islam. Using a Retrieval-Augmented Generation (RAG) pipeline, HidayahAI searches the Quran and Sahih Hadith collections, returning reliable, evidence-based responses with direct links to Quran.com and Sunnah.com.
- Backend: FastAPI (Python)
- Frontend: Next.js (React), with a supernatural/spiritual Islamic UI theme
- Language Model: Google Gemini 1.5 Flash
- Vector Database: FAISS for fast embedding search
- Embeddings: Sentence-Transformers (
all-MiniLM-L6-v2) - APIs: Links to Quran and Hadith via quran.com and sunnah.com
- Authentic Answers: All responses are directly referenced from Quran and Sahih Hadith.
- Automatic Reference Linking: Inline citations with clickable links to original sources.
- Multilingual Support: Ask questions in English or Urdu.
- Flexible Source Selection: Filter answers by Quran only, Hadith only, or both.
- Alternative Term Search: If no direct match is found, the system suggests close terms or related concepts.
- Proper Citation: Answers are transparently sourced, with clear, formatted citations.
graph TD
UI[Next.js Frontend]
API[FastAPI Backend]
Gemini[Google Gemini 1.5 Flash]
FAISS[FAISS Vector DB]
Embeddings[SentenceTransformers]
Quran[Quran & Hadith Indices]
User((User))
User --> UI
UI --> API
API --> FAISS
API --> Embeddings
API --> Gemini
FAISS --> Quran
API --> UI
- FastAPI Backend: Orchestrates the RAG pipeline, processes queries, retrieves evidence, and generates responses.
- Next.js Frontend: Provides a beautiful, spiritual Islamic interface for users.
- Python 3.9+
- Node.js 18+
- Google Gemini API Key
- Precomputed FAISS indices for Quran and Hadith
- SentenceTransformers
- FAISS
git clone https://github.com/Wasif-Sohail55/HidayahAI.git
cd HidayahAI/backend
python -m venv venv
source venv/bin/activate # on Windows: venv\Scripts\activate
pip install -r requirements.txt
export GEMINI_API_KEY=your_google_gemini_api_key
# Download or place FAISS indices in the designated data/ directory
uvicorn main:app --reloadcd ../frontend
npm install
# Configure .env.local for API endpoints if needed
npm run dev- Place your precomputed FAISS indices and source texts (Quran & Hadith) in the
/datadirectory. - Update environment variables as needed.
Q: What is the significance of prayer in Islam?
A:
โEstablish regular prayer; for prayer restrains from shameful and unjust deeds...โ
โ Quran 29:45
Q: What does the Quran say about patience?
A:
โO you who have believed, seek help through patience and prayer...โ
โ Quran 2:153
Q: Is intention required for every action?
A:
โActions are but by intentions...โ
โ Sahih Bukhari 1
Q: Can you explain the Islamic view on forgiveness?
A:
โLet them pardon and overlook. Would you not like that Allah should forgive you?โ
โ Quran 24:22
โWhoever does not show mercy will not be shown mercy.โ
โ Sahih Muslim 2318
See the API Docs (served via FastAPI Swagger UI at /docs).
We welcome contributions from the community!
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/your-feature) - Create a Pull Request
Please read our CONTRIBUTING.md for full guidelines.
Distributed under the MIT License. See LICENSE for more information.
ุจูุณูู ู ุงูููููู ุงูุฑููุญูู ููู ุงูุฑููุญููู ู
โAnd say: My Lord, increase me in knowledge.โ
โ Quran 20:114


