# aironou/ebanx-software-engineer-take-home-assignment architecture

> Architecture diagram of the GitHub repository aironou/ebanx-software-engineer-take-home-assignment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aironou/ebanx-software-engineer-take-home-assignment
- Repository: https://github.com/aironou/ebanx-software-engineer-take-home-assignment

## Overview

##### Main System Components

a) API Layer
- Controllers (AccountController, ResetController, TransactionController)
- Exception Handlers (ExceptionListener)
- Request/Response Serialization (TransactionSerializer)

b) Business Logic Layer
- Services
- AccountService
- BalanceService
- TransactionService
- AbstractEntityService (base service layer)

c) Data Layer
- Entities (Account, Transaction)
- Repositories (TransactionRepository)
- Doctrine ORM Integration
- Database (likely MySQL/PostgreSQL based on Doctrine configuration)

d) Infrastructure
- Docker Containers
- PHP Application Container
- Database Container (implied by docker-compose.yml)
- Symfony Framework Components

**┌─────────────────────────────────────┐**
- API Layer                │
- (Controllers, Exception Handlers)   │
- ┤
- Service Layer               │
- (Account, Balance, Transaction)     │
- ┤
- Data Layer                 │
- (Entities, Repositories, Database)  │
- ┤
- Infrastructure Layer           │
- (Docker, Symfony, Configuration)    │
- ┘

##### Component Relationships to Highlight

- HTTP requests flowing into Controllers
- Controller dependencies on Services
- Service interactions with Repositories
- Entity relationships (Account to Transaction)
- Exception handling flow
- Demonstrate Docker container isolation

##### Specific Implementation Details

a) API Layer:
- Endpoints for account operations
- Transaction processing flow
- Reset functionality
- Exception handling paths

b) Service Layer:
- AbstractEntityService inheritance
- Service interdependencies
- Balance calculation flow

c) Data Layer:
- Entity relationships
- Doctrine event listeners
- Repository query patterns

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph API
        HTTP[HTTP Requests]
        AC[AccountController]:::controller
        TC[TransactionController]:::controller
        RC[ResetController]:::controller
        EL[ExceptionListener]:::exception
        TS[TransactionSerializer]:::serializer
    end

    subgraph Services
        AES[AbstractEntityService]:::service
        AS[AccountService]:::service
        BS[BalanceService]:::service
        TRS[TransactionService]:::service
    end

    subgraph Data
        EI[EntityInterface]:::interface
        ESI[EntityServiceInterface]:::interface
        AE[Account Entity]:::entity
        TE[Transaction Entity]:::entity
        TR[TransactionRepository]:::repository
        DL[DoctrineListener]:::listener
    end

    subgraph Infrastructure
        DC[Docker Containers]:::infra
        DB[(Database)]:::database
        SF[Symfony Framework]:::infra
        DConfig[Doctrine Config]:::config
    end

    %% Relationships
    HTTP --> AC & TC & RC
    AC & TC & RC --> EL
    TC --> TS
    
    AC --> AS
    TC --> TRS
    RC --> AS & TRS
    
    AS & TRS & BS --> AES
    
    AS --> AE
    TRS --> TE
    BS --> AE & TE
    
    AE & TE --> EI
    AS & TRS --> ESI
    
    TE --> TR
    TR --> DB
    DL --> DB
    
    AE --> TE
    
    SF --> DC
    DC --> DB
    DConfig --> DB

    %% Click Events
    click AC "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Controller/AccountController.php"
    click TC "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Controller/TransactionController.php"
    click RC "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Controller/ResetController.php"
    click EL "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Listener/ExceptionListener.php"
    click TS "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Serializer/TransactionSerializer.php"
    click AES "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Service/AbstractEntityService.php"
    click AS "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Service/AccountService.php"
    click BS "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Service/BalanceService.php"
    click TRS "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Service/TransactionService.php"
    click EI "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Interfaces/EntityInterface.php"
    click ESI "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Interfaces/EntityServiceInterface.php"
    click AE "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Entity/Account.php"
    click TE "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Entity/Transaction.php"
    click TR "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Repository/TransactionRepository.php"
    click DL "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/src/Listener/DoctrineListener.php"
    click DC "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/tree/main/docker/php/Dockerfile"
    click DConfig "https://github.com/aironou/ebanx-software-engineer-take-home-assignment/blob/main/config/packages/doctrine.yaml"

    %% Styling
    classDef controller fill:#2196F3,stroke:#1565C0,color:white
    classDef service fill:#4CAF50,stroke:#2E7D32,color:white
    classDef entity fill:#FFC107,stroke:#FFA000,color:black
    classDef repository fill:#FF9800,stroke:#F57C00,color:white
    classDef exception fill:#F44336,stroke:#C62828,color:white
    classDef serializer fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef interface fill:#00BCD4,stroke:#00838F,color:white
    classDef listener fill:#795548,stroke:#4E342E,color:white
    classDef infra fill:#9E9E9E,stroke:#424242,color:white
    classDef database fill:#607D8B,stroke:#37474F,color:white
    classDef config fill:#3F51B5,stroke:#283593,color:white
```
