Skip to main content

Offline Bibles

The Bible reader works without a network. Each translation is a SQLite file built on the backend, downloaded once by the app, and queried locally.

Backend side​

  • Files are committed under bibles/storage/<VERSION>/ (16 versions) and registered as BibleBuild rows with manage.py register_bible_build, which marks the current build the manifest serves.
  • Built with build_sqlite_from_csv (from media/bibles/*.csv) or build_bible_sqlite (from the legacy SQL tables).
  • Endpoints: rest/bibles/manifest/, rest/bibles/<translation>/<build>/download, plus compare/, <version>/<book_id>/<chapter>/ and <version>/search/ for clients that read online.

App side (utils/bibleDownload.js, bibles/sqliteService.js)​

  • ensureBibleInstalled(key) downloads when missing or when a newer build appears; the version is re-checked at most once a day; a stale build file is deleted once the new one is in place.
  • Offline-first: if the manifest or download fails, an installed copy is still used; listInstalledTranslations() builds the version list from what is on disk.
  • Schema: table verse (book, book_id, chapter, verse, text) and FTS5 table verse_fts for keyword search (the offline fallback for semantic search).
  • Downloads do not work on Expo Web or under remote JS debugging (BibleStorageUnavailableError).

Bundled metadata​

constants/bibleData/version_list.json (ASV, ALBB, ESV, KJV, LSB, LU17, NET, NIV, …) and one JSON per version with the book and chapter structure, indexed by bibleSchemas.js. These are exported from the backend with export_version_list and create_version_schema; regenerate them when a version is added.

CompareVersionsModal downloads versions on demand; DefaultVersionSelector, BibleVersionSwitcher and VersionPicker handle version choice; the default version is stored under defaultBibleVersion.

Adding a translation​

  1. Backend: build the SQLite file, register the build, mark it current, export the version list and schema JSON.
  2. App: add the schema JSON under constants/bibleData/, update version_list.json, ship a JS update (no native change needed).