widesutra
v0.1.1
Published
TypeScript SDK for WideSutra -- Buddhist scriptures, Tipitaka, Pali Canon, figures, and concepts
Maintainers
Readme
widesutra
TypeScript SDK for WideSutra — Buddhist scriptures, Tipitaka, Pali Canon, figures, and concepts. Access 5 scripture collections, 15 books, 5,326 texts with Pali originals and English translations, 10 Buddhist figures, and 15 core concepts through a fully typed API client with zero runtime dependencies.
WideSutra is part of the WideHoly multi-religion scripture platform. The REST API serves structured data extracted from primary Buddhist sources including the Pali Canon (Tipitaka), Mahayana sutras, and scholarly translations by Bhikkhu Sujato and Thanissaro Bhikkhu.
Explore Buddhist scriptures at widesutra.com — collections, texts, figures, concepts, and glossary.
Table of Contents
- Install
- Quick Start
- What You'll Find on WideSutra
- API Reference
- TypeScript Types
- API Endpoints
- Also Available for Python
- WideHoly Scripture Platform
- License
Install
npm install widesutraQuick Start
import { WideSutra } from "widesutra";
const client = new WideSutra();
// Browse scripture collections (Tipitaka, Mahayana Sutras)
const collections = await client.listCollections({ tradition: "theravada" });
// Get a specific book
const book = await client.getBook("dhammapada");
console.log(book.name); // Dhammapada
console.log(book.pali_name); // Dhammapada
console.log(book.chapter_count); // 26
// Read a verse with Pali original
const verse = await client.getText("dhammapada", 1, 1);
console.log(verse.results[0].text); // English translation
console.log(verse.results[0].text_pali); // Pali original
console.log(verse.results[0].reference); // Dhp 1:1
// Search across all scriptures
const results = await client.search("four noble truths");
// Explore Buddhist figures
const buddha = await client.getFigure("siddhartha-gautama");
console.log(buddha.name); // Siddhartha Gautama
console.log(buddha.pali_name); // Siddhattha Gotama
console.log(buddha.is_buddha); // true
// Look up core concepts
const concept = await client.getConcept("four-noble-truths");
console.log(concept.pali_term); // Cattari Ariyasaccani
// Browse Pali/Sanskrit glossary
const glossary = await client.listGlossary();What You'll Find on WideSutra
Buddhist Scripture Collections
WideSutra organizes Buddhist scriptures into 5 collections spanning the major traditions. The Tipitaka (Pali Canon), the oldest surviving complete Buddhist canon, contains over 3,500 texts preserved in the Pali language. The Theravada tradition regards it as the most authentic record of the Buddha's teachings, compiled at the First Buddhist Council shortly after the Buddha's parinibbana.
| Collection | Tradition | Texts | Description | |-----------|-----------|-------|-------------| | Tipitaka | Theravada | 3,500+ | Three Baskets: Vinaya, Sutta, Abhidhamma | | Mahayana Sutras | Mahayana | 600+ | Heart Sutra, Diamond Sutra, Lotus Sutra | | Chinese Canon | East Asian | 500+ | Taisho Tripitaka selections | | Tibetan Canon | Vajrayana | 300+ | Kangyur and Tengyur selections | | Pali Commentaries | Theravada | 400+ | Buddhaghosa's Visuddhimagga and Atthakatha |
The Tipitaka's three "baskets" each serve a distinct purpose: the Vinaya Pitaka contains monastic rules and their origin stories, the Sutta Pitaka preserves the Buddha's discourses, and the Abhidhamma Pitaka provides systematic philosophical analysis of mind and matter.
import { WideSutra } from "widesutra";
const client = new WideSutra();
// List all Theravada collections
const collections = await client.listCollections({ tradition: "theravada" });
for (const c of collections.results) {
console.log(`${c.name}: ${c.text_count} texts`);
}
// Get Tipitaka collection details
const tipitaka = await client.getCollection("tipitaka");
console.log(tipitaka.description);Key Texts and Translations
WideSutra provides 5,326 scripture texts with parallel Pali originals and English translations. The Dhammapada, a collection of 423 verses in 26 chapters, is among the most widely read Buddhist texts. Each verse is stored with the original Pali, transliteration, and translations by scholars including Bhikkhu Sujato and Thanissaro Bhikkhu.
| Book | Collection | Chapters | Language | Notable Content | |------|-----------|----------|----------|----------------| | Dhammapada | Sutta Pitaka | 26 | Pali | 423 verses on the path of truth | | Heart Sutra | Prajnaparamita | 1 | Sanskrit | Core teaching on emptiness (sunyata) | | Diamond Sutra | Prajnaparamita | 32 | Sanskrit | Dialogue on the nature of perception | | Lotus Sutra | Mahayana | 28 | Sanskrit | Universal buddhahood, skillful means | | Majjhima Nikaya | Sutta Pitaka | 152 | Pali | Middle-length discourses of the Buddha |
Every text includes a structured reference (e.g., "Dhp 1:1" for Dhammapada Chapter 1, Verse 1) following standard academic citation formats used in Pali Text Society publications.
import { WideSutra } from "widesutra";
const client = new WideSutra();
// Read the opening verse of the Dhammapada
const verse = await client.getText("dhammapada", 1, 1);
const v = verse.results[0];
console.log(v.reference); // Dhp 1:1
console.log(v.text_pali); // Pali original text
console.log(v.text); // English translation
// Search for teachings on mindfulness (sati)
const results = await client.search("mindfulness", { limit: 5 });
for (const r of results.results) {
console.log(`${r.reference}: ${r.text.slice(0, 80)}...`);
}
// List available translations
const translations = await client.listTranslations();
for (const t of translations.results) {
console.log(`${t.code}: ${t.name} (${t.language})`);
}Buddhist Figures
WideSutra catalogs 10 key Buddhist figures across traditions, from the historical Buddha to important disciples and bodhisattvas. Each entry includes names in Pali and Sanskrit, biographical information, tradition affiliation, and links to relevant scripture passages.
| Figure | Pali Name | Sanskrit Name | Tradition | Role | |--------|-----------|---------------|-----------|------| | Siddhartha Gautama | Siddhattha Gotama | Siddhartha Gautama | All | The historical Buddha | | Sariputta | Sariputta | Shariputra | Theravada | Chief disciple, wisdom | | Moggallana | Moggallana | Maudgalyayana | Theravada | Chief disciple, psychic powers | | Ananda | Ananda | Ananda | All | Personal attendant of the Buddha | | Avalokiteshvara | — | Avalokiteshvara | Mahayana | Bodhisattva of compassion | | Nagarjuna | — | Nagarjuna | Mahayana | Founder of Madhyamaka philosophy |
import { WideSutra } from "widesutra";
const client = new WideSutra();
// Get the historical Buddha
const buddha = await client.getFigure("siddhartha-gautama");
console.log(`${buddha.name} (${buddha.pali_name})`);
console.log(`Title: ${buddha.title}`); // The Buddha
console.log(`Wikidata: ${buddha.wikidata_id}`); // Q9441
// List Theravada figures
const figures = await client.listFigures({ tradition: "theravada" });
for (const f of figures.results) {
console.log(`- ${f.name}: ${f.title}`);
}Core Concepts
WideSutra covers 15 core Buddhist concepts with Pali and Sanskrit terminology, doctrinal context, and links to primary source texts. These concepts form the philosophical foundation of Buddhist thought across all traditions.
| Concept | Pali | Sanskrit | Category | |---------|------|----------|----------| | Four Noble Truths | Cattari Ariyasaccani | Catvary Aryasatyani | Doctrine | | Noble Eightfold Path | Ariya Atthangika Magga | Arya Astangika Marga | Practice | | Dependent Origination | Paticca Samuppada | Pratitya Samutpada | Doctrine | | Three Marks of Existence | Tilakkhana | Trilakshana | Doctrine | | Nirvana | Nibbana | Nirvana | Soteriology | | Five Aggregates | Panca Khandha | Panca Skandha | Psychology | | Karma | Kamma | Karma | Ethics | | Emptiness | Sunnata | Sunyata | Philosophy | | Mindfulness | Sati | Smrti | Practice |
The Four Noble Truths (Cattari Ariyasaccani) form the core framework of Buddhist teaching: the truth of suffering (dukkha), its origin (samudaya), its cessation (nirodha), and the path leading to its cessation (magga). This teaching was delivered in the Buddha's first sermon at Sarnath, preserved in the Dhammacakkappavattana Sutta (SN 56.11).
import { WideSutra } from "widesutra";
const client = new WideSutra();
// Look up the Four Noble Truths
const concept = await client.getConcept("four-noble-truths");
console.log(concept.name); // Four Noble Truths
console.log(concept.pali_term); // Cattari Ariyasaccani
console.log(concept.sanskrit_term); // Catvary Aryasatyani
console.log(concept.category); // Doctrine
// List all doctrinal concepts
const concepts = await client.listConcepts({ category: "doctrine" });
for (const c of concepts.results) {
console.log(`- ${c.name} (${c.pali_term})`);
}
// Browse Pali/Sanskrit glossary
const glossary = await client.listGlossary();
for (const g of glossary.results) {
console.log(`${g.term} (${g.pali}): ${g.definition}`);
}
// Browse topics and themes
const topics = await client.listTopics();
for (const t of topics.results) {
console.log(`${t.name}: ${t.text_count} texts`);
}API Reference
| Method | Parameters | Returns | Description |
|--------|-----------|---------|-------------|
| listCollections() | { tradition? } | ApiResponse<Collection> | List scripture collections |
| getCollection() | slug | Collection | Get collection by slug |
| listBooks() | { collection? } | ApiResponse<Book> | List books, optional collection filter |
| getBook() | slug | Book | Get book by slug |
| getText() | book, chapter, verse, { translation? } | ApiResponse<Text> | Get specific scripture text |
| search() | query, { limit? } | ApiResponse<Text> | Search scripture texts |
| listTranslations() | — | ApiResponse<Translation> | List available translations |
| listFigures() | { tradition? } | ApiResponse<Figure> | List Buddhist figures |
| getFigure() | slug | Figure | Get figure by slug |
| listConcepts() | { category? } | ApiResponse<Concept> | List Buddhist concepts |
| getConcept() | slug | Concept | Get concept by slug |
| listTopics() | — | ApiResponse<Topic> | List Buddhist topics |
| listGlossary() | — | ApiResponse<GlossaryTerm> | List Pali/Sanskrit glossary |
TypeScript Types
All response types are exported for full type safety:
import type {
ApiResponse,
Book,
Chapter,
Collection,
Concept,
Figure,
GlossaryTerm,
Text,
Topic,
Translation,
} from "widesutra";API Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /api/v1/sutra/collections/ | List scripture collections |
| GET | /api/v1/sutra/collections/{slug}/ | Collection details |
| GET | /api/v1/sutra/books/ | List books (filter: collection__slug) |
| GET | /api/v1/sutra/books/{slug}/ | Book details |
| GET | /api/v1/sutra/texts/ | List/search texts (filter: book, chapter, translation) |
| GET | /api/v1/sutra/translations/ | List translations |
| GET | /api/v1/sutra/figures/ | List Buddhist figures (filter: tradition) |
| GET | /api/v1/sutra/figures/{slug}/ | Figure details |
| GET | /api/v1/sutra/concepts/ | List Buddhist concepts (filter: category) |
| GET | /api/v1/sutra/concepts/{slug}/ | Concept details |
| GET | /api/v1/sutra/topics/ | List topics |
| GET | /api/v1/sutra/glossary/ | List Pali/Sanskrit glossary |
Full API documentation at widesutra.com/developers/. OpenAPI 3.1.0 spec: widesutra.com/api/schema/.
Also Available for Python
pip install widesutrafrom widesutra import WideSutra
with WideSutra() as client:
collections = client.list_collections()
text = client.get_text("dhammapada", 1, 1)
results = client.search("four noble truths")See widesutra on PyPI.
WideHoly Scripture Platform
Part of the WideHoly multi-religion scripture platform.
| Site | Domain | Focus | |------|--------|-------| | WideBible | widebible.com | Bible verses, cross-references, study tools | | WideQuran | widequran.com | Quran surahs, ayahs, hadiths, tafsir | | WideTorah | widetorah.com | Torah, Talmud, Mishnah, Rashi commentary | | WideSutra | widesutra.com | Buddhist scriptures, Tipitaka, Pali Canon | | WideGita | widegita.com | Bhagavad Gita, Upanishads, Vedic texts | | WideHoly | wideholy.com | Multi-religion hub, cross-tradition search |
Learn More About Buddhist Scriptures
- Scripture: Collections · Translations
- Reference: Figures · Topics · Glossary
- Study: Concepts · Pali Canon
- Tools: Search · Developer Docs
- API: Developer Docs · OpenAPI Spec
License
MIT
