Skip to main content

📦 SDK Overview

The Quran Foundation JavaScript SDK simplifies interaction with the Quran Foundation API. It works in Node.js and modern browsers and handles authentication for you.

Installation​

npm install @quranjs/api

or with Yarn:

yarn add @quranjs/api

or with pnpm:

pnpm add @quranjs/api

Basic Setup​

Before using the SDK, configure it with your client credentials. You can obtain a Client ID and Client Secret from the Request Access page:

import { configure, quran } from '@quranjs/api';

configure({
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
});

After configuration you can call the SDK methods directly. Tokens are fetched and refreshed automatically.

Example: list chapters​

const chapters = await quran.qf.chapters.findAll();
console.log(chapters);

Continue to the Authentication guide for details on how tokens are managed.