# tinypass/piano-sdk-for-android architecture

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

- Interactive diagram: https://gitdiagram.com/tinypass/piano-sdk-for-android
- Repository: https://github.com/tinypass/piano-sdk-for-android

## Overview

##### Project Type and Purpose
- This is an Android SDK intended to provide a suite of services and features (such as “Composer” for content composition, “ID” for identity/authentication workflows, and others) to be integrated within third-party Android applications.
- The README emphasizes integration via Gradle (as an AAR) and directs developers to use specific feature modules (composer, id, etc.), while the file tree shows a multi-module Gradle project with many Android packages.

##### File Structure
- Multiple key modules exist at top-level directories: “composer”, “composer-c1x”, “composer-show-template”, “id”, “show-custom-form”, “show-helper”, and “sample”. Each of these contains its own README, source code, and API definitions.
- Common substructure such as “src/main”, and clearly separated Java packages (under “io/piano/android/...”) that indicate the use of standard Android project structures.
- Build configuration files such as build.gradle.kts, gradle.properties, and Gradle plugin definitions (in the gradle/plugins folder) indicate a consistent, Gradle-driven build ecosystem.
- The presence of API definition files in an “api” subfolder for many modules suggests a contract-based design for how different components expose functionality.

##### README for Additional Insights
- The README at the project root emphasizes that this SDK is intended for integration into other Android apps.
- It provides links to modules like Composer and ID, reinforcing that each module has its own self-contained API and examples (see also the “sample” module).
- The guidance to include configuration properties (e.g., specifying io.piano.aid in the sample’s properties) hints that configuration and dependency injections might be important.

a. Main Components:
- SDK Modules: Break out major SDK components as individual blocks – for example:
- Composer (and its variations such as composer-c1x and composer-show-template)
- ID (handling authentication and identity management)
- Custom Form and Show Helper (for handling UI-related components and interactions)
- The common “api” layer(s) that define interfaces and contracts (found in subdirectories of each module).
- Sample Application: Illustrates the integration of these SDK modules.
- Build & Configuration: A block representing Gradle configuration, plugins, and dependency management which applies across modules.
- External Services/Repositories: Mark external dependencies (e.g., MavenCentral) used to fetch the AARs when integrated into a client application.

b. Relationships and Interactions:
- Within the SDK, show interactions between library modules. For instance, the Composer modules might rely on common API interfaces or share utilities (like JSON adapters, HTTP helpers, etc.).
- That the “api” definitions provide a contract between the modules and their consumers.
- Configuration managed via Gradle across the SDK, underscoring how modules are built and assembled.

c. Important Architectural Patterns and Design Principles:
- Modular Design: Each functionality (Composer, ID, form display, etc.) is isolated in its own module for clarity, testing, and independent updates.
- Contract-Driven Development: The use of API contract files (e.g., composer.api, id.api) suggests that components interact following clearly defined interfaces.
- Separation of Concerns: The project cleanly separates UI components (activities, dialogs, fragments found in “src/main/res” and “src/main/java”) from business logic (API calls, interceptors, providers, etc.).
- Extensibility: With multiple helper classes, interceptors, and adapter factories provided, the system is designed to be extended or overridden as necessary.

d. Relevant Technologies, Frameworks, or Libraries:
- Android SDK and Android Studio project structure (AndroidManifest.xml, resources folders, etc.)
- Kotlin and Java (source directories in src/main/java)
- Gradle/Kotlin DSL for build configuration
- Integration points with external RESTful APIs (as suggested by API contracts)
- JSON parsing libraries (as seen in JsonAdapter and related classes)
- Dependency injection or provider patterns (e.g., DependenciesProvider classes) that are likely used in the system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Components
    Build["Build & Configuration"]:::config
    SA["Sample App"]:::sample

    %% SDK Modules Subgraph
    subgraph "SDK Modules"
        CM["Composer Module"]:::composer
        CC["Composer C1x Module"]:::composer
        CST["Composer Show Template Module"]:::composer
        ID["ID Module"]:::idModule
        SCF["Show Custom Form Module"]:::form
        SH["Show Helper Module"]:::helper
    end

    %% ID OAuth Providers Subgraph
    subgraph "ID OAuth Providers"
        FB["Facebook OAuth"]:::oauth
        GG["Google OAuth"]:::oauth
    end

    %% Relationships
    Build -->|"supports"| CM
    Build -->|"supports"| CC
    Build -->|"supports"| CST
    Build -->|"supports"| ID
    Build -->|"supports"| SCF
    Build -->|"supports"| SH
    Build -->|"configures"| SA

    CM -->|"integrates"| CC
    CM -->|"integrates"| CST
    ID -->|"provides"| FB
    ID -->|"provides"| GG

    SA -->|"calls"| CM
    SA -->|"calls"| ID
    SA -->|"calls"| SCF
    SA -->|"calls"| SH

    %% Click Events
    click CM "https://github.com/tinypass/piano-sdk-for-android/tree/main/composer/"
    click CC "https://github.com/tinypass/piano-sdk-for-android/tree/main/composer-c1x/"
    click CST "https://github.com/tinypass/piano-sdk-for-android/tree/main/composer-show-template/"
    click ID "https://github.com/tinypass/piano-sdk-for-android/tree/main/id/"
    click FB "https://github.com/tinypass/piano-sdk-for-android/tree/main/id/id-oauth-facebook/"
    click GG "https://github.com/tinypass/piano-sdk-for-android/tree/main/id/id-oauth-google/"
    click SCF "https://github.com/tinypass/piano-sdk-for-android/tree/main/show-custom-form/"
    click SH "https://github.com/tinypass/piano-sdk-for-android/tree/main/show-helper/"
    click SA "https://github.com/tinypass/piano-sdk-for-android/tree/main/sample/"
    click Build "https://github.com/tinypass/piano-sdk-for-android/tree/main/gradle/plugins/"

    %% Styles
    classDef config fill:#ccf,stroke:#333,stroke-width:2px;
    classDef composer fill:#fcc,stroke:#333,stroke-width:2px;
    classDef idModule fill:#c9f,stroke:#333,stroke-width:2px;
    classDef oauth fill:#cfc,stroke:#333,stroke-width:2px;
    classDef form fill:#fcf,stroke:#333,stroke-width:2px;
    classDef helper fill:#cff,stroke:#333,stroke-width:2px;
    classDef sample fill:#ff9,stroke:#333,stroke-width:2px;
```
