# pavanteja18/bhagavad-gita architecture

> Architecture diagram of the GitHub repository pavanteja18/bhagavad-gita, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pavanteja18/bhagavad-gita
- Repository: https://github.com/pavanteja18/bhagavad-gita

## Overview

##### Main Components

a. Client Layer:
- Web Browser
- EJS View Templates (views/*.ejs)

b. Application Layer:
- Node.js Server (index.js)
- Express.js Framework (implied by the use of EJS)

c. External Services:
- Bhagavad Gita RapidAPI

d. Data Flow Layer:
- Axios HTTP Client (for API calls)

**[Web Browser] ←→ [Node.js Server + Express.js]**
- ↑
- ↓
- [EJS Templates]
- ↑
- ↓
- [Axios HTTP Client]
- ↑
- ↓
- [Bhagavad Gita RapidAPI]

##### Component Details

a. Client Layer:
- Three main views: chapters.ejs, index.ejs, and slokhas.ejs
- User interaction points

b. Server Layer:
- Express.js routing system
- Main application file (index.js)

c. External API Layer:
- RapidAPI endpoint
- API authentication point

##### Important Relationships to Highlight

- Template Rendering Flow:
- How the server renders EJS templates
- Data flow from API to templates

- API Integration:
- How Axios makes requests to RapidAPI
- Response handling and data transformation

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]:::client
    end

    subgraph "Application Server"
        NodeServer["Node.js Server"]:::server
        Express["Express.js Framework"]:::server
        Router["Route Handler"]:::server
    end

    subgraph "View Layer"
        Templates["EJS Templates"]:::template
        HomeView["Home View"]:::template
        ChaptersView["Chapters View"]:::template
        SlokhasView["Slokhas View"]:::template
    end

    subgraph "External Services"
        Axios["Axios HTTP Client"]:::service
        RapidAPI["Bhagavad Gita RapidAPI"]:::external
    end

    Browser <--> NodeServer
    NodeServer --- Express
    Express --- Router
    Router --- Templates
    Templates --- HomeView
    Templates --- ChaptersView
    Templates --- SlokhasView
    Router --- Axios
    Axios -.-> RapidAPI

    %% Component Mappings
    click NodeServer "https://github.com/pavanteja18/bhagavad-gita/blob/main/index.js"
    click Templates "https://github.com/pavanteja18/bhagavad-gita/tree/main/views"
    click HomeView "https://github.com/pavanteja18/bhagavad-gita/blob/main/views/index.ejs"
    click ChaptersView "https://github.com/pavanteja18/bhagavad-gita/blob/main/views/chapters.ejs"
    click SlokhasView "https://github.com/pavanteja18/bhagavad-gita/blob/main/views/slokhas.ejs"

    %% Styling
    classDef client fill:#2374ab
    classDef server fill:#57a773
    classDef template fill:#7d387d
    classDef service fill:#ffa630
    classDef external fill:#ef6461

    %% Legend
    subgraph Legend
        Client_["Client Side"]:::client
        Server_["Server Side"]:::server
        Template_["Template Engine"]:::template
        Service_["Services"]:::service
        External_["External API"]:::external
    end
```
