MP3 Quran API
Open Tarteel integrates with the MP3Quran.net API to fetch reciter information and stream audio files.API Overview
Base URL
Response Format
JSON with UTF-8 encoding for Arabic text
Authentication
No API key required (public API)
Rate Limiting
No explicit rate limits documented
Caching
Responses cached for 1 hour (3600s)
API Implementation
Core API Functions
Implemented insrc/utils/api.ts:
TypeScript Types
API Endpoints
Get All Reciters
Fetch all available reciters with their moshaf variations.
- Request
- Response
- Usage
Get Specific Reciter
Fetch a specific reciter by ID.
- Request
- Response
- Usage
Audio Streaming
Audio URL Structure
Playlist Generation
ThegeneratePlaylist function creates an array of audio links:
Caching Strategy
Next.js Route Handler Cache
Next.js automatically caches API responses and revalidates them every 3600 seconds (1 hour). This reduces API calls and improves performance.
Service Worker Audio Cache
Audio files are cached by the service worker (see PWA Setup):Error Handling
Network Errors
Network Errors
Both API functions return safe fallbacks:
Invalid Response
Invalid Response
Audio Loading Errors
Audio Loading Errors
Audio player handles loading errors gracefully:
Usage in Components
Server Component (SSR)
Client Component
The MP3 Quran API integration provides reliable access to 500+ reciters with automatic caching and offline support.