# ciashanglin/eventtracker architecture

> Architecture diagram of the GitHub repository ciashanglin/eventtracker, 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/ciashanglin/eventtracker
- Repository: https://github.com/ciashanglin/eventtracker

## Overview

##### Main Components

a) Core Components:
- EventTracker (Singleton Object)
- Event Implementations (FlurryEvent, AnalyticsEvent)
- Builder System
- Analytics Services Integration Layer

b) Interface Layer:
- IEventTracker (Base Interface)
- IBuilder (Builder Interface)
- IGetBuilder (Builder Factory Interface)

**┌─────────────────────┐**
- EventTracker     │
- (Singleton)      │
- ┘

**┌─────────────────┐    ┌─────────────────┐**
- FlurryEvent   │    │  AnalyticsEvent │
- ┘    └─────────────────┘

**┌─────────────┐    ┌─────────────┐**
- Flurry    │    │  Analytics  │
- ┘    └─────────────┘

##### Relationship Indicators

**┌────────────┐    ┌────────────┐**
- FakeFlurry │    │  UnitTest  │
- ┘    └────────────┘

**┌─────────────┐    ┌──────────┐**
- IBuilder    │←───│ Builder  │
- ┘    └──────────┘

##### Key Elements to Highlight

- The sealed interface hierarchy of IEventTracker
- The dependency injection points for testing
- The builder pattern implementation
- The event flow from EventTracker to concrete implementations

##### Implementation Details

How the components interact:
**Client → EventTracker → [FlurryEvent, AnalyticsEvent] → Concrete Implementations**

- The extensibility of the system
- The clean separation of concerns
- The testability of the components
- The builder pattern implementation

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Client["Client Application"]
    end

    subgraph Core
        ET["EventTracker<br/>(Singleton)"]
        IET["IEventTracker<br/>(Interface)"]
        IB["IBuilder<br/>(Interface)"]
        IGB["IGetBuilder<br/>(Interface)"]
    end

    subgraph "Event Implementations"
        FE["FlurryEvent"]
        AE["AnalyticsEvent"]
    end

    subgraph "Concrete Services"
        F["Flurry Service"]
        A["Analytics Service"]
    end

    subgraph "Testing Layer"
        FF["FakeFlurry"]
        UT["Unit Tests"]:::test
    end

    subgraph "Builder System"
        B["Builder"]
    end

    %% Relationships
    Client --> ET
    ET --> IET
    ET --> IGB
    FE --> IET
    AE --> IET
    B --> IB
    FE --> F
    AE --> A
    FF -.-> F
    UT --> FF
    IGB --> B
    B --> FE
    B --> AE

    %% Click Events
    click UT "https://github.com/CiaShangLin/EventTracker/blob/main/src/test/kotlin/UnitTest.kt"

    %% Styling
    classDef interface fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef implementation fill:#90EE90,stroke:#333,stroke-width:2px
    classDef event fill:#FFE5CC,stroke:#333,stroke-width:2px
    classDef core fill:#FFB366,stroke:#333,stroke-width:2px
    classDef test fill:#E6E6FA,stroke:#333,stroke-width:2px

    class IET,IB,IGB interface
    class F,A implementation
    class FE,AE event
    class ET core
    class FF,UT test

    %% Legend
    subgraph Legend
        L1["Interface"]:::interface
        L2["Implementation"]:::implementation
        L3["Event"]:::event
        L4["Core Component"]:::core
        L5["Test Component"]:::test
    end
```
