In the world of modern development, spiritual and literary texts can be made more accessible to developers through clean APIs and libraries. GitaVerse is a modern TypeScript library that enables you to access, explore, and retrieve shlokas (verses) from the Bhagavad Gita with ease.
π What is GitaVerse?
GitaVerse is a TypeScript-based NPM library that allows developers to programmatically fetch the Bhagavad Gita's verses (shlokas), including translations, synonyms, and original Devanagari text.
The Bhagavad Gita is a profound Hindu scripture consisting of 700 verses across 18 chapters. With GitaVerse, you can:
- Retrieve individual verses based on Chapter and Verse number.
- Fetch all shlokas in a specific chapter.
- Access translations, synonyms, and meanings in a structured format.
- Build spiritual apps, educational tools, or study tools effortlessly.
π Features of GitaVerse
- β Fetch Any Shloka: Get verses from any chapter with full details.
- β Detailed Information: Includes Devanagari text, verse translations, synonyms, and multiple meanings.
- β Organized Data: All data is structured and typed with TypeScript interfaces for ease of use.
- β Easy-to-Use API: Clean class-based methods for developers.
- β Lightweight: Minimal dependencies for faster integration.
- β TypeScript Support: Full type safety for robust development.
π₯ Installation
You can install GitaVerse using npm or yarn:
npm install gitaverse
or
yarn add gitaverse
π§ How to Use GitaVerse
Hereβs a quick guide on how you can use the GitaVerse library.
1. Import GitaVerse and Initialize
Start by importing the GitaLibrary
class and initializing it:
import { GitaLibrary } from "gitaverse";
const gita = new GitaLibrary();
2. Fetch Metadata About the Bhagavad Gita
Get an overview of the Bhagavad Gita, such as the total chapters and verses:
const metadata = gita.getDescription();
console.log(metadata);
/*
Output:
{
title: "Bhagavad Gita",
description: "The Bhagavad Gita, often referred to as the Gita, is a 700-verse Hindu scripture that is part of the Indian epic Mahabharata.",
totalChapters: 18,
totalVerses: 700
}
*/
3. Fetch All Shlokas in a Chapter
To retrieve all the verses from a specific chapter, use getChapter()
:
const chapter1Shlokas = gita.getChapter(1);
chapter1Shlokas.forEach((shloka) => {
console.log(shloka.getSummary());
});
4. Fetch a Specific Shloka
Fetch a specific shloka using chapter number and verse number:
const shloka = gita.getShloka(1, 1);
console.log(shloka.getSummary());
/*
Output:
{
chapter: "1",
verse: "1",
devanagari: "ΰ€§ΰ₯ΰ€€ΰ€°ΰ€Ύΰ€·ΰ₯ΰ€ΰ₯ΰ€° ΰ€ΰ€΅ΰ€Ύΰ€...",
verseText: "Dhritarashtra said...",
synonyms: "Dhritarashtra - King Dhritarashtra...",
translation: "King Dhritarashtra inquired...",
meaning: ["Literal meaning of the verse...", "Spiritual significance..."]
}
*/
5. Fetch All Shlokas Grouped by Chapters
If you want to get all verses organized by chapters, use getAllVerses()
:
const allVerses = gita.getAllVerses();
allVerses.forEach((chapter) => {
console.log(
`Chapter ${chapter.getShlokas().length} Shlokas available`
);
});
π API Methods Overview
Hereβs a quick overview of the available methods:
GitaLibrary
Methods:
Method | Description |
---|---|
getDescription() |
Get metadata about the Gita. |
getChapter(chapter) |
Fetch all shlokas in a specific chapter. |
getShloka(chapter, verse) |
Retrieve a specific shloka by chapter & verse. |
getAllVerses() |
Fetch all shlokas grouped by chapters. |
GitaShloka
Methods:
Method | Description |
---|---|
getSummary() |
Retrieve a summary of the shloka details. |
getDevanagari() |
Get the Devanagari text of the verse. |
getTranslation() |
Get the verse translation. |
getMeaning() |
Get multiple meanings of the verse. |
π Use Cases
Here are a few ideas for integrating GitaVerse into your projects:
- Spiritual Apps: Build apps to display Gita shlokas with translations and explanations.
- Study Tools: Develop tools for students to explore and understand the Bhagavad Gita.
- APIs: Serve Gita data through REST APIs for web or mobile apps.
- Personal Projects: Use it for personal study and exploration of the Gita.
π Links
- NPM Package: gitaverse on npm
- GitHub Repository: GitaVerse on GitHub
π€ Contributing
We welcome contributions! If you'd like to add features or fix issues:
- Fork the repository from GitHub.
- Create a feature branch.
- Submit a pull request.
For any suggestions or bugs, feel free to raise an issue.
π License
This project is licensed under the MIT License. See the LICENSE file for more details.
β¨ Final Thoughts
With GitaVerse, exploring the timeless wisdom of the Bhagavad Gita becomes simple and developer-friendly. Whether you're building spiritual apps, study tools, or personal projects, GitaVerse provides everything you need to programmatically access and share the Gita's teachings.
"You have the right to work, but never to the fruit of work."
β Bhagavad Gita (Chapter 2, Verse 47)
Start Exploring the Gita Today with GitaVerse! π
Install Now
Top comments (0)