The Quran Sunnah Reminder API provides endpoints to fetch random Ayahs (verses) from the Quran along with related Hadiths. It offers both JSON responses and dynamically generated images containing the Ayah and Hadith text.
- Random Ayah Retrieval: Fetch a random Ayah from the Quran along with its translation and related Hadith.
- Image Generation: Generate images containing the Ayah and Hadith text with customizable themes and dimensions.
- URL:
/api/json
- Method:
GET
- Response:
{ "surah": "Al-Fatiha", "ayah": 1, "text": { "arabic": "بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ", "english": "In the name of Allah, the Most Gracious, the Most Merciful." }, "hadith": { "arabic": "قال رسول الله صلى الله عليه وسلم...", "english": "The Messenger of Allah (ﷺ) said..." } }
URL: /api/image Method: GET Query Parameters: theme (optional): Set to dark or light. Default is dark. width (optional): Image width in pixels. Default is 800. height (optional): Image height in pixels. Default is 500. Response: Returns a PNG image containing the Ayah and Hadith text. Installation
git clone https://github.com/hlnajz/quran-sunnah-remainder.git
Navigate to the project directory:
cd quran-sunnah-remainder
Install dependencies:
npm install
Usage Start the server:
npm start
JSON endpoint: http://localhost:3000/api/json
Image endpoint: http://localhost:3000/api/image
Fonts: The API uses the Amiri font for Arabic text. Ensure the font file is located at public/fonts/Amiri-Regular.ttf.
Logo: To include a custom logo in the generated images, place your image at public/qr.png.
Light Theme
https://quran-sunnah-remainder.vercel.app/ayat/image?theme=light&type=vertical&width=800&height=500
Dark Theme
https://quran-sunnah-remainder.vercel.app/ayat/image?theme=dark&type=vertical&width=800&height=500
axios: For fetching Ayah data. canvas: For image generation. express: For setting up the server.
Feel Free to use it and share it 🥇😘
Ayah data provided by my quran-ayat-json. Quran-Hadith-Api