# razorpay/razorpay-turbo-pod architecture

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

- Interactive diagram: https://gitdiagram.com/razorpay/razorpay-turbo-pod
- Repository: https://github.com/razorpay/razorpay-turbo-pod

## Overview

##### Project Type and Purpose
- Recognize this project as a CocoaPod repository that provides a Turbo SDK for iOS apps. Its primary purpose is to offer both headless (backend-like, non-visible logic) and UI components that developers can integrate into their apps.
- The README succinctly conveys that it’s a “Cocoapod Repository for Turbo Headless Wrapper SDK,” and the file structure further splits the implementation into modules.

##### Analyzing the File Structure
- At the top level, you see directories like “.github” which contains CI workflow files (e.g., genesis.yml) used for automated builds, “Example” which demonstrates sample integration and usage via an Xcode project, and “Pod” which houses the actual SDK components.
- Within the “Pod” directory, note the further segregation:
- “Pod/core”: Contains core frameworks such as CommonLibrary and integrated third-party frameworks (like Sentry and two_party). These serve as the foundation offering shared functionality across the SDK.
- “Pod/headless”: Contains frameworks like RazorpayTurboUPI and TurboUpiPlugin that encapsulate the headless or business logic layer, managing functionalities without UI rendering.
- “Pod/ui”: Contains frameworks such as RazorpayTurboUPIUI and TurboUpiPluginUI, which provide the visual elements, interface components (storyboards, nibs, etc.), and user interaction views.
- The “Example” directory includes the sample integration project(s), demonstrating how the Pod consumer integrates the SDK into an iOS application. This often features separate targets, schemes, and an Xcode project setup.

##### Key Components to Highlight
a. SDK Modules (from the Pod):
- Core Module: Representing the fundamental services and libraries (CommonLibrary, Sentry, two_party) that might overlap across the headless and UI layers.
- Headless Module: Showing components like RazorpayTurboUPI and TurboUpiPlugin that expose API interfaces and backend logic.
- UI Module: Depicting UI frameworks (RazorpayTurboUPIUI, TurboUpiPluginUI) that enable developers to implement native views and interactive flows.
b. Example Integration:
- An example iOS application (from the “Example” folder) demonstrating how to hook the Core, Headless, and UI modules together.
c. CI/CD Pipeline:
- A note for the continuous integration process from the “.github/workflows” folder to show how the project is automatically built and tested.
d. Build and Metadata:
- Reference to the Xcode project files (razorpay-turbo-ui-pod.xcodeproj, Podspec files) which indicate how the pods are defined and integrated.

##### Relationships and Data Flow
- The dependency from the Example application to the Pod components.
- The Core module as the underlying base that both the Headless and UI modules rely upon.
- Interactions between the Headless module (handling non-UI business logic/API calls) and the UI module (presenting the data and user interfaces).
- If appropriate, show external dependencies like Sentry’s error monitoring framework as an integration point within the Core module for logging and analytics.

##### Architectural Patterns and Design Principles
- The repository’s structure suggests a layered approach:
- The Core layer for foundational services.
- The Headless layer for non-UI logic.
- The UI layer for visual presentation.
- This might be visualized as a stack or tiered layers, clearly separating concerns.
- Modularity and code reuse by highlighting that each Pod module is meant to be independently updatable and testable.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["CI/CD Pipeline"]:::ci
    subgraph "Build & Metadata"
        G["Xcode Project"]:::build
        H["Podspec File"]:::build
    end
    F["Example Integration App"]:::example
    subgraph "SDK Modules"
        E["UI Module"]:::ui
        D["Headless Module"]:::headless
        C["Core Module"]:::core
    end

    A --> G
    A --> H
    G --> F
    H --> F
    F -->|"integrates"| E
    E -->|"calls"| D
    D -->|"relies_on"| C
    E -->|"depends_on"| C

    click A "https://github.com/razorpay/razorpay-turbo-pod/blob/master/.github/workflows/genesis.yml"
    click G "https://github.com/razorpay/razorpay-turbo-pod/blob/master/Example/razorpay-turbo-ui-pod.xcodeproj"
    click H "https://github.com/razorpay/razorpay-turbo-pod/blob/master/razorpay-turbo.podspec"
    click F "https://github.com/razorpay/razorpay-turbo-pod/tree/master/Example"
    click C "https://github.com/razorpay/razorpay-turbo-pod/tree/master/Pod/core"
    click D "https://github.com/razorpay/razorpay-turbo-pod/tree/master/Pod/headless"
    click E "https://github.com/razorpay/razorpay-turbo-pod/tree/master/Pod/ui"

    classDef ci fill:#FFEB3B,stroke:#000,stroke-width:2px;
    classDef build fill:#64B5F6,stroke:#000,stroke-width:2px;
    classDef example fill:#81C784,stroke:#000,stroke-width:2px;
    classDef core fill:#E0E0E0,stroke:#000,stroke-width:2px;
    classDef headless fill:#FFB74D,stroke:#000,stroke-width:2px;
    classDef ui fill:#F48FB1,stroke:#000,stroke-width:2px;
```
