Search ancient texts, then read them in layers.
Sutraya is a library where the original text, its translation and notes sit side by side, and a question you ask is answered with quotes you can check against the passage.
See the layered reader What runs today
A working prototype that runs on a laptop with Docker. First corpus: SuttaCentral Pali, released as CC0.
What it is and how it works
The README calls it a search-first library and reader for ancient texts. It is a Next.js (App Router) and TypeScript app with Tailwind, PostgreSQL through Drizzle, and Better Auth for accounts. The planned screens are home search, library catalog, search results, a work landing page and the layered reader.
Import with provenance in the repo
Importer scripts fetch each source and store works, witnesses (one version of a text, such as a root or a translation), divisions and passages. Every witness records its source, an SPDX licence, attribution text and the import time. The docs say sources with unknown rights block ingestion.
Source: docs/CORPUS.md, src/db/schema.ts, src/scripts
Keep layers aligned in the repo
Each passage has a layer (original, transliteration or translation) and a language. For SuttaCentral, the root and the translation are fetched together under the same segment IDs, so the layers stay aligned. Passage text is stored raw so it stays citable, with a separate normalized search form.
Source: docs/CORPUS.md, src/db/schema.ts (passages)
Search, then read in the repo
Search runs on PostgreSQL with diacritic-insensitive matching. Results open the reader for a witness at
/read/[witnessId], with stacked or parallel layers and commentary, parallels and footnote panels.Source: README.md, src/components/PassageLayers.tsx, src/components/reader
Ask, with checks needs a model
Ask is a retrieval-augmented chat. It embeds the question, recalls passages by vector and keyword search, runs a bounded tool loop, then checks quotes against the text and citations against what was retrieved before showing a trust badge. It needs an embedding and chat model, for example Ollama or another OpenAI-compatible API.
Source: docs/ASK.md
Features
Library and works
Catalog, work pages, authors, sources and collections.
src/app/library, works, authors, sources
Layered reader
Original, transliteration and translation layers, a witness selector and division navigation.
src/components/ReaderView.tsx
Parallels
Panels that show related passages in other works.
src/components/reader/ParallelsPanel.tsx
Ask
Grounded Q&A with citations that link to passages and a stable
sutraya:URN. Modes scope answers to a tradition.docs/ASK.md
Translate and OCR
A translation helper with an AI drafting dialog, and an OCR page that sends PDFs or images to an external OCR service.
README.md, src/app/translate, src/app/ocr
Saved, history, workspace
Saved items, reading history, documents and sheets, each scoped to a user.
src/app/saved, history, workspace
MCP server
Tools to search the corpus, read a passage, get parallels and resolve a URN, over the read API.
mcp-server/
Local or hosted
Single implicit local reader by default, or multi-user accounts with usage limits for AI features.
README.md "Auth"
Retrieval checks
A regression test set and gate for Ask.
eval/, npm run eval:gate
The layered reader, as a mock
No screenshots exist in the repository. This is an illustrative mock, not a screenshot. It follows the passage model: one row per passage, with an original layer and a translation layer sharing a position, and notes beside them. The text is a short sample, the notes are placeholders.
Illustrative mock, not a screenshot.
Corpus and licences
The first corpus is a curated set of Pali root texts, and Bhikkhu Sujato's segmented English translations, from SuttaCentral. The repository's corpus notes record both as CC0-1.0. Other sources the importers can load carry different licences, so check the source before reusing any text.
| Source | Content | Licence as recorded |
|---|---|---|
| SuttaCentral | Selected Pali roots and Sujato English translation | CC0-1.0 |
| GRETIL | Abhinavagupta Saiva works | CC-BY-NC-SA-4.0 |
| Esukhia Derge Kangyur | Two demo Tibetan roots, no English | Public domain / CC0-1.0 |
| CBETA and 84000 | Optional importers for Chinese and Tibetan translations | Non-CC0; readable, but blocked from embedding for Ask. Check corpus licence. |
Source: docs/CORPUS.md. This page repeats the repo's records and has not re-checked them with the publishers. Corpus text is credited to SuttaCentral and its translators.
Status
- in the repo code and docs describe it
- needs a model works only with a model or service you supply
- planned a roadmap or gap list item
- unverified not run for this page
Local prototype in the repo
Setup is Node 20 or newer, Docker for Postgres with pgvector, then
npm run setupandnpm run dev, on port 3010. The app was not started for this page.Ask needs a model
Requires an embedding model and a chat model that you provide. Answer quality was not tested here.
OCR needs a model
Calls an external OCR service, with an optional vision-model fallback for images.
Hosted prototype unverified
The docs describe a hosted prototype and a multi-user mode. Whether one is live now is not stated, and no public address is given here.
Wider corpus planned
Gap lists for East Asian and Saiva sources, Zen texts and rights decisions are in the docs. Several items are marked as pending a licence decision.
Tests unverified
Unit tests, a Playwright smoke test and a retrieval eval exist. None were run for this page.
Links
The README does not give a public address for the project, so none is claimed here.
Source repository
Local folder
sutraya. Start withREADME.md, thendocs/CORPUS.md,docs/ASK.mdanddocs/ROADMAP.md.Corpus source
SuttaCentral, credited above. Its site is named in the repository's corpus notes.