npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

express-quran-api

v0.0.2

Published

Simple Quran API with Express

Readme

Express Quran API

npm version License: MIT Node.js Version

A fast and efficient Express.js API for serving Quran data with multi-language translation support, built-in caching, and optimized search functionality.

Features

  • Multi-language Support: Arabic text with translations in multiple languages
  • Fast Search: Optimized search with indexing for Arabic text and translation search
  • Caching System: Built-in memory caching for improved performance
  • Filtering: Filter surahs by type (Meccan/Medinan)
  • Random Ayah: Get random verses with translations
  • TypeScript Support: Full TypeScript definitions included

Installation

npm install express-quran-api

Quick Start

const ExpressQuranAPI = require('express-quran-api');

const api = new ExpressQuranAPI({
  port: 4000,
  extraLanguages: ['ur', 'fr', 'es', 'tr', 'en']
});

api.listen();

Configuration

Constructor Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | port | number | 3000 | Server port | | dataPath | string | ./data | Path to JSON data files | | extraLanguages | string[] | [] | Additional language codes to load |

Data Files Structure

Place your JSON files in the data directory:

  • quran_ar.json (required) - Arabic Quran data
  • quran_en.json (optional) - English translation
  • quran_ur.json (optional) - Urdu translation
  • etc.

API Endpoints

Get All Surahs

GET /api/surahs

Filter Surahs by Type

GET /api/surahs?filterType=true&type=meccan
GET /api/surahs?filterType=true&type=medinan

Search

GET /api/search?q=الله
GET /api/search?q=Allah&lang=en
GET /api/search?q=خدا&lang=ur

Random Ayah

GET /api/random
GET /api/random?lang=en
GET /api/random?lang=ur

Response Examples

Surahs Response

[
  {
    "id": 1,
    "name": "الفاتحة",
    "type": "meccan",
    "translationName": {
      "en": "The Opening",
      "ur": "فاتحہ"
    },
    "verses": [
      {
        "id": 1,
        "text": "بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ",
        "translation": {
          "en": "In the name of Allah, the Beneficent, the Merciful",
          "ur": "اللہ کے نام سے جو رحمان و رحیم ہے"
        }
      }
    ]
  }
]

Search Response

[
  {
    "surah": 1,
    "surahName": "الفاتحة",
    "surahTranslation": "The Opening",
    "ayah": 1,
    "text": "بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ",
    "translation": "In the name of Allah, the Beneficent, the Merciful"
  }
]

Random Ayah Response

{
  "surah": 2,
  "surahName": "البقرة",
  "ayah": 255,
  "text": "اللَّهُ لَا إِلَٰهَ إِلَّا هُوَ الْحَيُّ الْقَيُّومُ",
  "translation": "Allah - there is no deity except Him, the Ever-Living, the Sustainer of existence"
}

Performance Features

  • Memory Caching: Frequently requested data is cached in memory
  • Search Indexing: Arabic text is pre-indexed for faster word-based searches
  • Optimized JSON Parsing: Data is loaded once at startup
  • Request Optimization: Minimal response payload size

Supported Languages

The API supports any language code you provide. Common examples:

  • ar - Arabic (default)
  • en - English
  • ur - Urdu
  • fr - French
  • es - Spanish
  • tr - Turkish

TypeScript Support

Full TypeScript definitions are included:

import ExpressQuranAPI from 'express-quran-api';

const api = new ExpressQuranAPI({
  port: 4000,
  extraLanguages: ['en', 'ur']
});

Author

bluezly

License

MIT