# harshit029/plant-indetifier-bot architecture

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

- Interactive diagram: https://gitdiagram.com/harshit029/plant-indetifier-bot
- Repository: https://github.com/harshit029/plant-indetifier-bot

## Overview

##### Client Layer
- Telegram Client/App (where users interact with the bot)
- How users send images and receive responses

##### Bot Service Layer
- Telegram Bot API Interface
- Main Bot Application Server (Node.js)
- Message Handler (based on messageTemplates.js)

##### AI/ML Services
- Google Gemini API Integration (represented by geminiService.js)
- Image Processing Pipeline

##### Configuration & Utilities
- Configuration Management (config.js)
- Formatting Services (formatHelper.js)

- [User/Telegram Client]
- ↓
- [Telegram Bot API]
- ↓
- [Plantiya Bot Server]
- ↓
- [Google Gemini API]

##### Component Relationships
- Data flow of image processing:
- Image Upload → Image Processing → AI Analysis → Response Formatting → User Response

##### Specific Elements
- Main application entry point (index.js)
- Message template handling system
- Configuration management
- Format helpers for response processing

##### Technical Details to Highlight
- Node.js runtime environment
- Async communication patterns
- Stateless architecture
- API integration points

##### The modularity of the system components

This architecture represents a modern chatbot application with AI capabilities, focusing on maintainability and scalability while keeping the implementation straightforward and effective.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        User([User])
        TelegramClient[Telegram Client]
    end

    subgraph BotLayer[Bot Service Layer]
        TelegramAPI[Telegram Bot API]
        BotServer["Main Bot Server"]:::main
        MessageHandler["Message Handler"]:::handler
    end

    subgraph AIServices[AI Services Layer]
        GeminiAPI["Google Gemini API"]
        ImageProcess["Image Processing"]
    end

    subgraph Config[Configuration & Utilities]
        ConfigMgmt["Configuration Management"]:::config
        FormatService["Formatting Services"]:::format
    end

    %% Client Flow
    User --> TelegramClient
    TelegramClient <--> TelegramAPI

    %% Bot Layer Flow
    TelegramAPI <--> BotServer
    BotServer <--> MessageHandler
    
    %% AI Services Flow
    BotServer --> ImageProcess
    ImageProcess --> GeminiAPI
    GeminiAPI --> BotServer

    %% Config Integration
    ConfigMgmt -.-> BotServer
    FormatService -.-> BotServer
    
    %% Styling
    classDef main fill:#90EE90
    classDef handler fill:#ADD8E6
    classDef config fill:#D3D3D3
    classDef format fill:#D3D3D3
    classDef external fill:#DDA0DD

    %% Click Events
    click BotServer "https://github.com/Harshit029/Plant-Indetifier-Bot/blob/main/index.js"
    click MessageHandler "https://github.com/Harshit029/Plant-Indetifier-Bot/blob/main/messageTemplates.js"
    click ConfigMgmt "https://github.com/Harshit029/Plant-Indetifier-Bot/blob/main/config.js"
    click FormatService "https://github.com/Harshit029/Plant-Indetifier-Bot/blob/main/formatHelper.js"
    click GeminiAPI "https://github.com/Harshit029/Plant-Indetifier-Bot/blob/main/geminiService.js"

    %% Legend
    subgraph Legend
        L1[User Interface]:::main
        L2[Message Processing]:::handler
        L3[Configuration Components]:::config
        L4[External Services]:::external
    end
```
