# rams3sh/cowin4all architecture

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

- Interactive diagram: https://gitdiagram.com/rams3sh/cowin4all
- Repository: https://github.com/rams3sh/cowin4all

## Overview

Key Components to Include in the System Design:

##### Core Components
- cowin4all SDK (Core interaction layer with CoWIN)
- cowin4all App (Booking automation application)
- OTP Plugin System
- Captcha Plugin System

##### External Systems
- CoWIN Portal
- SMS Gateway/OTP Sources
- User's Mobile Device

**[User Mobile Device] ←→ [OTP Forwarding Layer] ←→ [cowin4all App Server] ←→ [CoWIN Portal]**
- ↑
- [cowin4all SDK]
- ↑
- [Plugin Systems Layer]

##### Component Details

a) Core SDK Layer (cowin4all_sdk):
- Subcomponents:
- API Handler (api.py)
- Utils (utils.py)
- Constants (constants.py)

b) Plugin System:
1. OTP Plugins:
- Android Termux
- Webhook Service
2. Captcha Plugins:
- SVG Pattern Analysis

c) Integration Points:
- Webhook service (Port 8081)
- Ngrok tunnel for remote access
- SMS flow paths

##### Data Flow Indicators
- → for synchronous operations
- ⇢ for asynchronous operations
- ⟲ for recurring operations

##### Deployment Options
Create two separate views showing:
a) Type 1 Setup:
- Split architecture with separate OTP forwarder
- Both local and internet-based options

b) Type 2 Setup:
- All-in-one Android deployment
- Unified architecture within Termux

##### Important Notes
- Webhook endpoint (PUT /put_otp)
- Token refresh mechanism
- Captcha processing flow
- Security boundaries

##### Technical Details to Highlight
- Python 3.8+ runtime
- Termux integration points
- SMS parsing mechanisms
- CoWIN API interaction points

##### Integration points with external systems

Remember to:
- Keep components proportional to their importance
- Use consistent styling throughout
- Version information
- Deprecated or risk areas

This design should capture both the technical architecture and the practical deployment scenarios while maintaining clarity for all stakeholders.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph External["External Systems"]
        COWIN["CoWIN Portal"]:::external
        SMS["SMS Gateway/OTP Sources"]:::external
        MOBILE["User Mobile Device"]:::external
    end

    subgraph Core["Core Application Layer"]
        APP["cowin4all App"]:::core
        SETTINGS["Application Settings"]:::core
        MAIN["Main Entry Point"]:::core
    end

    subgraph SDK["SDK Layer"]
        SDKCORE["cowin4all SDK"]:::sdk
        API["API Handler"]:::sdk
        UTILS["Utils"]:::sdk
        CONST["Constants"]:::sdk
    end

    subgraph Plugins["Plugin Systems"]
        subgraph OTP["OTP Plugins"]
            TERMUX["Android Termux"]:::plugin
            WEBHOOK["Webhook Service<br>(Port 8081)"]:::plugin
        end

        subgraph CAPTCHA["Captcha Plugins"]
            SVG["SVG Pattern Analysis"]:::plugin
        end
    end

    %% Relationships
    MOBILE --> SMS
    SMS --> TERMUX
    SMS --> WEBHOOK
    WEBHOOK --> APP
    TERMUX --> APP
    APP --> SDKCORE
    SDKCORE --> API
    SDKCORE --> UTILS
    SDKCORE --> CONST
    API --> COWIN
    SVG --> APP
    MAIN --> APP
    APP --> SETTINGS

    %% Click Events
    click APP "https://github.com/rams3sh/cowin4all/blob/master/cowin4all/app.py"
    click SETTINGS "https://github.com/rams3sh/cowin4all/blob/master/cowin4all/settings.py"
    click MAIN "https://github.com/rams3sh/cowin4all/blob/master/main.py"
    click SDKCORE "https://github.com/rams3sh/cowin4all/tree/master/cowin4all/cowin4all_sdk/"
    click API "https://github.com/rams3sh/cowin4all/blob/master/cowin4all/cowin4all_sdk/api.py"
    click UTILS "https://github.com/rams3sh/cowin4all/blob/master/cowin4all/cowin4all_sdk/utils.py"
    click CONST "https://github.com/rams3sh/cowin4all/blob/master/cowin4all/cowin4all_sdk/constants.py"
    click TERMUX "https://github.com/rams3sh/cowin4all/blob/master/cowin4all/otp_plugins/android_termux.py"
    click WEBHOOK "https://github.com/rams3sh/cowin4all/blob/master/cowin4all/otp_plugins/webhook_service.py"
    click SVG "https://github.com/rams3sh/cowin4all/blob/master/cowin4all/captcha_plugins/svg_pattern_analysis.py"

    %% Styling
    classDef external fill:#68B587,stroke:#333,stroke-width:2px
    classDef core fill:#5B9BD5,stroke:#333,stroke-width:2px
    classDef sdk fill:#FF9900,stroke:#333,stroke-width:2px
    classDef plugin fill:#FFCC00,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["External Systems"]:::external
        L2["Core Components"]:::core
        L3["SDK Components"]:::sdk
        L4["Plugin Systems"]:::plugin
    end
```
