An intelligent Islamic guidance system powered by AI, providing scholarly answers based on Quran, Hadith, and Fatwa sources.
- Gemini 2.5 Pro integration for intelligent Islamic guidance
- Multi-source knowledge base combining Quran, Hadith, and Fatwa
- Structured responses with proper citations and references
- Context-aware answers tailored to user queries
- Quran Index: Complete Quranic text with verse references
- Hadith Database: Authentic Hadith collections with proper citations
- Fatwa Repository: Extensive collection of Islamic rulings
- Vector Search: Semantic similarity search for relevant answers
- Streamlit-based UI with elegant, responsive design
- Interactive Q&A interface with example questions
- Real-time processing with loading indicators
- Mobile-friendly responsive design
- Microservices architecture with FastAPI backend
- Docker containerization for easy deployment
- Session management for conversation continuity
- Error handling and graceful degradation
- Python 3.10+
- Docker & Docker Compose
- Google AI API key (for Gemini 2.0)
-
Clone the repository
git clone https://github.com/yourusername/alimbot.git cd alimbot -
Set up environment variables
cp .env.example .env # Edit .env with your Google AI API key -
Launch with Docker
docker-compose up --build
-
Access the application
- Web Interface: http://localhost:8501
- API Endpoint: http://localhost:8000
AlimBot
βββ π― Frontend (Streamlit)
β βββ Modern UI with Islamic design elements
β βββ Interactive Q&A interface
β βββ Real-time response display
β
βββ π§ Backend (FastAPI)
β βββ RESTful API endpoints
β βββ Session management
β βββ Error handling
β
βββ π§ Core Engine
β βββ AI Agent (Gemini 2.0)
β βββ Knowledge Tools
β βββ Response Formatter
β
βββ π Knowledge Base
β βββ Quran Index (FAISS)
β βββ Hadith Index (FAISS)
β βββ Fatwa Index (FAISS)
β
βββ π³ Infrastructure
βββ Docker containers
βββ Environment management
βββ Service orchestration
POST /query
Content-Type: application/json
{
"query": "What breaks wudu?"
}{
"result": "π **Quran References:**\n- Surah Al-Ma'idah 5:6\n\nπ **Hadith References:**\n- Sahih Bukhari, Book of Ablution, Hadith #135\n- Sahih Muslim, Book of Purification, Hadith #225\n\nπ **Fatwa Answer:**\n- Breaking wind, urination, defecation, deep sleep, and loss of consciousness break wudu.\n\nπ‘ **Conclusion:**\nWudu is invalidated by natural bodily functions and states that affect consciousness."
}βββ api/ # FastAPI backend
β βββ main.py # FastAPI application
β βββ routes.py # API endpoints
β βββ Dockerfile # Backend container
βββ app/ # Streamlit frontend
β βββ main.py # Web interface
β βββ Dockerfile # Frontend container
βββ core/ # Core AI engine
β βββ agent.py # AI agent configuration
β βββ tools.py # Knowledge tools
β βββ services.py # Search services
β βββ config.py # Configuration
βββ data/ # Knowledge base
β βββ fatwas.csv # Fatwa dataset
βββ indexing/ # Vector indices
β βββ quran_index/ # Quran embeddings
β βββ hadith_index/ # Hadith embeddings
β βββ fatwas_index/ # Fatwa embeddings
βββ docker-compose.yml # Service orchestration
# Install dependencies
pip install -r requirements.txt
# Run backend
cd api && uvicorn main:app --reload
# Run frontend (in another terminal)
cd app && streamlit run main.py- Quran: Complete text with verse metadata
- Hadith: Authentic collections with proper citations
- Fatwa: Comprehensive Islamic rulings database
- Semantic Search: Using sentence-transformers embeddings
- Multi-modal Queries: Text-based question processing
- Relevant Retrieval: Top-k most relevant results
- Citation Tracking: Proper source attribution
- Multi-tool Integration: Seamlessly combines Quran, Hadith, and Fatwa tools
- Structured Responses: Organized answers with clear sections
- Citation Management: Proper references to Islamic sources
- Context Awareness: Understands complex Islamic queries
- Example Questions: Pre-loaded common Islamic queries
- Real-time Processing: Live response generation
- Error Handling: Graceful degradation on API failures
- Mobile Responsive: Works on all device sizes
- Local Processing: No sensitive data sent to external services
- Session Isolation: Separate conversation contexts
- Input Validation: Sanitized user queries
- Error Logging: Comprehensive error tracking
# Production deployment
docker-compose -f docker-compose.prod.yml up -d
# Development deployment
docker-compose up --build# Required
GOOGLE_AI_API_KEY=your_gemini_api_keyWe welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
This AI system is designed to provide general Islamic information and should not be considered a replacement for qualified Islamic scholars or religious authorities. Always consult with knowledgeable scholars for important religious decisions and rulings.
- Open Source Community: For the amazing tools and libraries that made this project possible
- Google AI: For providing the Gemini 2.0 model
- Islamic Knowledge Sources: For the authentic Quran, Hadith, and Fatwa databases
π€² May Allah guide us all with knowledge and wisdom
Built with β€οΈ for the Muslim community