Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ragaeeb/shamela/llms.txt

Use this file to discover all available pages before exploring further.

Access Maktabah Shamela v4 with TypeScript

A universal TypeScript library for downloading Islamic texts, querying book databases, and processing Arabic content from Shamela’s extensive collection.

Key features

Everything you need to integrate Shamela’s Arabic Islamic texts into your application

Full Data Lifecycle

Fetch metadata, download master and book databases, and query results entirely in-memory

Runtime Configuration

Configure API credentials, WASM paths, and custom fetch implementations at runtime

Content Processing

Parse, sanitize, and post-process Arabic book content with utilities tailored for Shamela

Environment Aware

Automatically selects optimal sql.js WASM bundles for Node.js, browsers, and bundlers

Lightweight Export

Content-only export for client-side use without sql.js overhead (1.5KB vs 900KB)

Flexible Output

Support for both JSON and SQLite output formats for downloaded content

Quick start

Get up and running with Shamela in minutes

1

Install the package

Install Shamela using your preferred package manager:
npm install shamela
2

Configure API credentials

Set up your API credentials and endpoints. You’ll need to obtain an API key from Shamela.
This library requires an API key to access Shamela’s APIs. For API key inquiries, contact mail@shamela.ws
import { configure } from 'shamela';

configure({
  apiKey: process.env.SHAMELA_API_KEY,
  booksEndpoint: process.env.SHAMELA_BOOKS_ENDPOINT,
  masterPatchEndpoint: process.env.SHAMELA_MASTER_ENDPOINT,
});
3

Download and query book data

Use the library to download books and access their content:
import { getBook } from 'shamela';

const book = await getBook(26592);
console.log(`Downloaded book with ${book.pages.length} pages`);

// Access page content
book.pages.forEach(page => {
  console.log(page.content);
});

Explore by use case

Learn how to use Shamela in different environments and scenarios

Node.js Usage

Learn how to use Shamela in standard Node.js environments with automatic WASM detection

View guide

Next.js Integration

Configure Shamela for Next.js with proper WASM handling and server-side setup

View guide

Browser Usage

Use Shamela in browsers with CDN-hosted WASM or lightweight content utilities

View guide

Content Processing

Process and transform Arabic content with utilities for parsing, sanitization, and Markdown conversion

View guide

Ready to get started?

Follow our quickstart guide to integrate Shamela into your application in minutes

View quickstart guide

Build docs developers (and LLMs) love