Migration Cheat Sheet
Purpose: Optionally migrate old SDK usage quickly.
Use this when: Your code still uses QuranClient and you want the recommended runtime-specific client shape.
Do not use this when: You are starting a new integration.
Backend required: Depends on your API family.
Allowed runtimes: Server and public runtimes.
Required credentials: client_id always. client_secret only on the server.
Minimal import: @quranjs/api/server or @quranjs/api/public.
Existing import { QuranClient } from "@quranjs/api" integrations remain supported for backwards compatibility. This guide is recommended cleanup, not a breaking upgrade requirement.
| Old code | New code |
|---|---|
import { QuranClient } from "@quranjs/api" | import { createServerClient } from "@quranjs/api/server" |
new QuranClient({ clientId, clientSecret }) | createServerClient({ clientId, clientSecret }) |
client.chapters.findAll() | client.content.v4.chapters.list() |
client.search.search("mercy", { mode }) | client.search.v1.query({ query: "mercy", mode }) |
frontend with clientSecret | createPublicClient({ clientId, clientType: "confidential-proxy" }) |
Rule of Thumb
- Server work uses
server. - Browser or mobile work uses
public. - Content and Search stay on the server.