widegita
v0.1.1
Published
TypeScript SDK for WideGita -- Bhagavad Gita chapters, verses, commentaries, Upanishads, Yoga Sutras, Hindu deities, and Sanskrit glossary
Maintainers
Readme
widegita
TypeScript SDK for WideGita — access the Bhagavad Gita's 18 chapters and 6,308 verses across 9 commentator translations, 2,103 commentary entries from classical Acharyas, 10 principal Upanishads, all 196 Yoga Sutras of Patanjali, Hindu deities, philosophical concepts, and a comprehensive Sanskrit glossary. Zero runtime dependencies, uses native fetch.
WideGita is part of the WideHoly multi-religion scripture platform, providing structured access to Hindu sacred texts. The REST API serves verse-level data with Sanskrit originals, IAST transliterations, and multiple English translations from scholars including Swami Sivananda, Swami Gambhirananda, and Sri Ramanuja.
Explore the Bhagavad Gita at widegita.com — Chapters, Commentaries, Upanishads, Yoga Sutras, Deities
Table of Contents
- Install
- Quick Start
- What You'll Find on WideGita
- API Reference
- TypeScript Types
- API Endpoints
- Learn More About Hindu Scripture
- Also Available for Python
- WideHoly Scripture Platform
- License
Install
npm install widegitaQuick Start
import { WideGita } from "widegita";
const api = new WideGita();
// Get chapter 2 — Sankhya Yoga (the Yoga of Knowledge)
const chapter = await api.getChapter(2);
console.log(chapter.name); // "Sankhya Yoga"
console.log(chapter.verse_count); // 72
// Read the most famous verse: Bhagavad Gita 2.47
// "You have a right to perform your prescribed duty,
// but you are not entitled to the fruits of action."
const verse = await api.getVerse(2, 47);
console.log(verse.text_sanskrit);
console.log(verse.text);
// Search across all 6,308 verses for references to dharma
const results = await api.search("dharma");
for (const v of results.results.slice(0, 5)) {
console.log(`${v.reference}: ${v.text.slice(0, 80)}...`);
}
// Explore Yoga Sutra 1.2 — Patanjali's definition of yoga
const sutra = await api.getYogaSutra("1-2");
console.log(sutra.translation_text);
// "Yoga is the cessation of the modifications of the mind"What You'll Find on WideGita
Bhagavad Gita Chapters & Verses
The Bhagavad Gita consists of 18 chapters, each representing a different yoga (path of spiritual practice). Set on the battlefield of Kurukshetra, the dialogue between Lord Krishna and the warrior Arjuna addresses fundamental questions of duty, righteousness, devotion, and liberation.
| Ch | Name | Verses | Theme | |----|------|--------|-------| | 1 | Arjuna Vishada Yoga | 47 | The crisis of conscience on the battlefield | | 2 | Sankhya Yoga | 72 | The immortal Self, duty without attachment | | 3 | Karma Yoga | 43 | The path of selfless action | | 4 | Jnana Karma Sannyasa Yoga | 42 | Divine knowledge and renunciation | | 5 | Karma Sannyasa Yoga | 29 | Action vs. renunciation | | 6 | Dhyana Yoga | 47 | Meditation and self-mastery | | 7 | Jnana Vijnana Yoga | 30 | Knowledge of the Absolute | | 8 | Aksara Brahma Yoga | 28 | The imperishable Brahman | | 9 | Raja Vidya Raja Guhya Yoga | 34 | The royal knowledge and secret | | 10 | Vibhuti Yoga | 42 | Divine manifestations | | 11 | Vishvarupa Darshana Yoga | 55 | The cosmic form of Krishna | | 12 | Bhakti Yoga | 20 | The path of devotion | | 13 | Kshetra Kshetrajna Vibhaga Yoga | 35 | The field and the knower | | 14 | Gunatraya Vibhaga Yoga | 27 | The three gunas (qualities) | | 15 | Purushottama Yoga | 20 | The Supreme Person | | 16 | Daivasura Sampad Vibhaga Yoga | 24 | Divine and demoniac natures | | 17 | Shraddhatraya Vibhaga Yoga | 28 | Three types of faith | | 18 | Moksha Sannyasa Yoga | 78 | Liberation through renunciation |
WideGita provides 6,308 verses across 9 commentator translations, each verse with the original Sanskrit text, IAST transliteration, and English translation.
const api = new WideGita();
// List all 18 chapters with verse counts and yoga names
const chapters = await api.listChapters();
for (const ch of chapters.results) {
console.log(`Ch ${ch.number}: ${ch.yoga_name} — ${ch.verse_count} verses`);
}
// Get verse with Sanskrit original and transliteration
const verse = await api.getVerse(2, 47, "sivananda");
console.log(verse.text_sanskrit); // Original Devanagari
console.log(verse.transliteration); // IAST romanization
console.log(verse.text); // English translationLearn more: Gita Chapters · Verse Browser
Commentary Traditions
The Bhagavad Gita has been interpreted by the greatest minds of Indian philosophy. WideGita includes 2,103 commentary entries from 9 classical commentators spanning the major Vedantic traditions.
| Commentator | Tradition | Period | Philosophy | |-------------|-----------|--------|------------| | Adi Shankaracharya | Advaita Vedanta | 8th century | Non-dualism (Brahman alone is real) | | Ramanujacharya | Vishishtadvaita | 11th century | Qualified non-dualism | | Madhvacharya | Dvaita Vedanta | 13th century | Dualism (jiva and Brahman are distinct) | | Swami Sivananda | Neo-Vedanta | 20th century | Practical synthesis of yoga paths | | Swami Gambhirananda | Advaita Vedanta | 20th century | Scholarly Shankara tradition | | Sri Abhinavagupta | Kashmir Shaivism | 10th century | Tantric non-dualism | | Vallabhacharya | Shuddhadvaita | 15th century | Pure non-dualism (devotion-centric) | | Sridhara Swami | Advaita Vedanta | 14th century | Bridge between Advaita and Bhakti | | Baladeva Vidyabhushana | Gaudiya Vaishnavism | 18th century | Acintya Bheda Abheda |
const api = new WideGita();
// List commentaries filtered by Advaita tradition
const advaita = await api.listCommentaries({ tradition: "advaita" });
for (const c of advaita.results) {
console.log(`${c.author} — ${c.name}`);
}
// Get Shankaracharya's commentary entries for chapter 2
const entries = await api.getCommentaryEntries({
commentary__slug: "shankaracharya",
chapter__number: "2",
});
for (const e of entries.results.slice(0, 3)) {
console.log(`Verses ${e.verse_start}-${e.verse_end}: ${e.text.slice(0, 100)}...`);
}Learn more: Commentary Traditions · Glossary of Terms
Upanishads
The Upanishads are the philosophical culmination of the Vedas, exploring the nature of Brahman (ultimate reality), Atman (the Self), and the path to liberation. WideGita covers the 10 principal (Mukhya) Upanishads acknowledged by Adi Shankaracharya.
| Upanishad | Veda | Key Teaching | |-----------|------|-------------| | Isha | Yajur Veda | The Lord pervades all; renunciation and enjoyment | | Kena | Sama Veda | The unknowable nature of Brahman | | Katha | Yajur Veda | Nachiketa's dialogue with Death; the immortal Self | | Prashna | Atharva Veda | Six questions on the nature of creation and prana | | Mundaka | Atharva Veda | Higher vs. lower knowledge; Brahman as the thread | | Mandukya | Atharva Veda | AUM and the four states of consciousness | | Taittiriya | Yajur Veda | Five sheaths (koshas) of the Self | | Aitareya | Rig Veda | Creation from Atman; the nature of consciousness | | Chandogya | Sama Veda | "Tat Tvam Asi" — Thou art That | | Brihadaranyaka | Yajur Veda | The largest Upanishad; Yajnavalkya's teachings |
const api = new WideGita();
// List only the 10 principal Upanishads
const principal = await api.listUpanishads({ is_principal: "true" });
for (const u of principal.results) {
console.log(`${u.name} (${u.sanskrit_name}) — ${u.veda}`);
}
// Get details for the Katha Upanishad
const katha = await api.getUpanishad("katha");
console.log(katha.description);Learn more: Upanishads · Hindu Concepts
Yoga Sutras of Patanjali
The Yoga Sutras are 196 concise aphorisms compiled by the sage Patanjali, forming the foundational text of Raja Yoga. The text is divided into four padas (chapters).
| Pada | Name | Sutras | Focus | |------|------|--------|-------| | 1 | Samadhi Pada | 51 | The nature of yoga and states of absorption | | 2 | Sadhana Pada | 55 | Practice: Kriya Yoga, the Eight Limbs (Ashtanga) | | 3 | Vibhuti Pada | 56 | Supernatural powers (siddhis) arising from practice | | 4 | Kaivalya Pada | 34 | Liberation — the isolation of pure consciousness |
The Eight Limbs of Yoga (Ashtanga Yoga): Yama, Niyama, Asana, Pranayama, Pratyahara, Dharana, Dhyana, and Samadhi.
const api = new WideGita();
// List all sutras in Samadhi Pada (Chapter 1)
const pada1 = await api.listYogaSutras({ pada: "1" });
console.log(`Samadhi Pada: ${pada1.count} sutras`);
// Get the famous definition of yoga (Sutra 1.2)
// "Yogas chitta vritti nirodhah"
const sutra = await api.getYogaSutra("1-2");
console.log(sutra.text_sanskrit);
console.log(sutra.translation_text);Learn more: Yoga Sutras · Topics
Hindu Deities & Concepts
WideGita covers the major deities of the Hindu pantheon and core philosophical concepts that underpin the Gita's teachings. The deity database includes the Trimurti (Brahma, Vishnu, Shiva), their avatars, consorts, and associated traditions.
| Concept | Sanskrit | Meaning | |---------|----------|---------| | Dharma | Dharma | Cosmic order, righteousness, duty | | Karma | Karma | Action and its consequences across lifetimes | | Moksha | Moksha | Liberation from the cycle of birth and death | | Atman | Atman | The eternal Self, identical with Brahman | | Brahman | Brahman | The ultimate, formless reality | | Maya | Maya | The illusory nature of the phenomenal world |
const api = new WideGita();
// List deities filtered by tradition
const vaishnava = await api.listDeities({ tradition: "vaishnavism" });
for (const d of vaishnava.results) {
console.log(`${d.name} (${d.sanskrit_name})`);
}
// List philosophical concepts and browse the Sanskrit glossary
const concepts = await api.listConcepts({ category: "vedanta" });
const glossary = await api.listGlossary();
const topics = await api.listTopics();Learn more: Hindu Deities · Concepts · Sanskrit Glossary
API Reference
| Method | Arguments | Returns | Description |
|--------|-----------|---------|-------------|
| new WideGita(baseUrl?) | baseUrl | WideGita | Create API client |
| listChapters() | — | ListResponse<Chapter> | List all 18 Gita chapters |
| getChapter(number) | number: number | Chapter | Get chapter by number (1-18) |
| getVerse(chapter, verse, translation?) | chapter, verse, translation | Verse | Get specific verse |
| search(query, limit?) | query: string, limit = 25 | ListResponse<Verse> | Search verse texts |
| listCommentaries(params?) | Record<string, string> | ListResponse<Commentary> | List commentaries |
| getCommentaryEntries(params?) | Record<string, string> | ListResponse<CommentaryEntry> | List commentary entries |
| listUpanishads(params?) | Record<string, string> | ListResponse<Upanishad> | List Upanishads |
| getUpanishad(slug) | slug: string | Upanishad | Get Upanishad by slug |
| listYogaSutras(params?) | Record<string, string> | ListResponse<YogaSutra> | List Yoga Sutras |
| getYogaSutra(slug) | slug: string | YogaSutra | Get Yoga Sutra by slug |
| listDeities(params?) | Record<string, string> | ListResponse<Deity> | List Hindu deities |
| getDeity(slug) | slug: string | Deity | Get deity by slug |
| listConcepts(params?) | Record<string, string> | ListResponse<Concept> | List philosophical concepts |
| listTopics() | — | ListResponse<Topic> | List Gita topics |
| listGlossary() | — | ListResponse<GlossaryTerm> | List Sanskrit glossary terms |
TypeScript Types
All response types are exported: Chapter, Verse, Commentary, CommentaryEntry, Upanishad, YogaSutra, Deity, Concept, Topic, GlossaryTerm, and ListResponse<T> (paginated wrapper with count, next, previous, results).
import type { Chapter, Verse, ListResponse } from "widegita";API Endpoints
Base URL: https://widegita.com/api/v1/gita
| Endpoint | Description |
|----------|-------------|
| GET /chapters/ | List all 18 Gita chapters |
| GET /chapters/{number}/ | Get chapter by number |
| GET /verses/?search=query | List/search verses (filterable by chapter, translation) |
| GET /commentaries/ | List commentaries (filterable by tradition) |
| GET /commentary-entries/ | List commentary entries (filterable) |
| GET /upanishads/ | List Upanishads (filterable by veda, is_principal) |
| GET /upanishads/{slug}/ | Get Upanishad details |
| GET /yoga-sutras/ | List Yoga Sutras (filterable by pada) |
| GET /yoga-sutras/{slug}/ | Get Yoga Sutra details |
| GET /deities/{slug}/ | Get deity details |
| GET /concepts/ | List philosophical concepts |
| GET /topics/ | List Gita topics |
| GET /glossary/ | List Sanskrit glossary terms |
Full API documentation at widegita.com/developers/. OpenAPI 3.1 spec: widegita.com/api/openapi.json.
Learn More About Hindu Scripture
- Chapters: All 18 Chapters · Commentary Traditions
- Texts: Upanishads · Yoga Sutras
- Reference: Hindu Deities · Concepts · Sanskrit Glossary
- Explore: Topics · Translations
- API: REST API Docs · OpenAPI Spec
- Python: PyPI Package
Also Available for Python
pip install widegita[api]from widegita import WideGita
with WideGita() as api:
chapter = api.get_chapter(2)
verse = api.get_verse(2, 47)See the Python SDK on PyPI.
WideHoly Scripture Platform
Part of the WideHoly open-source multi-religion scripture platform.
| Package | PyPI | npm | Description | |---------|------|-----|-------------| | widegita | PyPI | npm | Bhagavad Gita, Upanishads, Yoga Sutras — widegita.com | | widebible | PyPI | npm | Bible books, chapters, verses — widebible.com | | widequran | PyPI | npm | Quran surahs, ayahs, tafsirs — widequran.com | | widetorah | PyPI | npm | Torah, Talmud, Mishnah — widetorah.com | | widesutra | PyPI | npm | Buddhist sutras, Tipitaka — widesutra.com | | wideholy | PyPI | npm | Unified hub for all 5 religions — wideholy.com |
License
MIT License — see LICENSE for details.
