# quantumba/pyverless architecture

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

- Interactive diagram: https://gitdiagram.com/quantumba/pyverless
- Repository: https://github.com/quantumba/pyverless

## Overview

##### Main Components

a. Core Framework Components:
- Handler System (Central component)
- Authentication System
- Serialization Layer
- Configuration Management
- Event Processing System
- API Gateway Integration

b. External Systems:
- AWS Lambda
- AWS API Gateway
- AWS S3
- AWS SQS

##### Detailed Component Breakdown

**┌─────────────────────────────────────┐**
- Handler System            │

- ┌──────────┐  ┌────────────────┐  │
- Base      │  │CRUD Handlers   │  │
- Handler   │──│- CreateHandler │  │
- ┘  │- RetrieveHandler│ │
- UpdateHandler  │  │
- DeleteHandler  │  │
- ListHandler    │  │
- ┘  │

- ┌──────────────────┐              │
- Mixins           │              │
- RequestBody    │              │
- Authorization  │              │
- S3File         │              │
- SQSMessages    │              │
- ┘              │
- ┘

##### Supporting Systems

- Serialization System
- Input Serializers
- Custom Serializers
- Configuration Management
- Settings
- Environment Config
- Authentication System
- JWT Handling
- Crypto Operations

##### Key Elements to Highlight

- Event Flow: Show how requests flow from API Gateway through the handler system
- Authentication Flow: Illustrate how auth requests are processed
- Data Serialization: Show how data transforms through the system
- AWS Service Integration: Demonstrate connections to various AWS services

##### Notes for Implementation

- Maintain consistent spacing and alignment
- Clear labels for all components
- Brief descriptions for complex interactions

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph AWS["AWS Services"]
        APIG["API Gateway"]
        Lambda["AWS Lambda"]
        S3["AWS S3"]
        SQS["AWS SQS"]
    end

    subgraph Core["Core Framework"]
        HS["Handler System"]:::core
        click HS "https://github.com/QuantumBA/pyverless/blob/master/pyverless/handlers.py"
        
        AGH["API Gateway Handler"]:::core
        click AGH "https://github.com/QuantumBA/pyverless/blob/master/pyverless/api_gateway_handler/api_gateway_handler.py"
        
        EH["Event Handler"]:::core
        click EH "https://github.com/QuantumBA/pyverless/blob/master/pyverless/events_handler/events_handler.py"
        
        Auth["Authentication System"]:::auth
        click Auth "https://github.com/QuantumBA/pyverless/blob/master/pyverless/auth.py"
        
        Crypto["Crypto Operations"]:::auth
        click Crypto "https://github.com/QuantumBA/pyverless/blob/master/pyverless/crypto.py"
        
        Config["Configuration Management"]:::config
        click Config "https://github.com/QuantumBA/pyverless/blob/master/pyverless/config/base_settings.py"
        
        Models["Data Models"]:::data
        click Models "https://github.com/QuantumBA/pyverless/blob/master/pyverless/models.py"
        
        Except["Exception Handler"]:::util
        click Except "https://github.com/QuantumBA/pyverless/blob/master/pyverless/exceptions.py"
        
        Log["Logging System"]:::util
        click Log "https://github.com/QuantumBA/pyverless/blob/master/pyverless/utils/logging.py"
        
        Dec["Decorator System"]:::util
        click Dec "https://github.com/QuantumBA/pyverless/blob/master/pyverless/decorators.py"
        
        subgraph Serial["Serialization Layer"]
            IS["Input Serializer"]:::serial
            click IS "https://github.com/QuantumBA/pyverless/blob/master/pyverless/serialization/input_serializer.py"
            CS["Custom Serializers"]:::serial
            click CS "https://github.com/QuantumBA/pyverless/blob/master/pyverless/serializers.py"
        end
        
        subgraph Handlers["Handler Components"]
            BH["Base Handler"]:::handler
            CH["Create Handler"]:::handler
            RH["Retrieve Handler"]:::handler
            UH["Update Handler"]:::handler
            DH["Delete Handler"]:::handler
            LH["List Handler"]:::handler
            
            subgraph Mix["Mixins"]
                RBM["RequestBody Mixin"]:::mixin
                AM["Authorization Mixin"]:::mixin
                S3M["S3File Mixin"]:::mixin
                SQSM["SQSMessages Mixin"]:::mixin
            end
        end
    end

    %% Connections
    APIG --> AGH
    AGH --> HS
    HS --> BH
    BH --> CH & RH & UH & DH & LH
    Auth --> Crypto
    HS --> Auth
    HS --> Serial
    HS --> Config
    HS --> Models
    HS --> Except
    HS --> Log
    HS --> Dec
    
    %% Mixin Connections
    RBM --> BH
    AM --> BH
    S3M --> BH
    SQSM --> BH
    
    %% AWS Service Connections
    S3M --> S3
    SQSM --> SQS
    Lambda --> EH
    EH --> HS

    %% Styles
    classDef core fill:#2374ab
    classDef auth fill:#ff7f50
    classDef config fill:#48a9a6
    classDef data fill:#4caf50
    classDef util fill:#9c27b0
    classDef serial fill:#ff9800
    classDef handler fill:#3f51b5
    classDef mixin fill:#e91e63
    classDef aws fill:#ff9900

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Authentication"]:::auth
        L3["Configuration"]:::config
        L4["Data Layer"]:::data
        L5["Utilities"]:::util
        L6["Serialization"]:::serial
        L7["Handlers"]:::handler
        L8["Mixins"]:::mixin
        L9["AWS Services"]:::aws
    end
```
