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

bibleql-js

v0.2.0

Published

JavaScript/TypeScript SDK for the BibleQL GraphQL API (server-side only)

Readme

bibleql-js

Server-side only - This package is designed for Node.js (>=18). Never use it in browser/frontend code as it would expose your API key.

JavaScript/TypeScript SDK for the BibleQL GraphQL API.

Installation

npm install bibleql-js

Quick Start

import { BibleQLClient } from "bibleql-js";

const client = new BibleQLClient({
  apiKey: process.env.BIBLEQL_API_KEY!,
});

// Get a passage
const passage = await client.passage("John 3:16");
console.log(passage.text);

// Get verse of the day
const votd = await client.verseOfTheDay();
console.log(votd.reference, votd.text);

Configuration

import { BibleQLClient } from "bibleql-js";

const client = new BibleQLClient({
  apiKey: "bql_live_...",               // Required
  apiUrl: "https://custom-api.com/graphql", // Optional (default: https://bibleql-rails.onrender.com/graphql)
  defaultTranslation: "spa-btx",        // Optional (default: "eng-web")
  timeout: 10000,                        // Optional, in ms (default: 30000)
});

You can also set global defaults:

import { configure, BibleQLClient } from "bibleql-js";

configure({
  apiKey: process.env.BIBLEQL_API_KEY!,
  defaultTranslation: "spa-btx",
});

const client = new BibleQLClient({
  apiKey: process.env.BIBLEQL_API_KEY!,
});

API Methods

translations()

Fetch all available translations.

const translations = await client.translations();
// [{ identifier: "eng-web", name: "World English Bible", language: "English", note: "..." }]

translation(identifier)

Fetch a single translation with its books.

const translation = await client.translation("eng-web");
// { identifier: "eng-web", name: "...", books: [...] }

books()

Fetch all books.

const books = await client.books();
// [{ bookId: "GEN", name: "Genesis", testament: "OT", position: 1 }]

languages()

Fetch all languages with their translations.

const languages = await client.languages();
// [{ code: "en", translationCount: 5, translations: [...] }]

passage(reference, options?)

Fetch a passage by reference.

const passage = await client.passage("John 3:16-18");
const passage = await client.passage("Genesis 1:1", { translation: "spa-btx" });

chapter(book, chapterNum, options?)

Fetch all verses in a chapter.

const verses = await client.chapter("GEN", 1);
// [{ bookId: "GEN", bookName: "Genesis", chapter: 1, verse: 1, text: "..." }, ...]

verse(book, chapterNum, verseNum, options?)

Fetch a single verse.

const verse = await client.verse("GEN", 1, 1);
// { bookId: "GEN", bookName: "Genesis", chapter: 1, verse: 1, text: "In the beginning..." }

randomVerse(options?)

Fetch a random verse.

const verse = await client.randomVerse();
const verse = await client.randomVerse({ testament: "OT", books: "GEN,EXO" });

search(query, options?)

Search for verses.

const verses = await client.search("love");
const verses = await client.search("faith", { limit: 10 });

semanticSearch(query, options?)

Search for verses by semantic meaning using AI embeddings.

const results = await client.semanticSearch("God's love for humanity");
const results = await client.semanticSearch("forgiveness", { limit: 10, translation: "spa-rv1909" });
// [{ verse: { bookId: "JHN", bookName: "John", chapter: 3, verse: 16, text: "..." }, similarity: 0.95 }]

verseOfTheDay(options?)

Fetch the verse of the day.

const passage = await client.verseOfTheDay();
const passage = await client.verseOfTheDay({ date: "2026-01-01" });

bibleIndex(options?)

Fetch the complete Bible index with chapter and verse counts.

const index = await client.bibleIndex();
// [{ bookId: "GEN", name: "Genesis", chapterCount: 50, chapters: [{ number: 1, verseCount: 31 }] }]

Error Handling

import {
  BibleQLClient,
  ConfigurationError,
  AuthenticationError,
  RateLimitError,
  ServerError,
  NotFoundError,
  QueryError,
  TimeoutError,
  ConnectionError,
} from "bibleql-js";

try {
  const passage = await client.passage("InvalidRef");
} catch (error) {
  if (error instanceof NotFoundError) {
    console.error("Not found:", error.message);
  } else if (error instanceof AuthenticationError) {
    console.error("Invalid API key");
  } else if (error instanceof RateLimitError) {
    console.error("Rate limited, try again later");
  } else if (error instanceof TimeoutError) {
    console.error("Request timed out");
  } else if (error instanceof ConnectionError) {
    console.error("Network error:", error.message);
  }
}

Error Hierarchy

BibleQLError
  ConfigurationError
  ConnectionError
    TimeoutError
  APIError (status, body)
    AuthenticationError (401)
    RateLimitError (429)
    ServerError (5xx)
  QueryError (errors[])
    NotFoundError

TypeScript

All types are exported:

import type {
  Verse,
  Passage,
  Translation,
  Book,
  Chapter,
  LocalizedBook,
  Language,
  SearchResult,
  SemanticSearchResult,
  BibleQLConfig,
} from "bibleql-js";

License

MIT