# bulatovv/aiorise architecture

> Architecture diagram of the GitHub repository bulatovv/aiorise, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bulatovv/aiorise
- Repository: https://github.com/bulatovv/aiorise

## Overview

##### Main Components

a) Core Components:
- API Client Layer
- Bot Framework
- Event System
- Connection Handler
- Action System
- Filter System

b) Code Generation System:
- API Request Generator
- Event Types Generator
- Object Types Generator
- Response Types Generator

##### Client Layer
- It to Request/Response Types
- Connection to the Connection Handler

##### Bot Framework
- Relationships with:
- Handlers
- Events
- Filters
- Actions

##### Event System
- Event flow:
- Event Types
- Event Context
- Event Wrapper
- Event Handlers

##### Application Layer
- Bot Framework
- Handlers
- Filters

##### Business Logic Layer
- Actions
- Events
- Event Context

##### Communication Layer
- API Client
- Connection Handler
- Request/Response Types

##### Code Generation Layer (separate section)
- All codegen components

##### Important Details to Capture

- Asynchronous nature of the system (indicate with async/await annotations)
- Type system (generated types and their relationships)
- Event-driven architecture
- Separation between runtime and build-time (code generation) components

##### Additional Recommendations

- Notes about the asynchronous nature of the system
- Which components are user-facing vs internal
- Relationship with the external API service
- Version/compatibility information if relevant

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#b3d1ff,stroke:#333
    classDef codegen fill:#98FB98,stroke:#333
    classDef types fill:#FFE4B5,stroke:#333
    classDef external fill:#d3d3d3,stroke:#333
    
    %% External Service
    ExternalAPI[("External API Service")]:::external
    
    %% Application Layer
    subgraph AppLayer["Application Layer"]
        Bot["Bot Framework"]:::core
        Handler["Handler System"]:::core
        Filter["Filter System"]:::core
    end
    
    %% Business Logic Layer
    subgraph BusinessLayer["Business Logic Layer"]
        Action["Action System"]:::core
        EventSystem["Event System"]:::core
        EventContext["Event Context"]:::core
        EventWrapper["Event Wrapper"]:::core
        EventTypes["Event Types"]:::types
    end
    
    %% Communication Layer
    subgraph CommLayer["Communication Layer"]
        APIClient["API Client"]:::core
        ConnHandler["Connection Handler"]:::core
        RequestTypes["Request Types"]:::types
        ResponseTypes["Response Types"]:::types
        ObjectTypes["Object Types"]:::types
        Protocols["API Protocols"]:::types
    end
    
    %% Code Generation Layer
    subgraph CodegenLayer["Code Generation Layer"]
        APIReqGen{{"API Request Generator"}}:::codegen
        EventTypesGen{{"Event Types Generator"}}:::codegen
        ObjTypesGen{{"Object Types Generator"}}:::codegen
        RespTypesGen{{"Response Types Generator"}}:::codegen
    end
    
    %% Relationships
    Bot --> Handler
    Bot --> Filter
    Bot --> Action
    Bot --> EventSystem
    
    EventSystem --> EventContext
    EventSystem --> EventWrapper
    EventSystem --> EventTypes
    
    APIClient --> ConnHandler
    APIClient --> RequestTypes
    APIClient --> ResponseTypes
    APIClient --> Protocols
    ConnHandler --> ExternalAPI
    
    APIReqGen -.-> RequestTypes
    EventTypesGen -.-> EventTypes
    ObjTypesGen -.-> ObjectTypes
    RespTypesGen -.-> ResponseTypes
    
    %% Click Events
    click Bot "https://github.com/bulatovv/aiorise/blob/main/aiorise/bot/bot.py"
    click Handler "https://github.com/bulatovv/aiorise/blob/main/aiorise/handlers/handler.py"
    click Filter "https://github.com/bulatovv/aiorise/blob/main/aiorise/filters/filter.py"
    click Action "https://github.com/bulatovv/aiorise/blob/main/aiorise/actions/action.py"
    click EventSystem "https://github.com/bulatovv/aiorise/tree/main/aiorise/events"
    click EventContext "https://github.com/bulatovv/aiorise/blob/main/aiorise/events/event_context.py"
    click EventWrapper "https://github.com/bulatovv/aiorise/blob/main/aiorise/events/event_wrapper.py"
    click EventTypes "https://github.com/bulatovv/aiorise/blob/main/aiorise/events/event_types.py"
    click APIClient "https://github.com/bulatovv/aiorise/blob/main/aiorise/api/client.py"
    click ConnHandler "https://github.com/bulatovv/aiorise/blob/main/aiorise/connection/connection.py"
    click RequestTypes "https://github.com/bulatovv/aiorise/blob/main/aiorise/api/request_types.py"
    click ResponseTypes "https://github.com/bulatovv/aiorise/blob/main/aiorise/api/response_types.py"
    click ObjectTypes "https://github.com/bulatovv/aiorise/blob/main/aiorise/objects/object_types.py"
    click Protocols "https://github.com/bulatovv/aiorise/blob/main/aiorise/api/protocols.py"
    click APIReqGen "https://github.com/bulatovv/aiorise/blob/main/aiorise/codegen/generate_api_requests.py"
    click EventTypesGen "https://github.com/bulatovv/aiorise/blob/main/aiorise/codegen/generate_event_types.py"
    click ObjTypesGen "https://github.com/bulatovv/aiorise/blob/main/aiorise/codegen/generate_object_types.py"
    click RespTypesGen "https://github.com/bulatovv/aiorise/blob/main/aiorise/codegen/generate_response_types.py"
    
    %% Legend
    subgraph Legend
        CoreComp["Core Component"]:::core
        CodegenComp{{"Code Generation"}}:::codegen
        TypeDef["Type Definition"]:::types
        ExtService[("External Service")]:::external
    end
```
