A comprehensive RESTful API for accessing the Holy Quran with translations in multiple languages including Arabic, English, Bengali, and more.
Visit the live API and documentation at https://alquran-api.pages.dev
- Multilingual Support: Access the Quran in multiple languages including Arabic, English, Bengali, and more
- Complete Quran Data: All 114 surahs with their verses, translations, and metadata
- RESTful API: Simple and intuitive API endpoints
- Search Functionality: Search for specific words or phrases across the entire Quran
- No Authentication Required: Open access for all users
- CORS Enabled: Can be used in web applications
- Edge Runtime: Fast response times with Vercel Edge Runtime
https://alquran-api.pages.dev/api/quran
| Endpoint | Description | Parameters |
|---|---|---|
/api/quran |
Get all surahs | lang (optional) |
/api/quran/surah/{id} |
Get a specific surah | id (required), lang (optional) |
/api/quran/surah/{id}/verse/{verseId} |
Get a specific verse | id (required), verseId (required), lang (optional) |
/api/quran/search |
Search the Quran | q (required), lang (optional) |
/api/quran/languages |
Get available languages | None |
All endpoints accept a lang query parameter to specify the language. If not specified, English (en) is used as the default language.
Available language codes:
ar- Arabicbn- Bengalien- Englishes- Spanishfr- Frenchid- Indonesianru- Russiansv- Swedishtr- Turkishur- Urduzh- Chinesetransliteration- Transliteration
GET https://alquran-api.pages.dev/api/quran?lang=en
GET https://alquran-api.pages.dev/api/quran/surah/1?lang=ar
GET https://alquran-api.pages.dev/api/quran/surah/1/verse/1?lang=en
GET https://alquran-api.pages.dev/api/quran/search?q=mercy&lang=en
GET https://alquran-api.pages.dev/api/quran/languages
- Clone the repository:
git clone https://github.com/saikothasan/quran-api.git cd quran-api
2. Install dependencies:
```shellscript
npm install
# or
yarn
- Run the development server:
npm run dev
# or
yarn dev
- Open http://localhost:3000 in your browser to see the result.
quran-api/
βββ app/ # Next.js App Router
β βββ api/ # API routes
β β βββ quran/ # Quran API endpoints
β βββ about/ # About page
β βββ demo/ # Demo application
β βββ documentation/ # API documentation
β βββ search/ # Search page
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page
βββ components/ # React components
β βββ ui/ # UI components (shadcn/ui)
β βββ ... # Other components
βββ lib/ # Utility functions
β βββ quran-utils.ts # Quran-related utilities
βββ public/ # Static files
β βββ quran.json # Arabic Quran data
β βββ quran_en.json # English translation
β βββ quran_bn.json # Bengali translation
β βββ ... # Other language files
βββ ... # Configuration files
This project is deployed on Vercel and is available at https://alquran-api.pages.dev.
To deploy your own instance:
- Fork this repository
- Create a new project on Vercel
- Connect your forked repository
- Deploy
// Get all surahs in English
fetch('https://alquran-api.pages.dev/api/quran?lang=en')
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error('Error:', error);
});import { useState, useEffect } from 'react';
function QuranViewer() {
const [surah, setSurah] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
useEffect(() => {
async function fetchSurah() {
try {
setLoading(true);
const response = await fetch(
'https://alquran-api.pages.dev/api/quran/surah/1?lang=en'
);
if (!response.ok) {
throw new Error('Failed to fetch');
}
const data = await response.json();
setSurah(data);
} catch (err) {
setError(err.message);
} finally {
setLoading(false);
}
}
fetchSurah();
}, []);
if (loading) return <div>Loading...</div>;
if (error) return <div>Error: {error}</div>;
if (!surah) return <div>No data found</div>;
return (
<div>
<h1>{surah.transliteration} ({surah.translation})</h1>
<div>
{surah.verses.map(verse => (
<div key={verse.id}>
<p>{verse.text}</p>
<p>{verse.translation}</p>
</div>
))}
</div>
</div>
);
}
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Saiko Thasan - @saikothasan
Project Link: https://github.com/saikothasan/quran-api
