DEV Community

Ai2th
Ai2th

Posted on Edited on

Miktam Bible | Part 1 — Offline-First: SQLite, FTS5 and Open Bible Data

"Offline" is easy to promise and hard to deliver. This part covers how Miktam Bible stores Scripture so that reading and searching never need the network.


🗄️ One translation, one SQLite file

Each translation is a standalone SQLite database with a simple schema:

CREATE TABLE books (
  book_number    INTEGER PRIMARY KEY,
  name           TEXT NOT NULL,
  abbreviation   TEXT NOT NULL,
  testament      TEXT NOT NULL CHECK (testament IN ('OT', 'NT')),
  total_chapters INTEGER NOT NULL
);

CREATE TABLE verses (
  id           INTEGER PRIMARY KEY AUTOINCREMENT,
  book_number  INTEGER NOT NULL,
  chapter      INTEGER NOT NULL,
  verse_number INTEGER NOT NULL,
  text         TEXT NOT NULL,
  UNIQUE (book_number, chapter, verse_number)
);

CREATE VIRTUAL TABLE verses_fts USING fts5(
  text, content=verses, content_rowid=id
);
Enter fullscreen mode Exit fullscreen mode

The verses_fts table is SQLite's FTS5 full-text index. Searching the whole Bible is one indexed query, and it is instant on a phone.

Not every published file carries that index: many of the per-language files are plain books and verses tables. On the phone it does not matter, because the app imports each translation into its own local database and builds the FTS5 index there.


📦 Download once, read forever

The King James Version ships inside the app, so Miktam Bible works the moment it is installed. Other translations are downloaded once from the Translations screen and then live on the phone like KJV.


🌍 The data is open

The databases are public on GitHub, so anyone can build on them:

Repo Contents
bible_db One SQLite file per translation
concordance_db Strong's Greek and Hebrew, lexicons, cross-references
bible_db_languages_a_f 358 languages
bible_db_languages_g_m 415 languages
bible_db_languages_n_s 275 languages
bible_db_languages_t_z 243 languages

🔗 Highlights that survive switching translations

Highlights and bookmarks are stored against the canonical coordinates (book number, chapter, verse) rather than a row in one translation's table. Switch from KJV to another version and your highlights are still on the right verses. (Study notes are kept per translation today.)


Next, Part 2: the AI study assistant, and how it answers from Scripture without a server.

📥 Get Miktam Bible

Miktam Bible is in Google Play closed testing:

  1. Join the AI2TH Google Group with the Google account on your phone. Members are testers for every AI2TH Play app.
  2. Opt in at play.google.com/apps/testing/miktam.bible.
  3. Install from Google Play.

Different Play account? Request access here.

Top comments (0)