Architecture Overview
Page actions
- View as Markdown (opens in a new tab)
- Ask ChatGPT (opens in a new tab)
- Ask Claude (opens in a new tab)
ChatGPT and Claude are third-party services. The link gives them this page's public address and a short instruction. This site records nothing.
Preview: the published page may be older or missing.
The system in one page: who uses it, the containers across three repositories, production deployment and the five data layers.
https://docs.gurbanisoul.com/architecture/overview/
The whole system on one poster — press Next on the site to build it up step by step:
- The people. Three kinds of people meet the system: the sangat and students who read, search and study; Granthis and scholars who review anything flagged in the text but never edit it; and engineers and interns, who change code and documentation only through reviewed pull requests.
- Three surfaces. The website (gurbanisoul.com, a static Astro site), the Gurbani Soul iOS app (fully offline, with its own copy of the database) and this wiki. All three show scripture verbatim, cited by Ang.
- One read-only API. The API is Python standard-library code (webapp/serve.py and the five bounded contexts in webapp/sggs/: reader, search, verify, insights, knowledge) answering 29 routes. It runs as Python functions inside the same Vercel project as the website, so the browser calls it same-origin under /api/* with no CORS; gateway/routes.json decides which function answers which path. The wiki’s live widgets call it the same way.
- The pinned database. db/sggs.sqlite holds 60,658 verbatim lines over 1,430 Angs with FTS5 indexes, opened read-only. It is never committed here: dataset.lock.json names the sggs-data commit and the sha256 of the exact object, and make dataset installs it verified. The app builds its own copy from the same pin.
- Where the text comes from. sggs-data turns the source Bir PDF (1,483 pages) into the corpus and the database through character-exact reconciliation, golden checks and a scholar-reviewed editorial ledger, then publishes the result by commit and checksum — the pin. The English layer from ShabadOS / BaniDB is a separate, labelled table the API reads beside the Gurmukhi, never blended into it.
- Only CI deploys. A pull request runs the gates (tests, the golden contract, dataset integrity, security, the docs gates). Merging to integration deploys staging; a release merge to main runs the gated production deploy to Vercel — the website and the API functions together — verified by the running commit, and cuts the tag. The single Render API stays deployed as the rollback. Nobody deploys by hand.
System context (C4 level 1)
Poster 01 above is the system context: three kinds of people, three surfaces, one read-only API, the pinned database, the source Bir and the labelled English layer, and CI as the only way to production.
Containers (C4 level 2)
The containers live in three repositories joined by reviewed lock files — the data repository builds and proves the database, this one pins and serves it and publishes the golden contract, the app vendors both at a release:
- The scripture is built and proven in sggs-data. The source PDF’s checksum is attested. The pipeline extracts the corpus, reconciles it character for character against the PDF, runs the golden checks, builds the SQLite database and passes the integrity gate. Any editorial repair is registered in the editorial ledger and approved in a scholar review. The database is published by commit, sha256 and size.
- The platform pins it. dataset.lock.json names the sggs-data commit and the object’s sha256 and size. make dataset downloads exactly that object, verifies it and installs it atomically; make dataset-check proves sggs-data publishes it at that commit. A new dataset arrives only as a reviewed bump of this file.
- The platform serves and publishes. webapp/ and frontend/ serve the API and the website at one version. From the running code, tools/gen_golden_vectors.py records the golden contract — thousands of input and output vectors for the Roman fold, search, verification and the reader — and tools/gen_openapi.py the OpenAPI spec.
- The app vendors and re-proves. gurbani-soul-ios pins the contract at a platform release tag (vendor.lock.json, a sha256 per file) and the same dataset pin. It builds its own bundled database pair from that pin and runs byte-parity tests so its Swift port equals the Python source of truth. Its MARKETING_VERSION must equal the platform version it vendored.
- This wiki pins the sibling docs. docs-site/sources.lock.json records, per sibling repository, a commit and the sha256 of every published documentation file; the build installs them under /data/ and /ios/ with a banner naming the canonical source. A pin bump is a small reviewed pull request, opened by the weekly docs-pins job.
- One version number. The web footer, /api/meta, /api/health, the iOS About screen and the App Store all report the same X.Y.Z, and every platform release is re-archived as iOS X.Y.Z (1) from the release tag. A release is complete only when web, API and the binary report the same number from the same commit.
Deployment (production)
The web frontend and API are same-origin: the browser calls /api/* and Vercel’s internal
rewrites send those paths to the API, which runs as Python functions in the same Vercel project
(ADR-0011). There is no CORS and the frontend
carries no API-base configuration. gateway/routes.json decides the routing per environment:
- Staging routes each of the five bounded contexts (
reader,search,verify,insights,knowledge) to its own function, withall— the whole API — as the catch-all. - Production (v1.3.10, and 1.4.0) answers every
/apipath withall. - From a later release, after the app is live on the App Store, production routes the five
contexts the same way as staging, all five in that one release
(services-production, step 3). It is one line in
gateway/routes.json; 1.4.0 leaves it out.
Setting production’s api_platform back to render proxies /api to the Render single API, which
every release still deploys as the rollback target until it is retired. See
Environments and bounded contexts.
The five layers
- Scripture core —
lines(60,658 verbatim rows), raags, sections, authors, vaars. - Search indexes —
FTS5 (fts,fts_en,fts_shabad;fts_triis built but no route reads it),variants,word_freq. - Translations — the Khalsa English layer, a separate labelled table (never blended into
Gurmukhi ). - Analytics / Insight Engine — theme network, stylometry, resonance, semantic neighbours.
- Knowledge layer — attributed raag-timing claims (divergence preserved, never adjudicated).
Source of truth vs generated
- In sggs-data: the PDF-derived corpus and database, the timing seed, the concept definitions and
the private translation inputs (fetched from
Algorythmos-AI/sggs-source, checksum-verified). - Here, source of truth:
webapp/serve.py+verify.py+romannorm.py(the behaviour the Swift port mirrors),frontend/src/, anddataset.lock.json(which database is served). - Here, generated:
contract/*.ndjson+contract/openapi.json,frontend/dist/,webapp/static/;db/sggs.sqliteis installed from the pin, never committed.
See microservices roadmap for how the monolith is factored for a later service split.
Sri Guru Granth Sahib Ji — Knowledge Base wiki. Generated from commit c3d9360. Updated 13 October 2026. Verified against a661527 on 2026-09-26. This copy may be out of date; the page is at https://docs.gurbanisoul.com/architecture/overview/