Skip to content

hlnajz/quran-sunnah-remainder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quran Sunnah Reminder API

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.

Features

  • 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.

Endpoints

1. Get Random Ayah as JSON

  • 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..."
      }
    }

2. Get Ayah as Image

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

Access the API:

JSON endpoint: http://localhost:3000/api/json

Image endpoint: http://localhost:3000/api/image

Customization:

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

Dependencies:

axios: For fetching Ayah data. canvas: For image generation. express: For setting up the server.

Screenshots:

Dark Theme

Light Theme

License:

Feel Free to use it and share it 🥇😘

Acknowledgements:

Ayah data provided by my quran-ayat-json. Quran-Hadith-Api

Hadith Sahih ###. translations sourced from authentic collections