# summiya/mortgage-calculator architecture

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

- Interactive diagram: https://gitdiagram.com/summiya/mortgage-calculator
- Repository: https://github.com/summiya/mortgage-calculator

## Overview

##### Main Components Identification

a) Client Layer
- Web Browser
- API Clients

b) Application Layer
- HTTP Layer (Routes, Controllers, Middleware)
- Business Logic Layer (Services, Models)
- Authentication System
- Broadcasting System
- Queue System

c) Infrastructure Layer
- Database
- Cache
- File Storage
- Queue Workers
- Broadcasting Server

##### Additional Details

- Middleware pipeline sequence
- Service provider bootstrap process
- Database migration system
- Testing environment

##### Notes Section

Notes describing:
- Environment configuration
- Security measures
- Scaling considerations
- Development vs Production differences

Remember to emphasize the modular nature of Laravel and how components can be swapped out (different cache drivers, queue systems, etc.) using the facade pattern and service providers.

This will provide a comprehensive view of the application's architecture while maintaining clarity and usefulness for both high-level understanding and detailed implementation references.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Layer"]
        Browser["Web Browser"]:::client
        APIClient["API Clients"]:::client
    end

    subgraph Laravel["Laravel Application"]
        Entry["Entry Point"]:::core
        click Entry "https://github.com/summiya/mortgage-calculator/blob/master/public/index.php"
        
        Bootstrap["Application Bootstrap"]:::core
        click Bootstrap "https://github.com/summiya/mortgage-calculator/blob/master/bootstrap/app.php"
        
        subgraph HTTP["HTTP Layer"]
            Kernel["HTTP Kernel"]:::http
            click Kernel "https://github.com/summiya/mortgage-calculator/blob/master/app/Http/Kernel.php"
            
            Routes["Routes (web/api)"]:::http
            click Routes "https://github.com/summiya/mortgage-calculator/blob/master/routes/web.php"
            
            Controllers["Controllers"]:::http
            click Controllers "https://github.com/summiya/mortgage-calculator/tree/master/app/Http/Controllers/"
            
            Middleware["Middleware"]:::http
            click Middleware "https://github.com/summiya/mortgage-calculator/tree/master/app/Http/Middleware/"
        end
        
        subgraph Business["Business Logic Layer"]
            Models["Models"]:::business
            click Models "https://github.com/summiya/mortgage-calculator/tree/master/app/Models/"
            
            Migrations["Database Migrations"]:::business
            click Migrations "https://github.com/summiya/mortgage-calculator/tree/master/database/migrations/"
            
            Factories["Database Factories"]:::business
            click Factories "https://github.com/summiya/mortgage-calculator/tree/master/database/factories/"
        end
        
        subgraph Providers["Service Providers"]
            MainProviders["Main Providers"]:::provider
            click MainProviders "https://github.com/summiya/mortgage-calculator/tree/master/app/Providers/"
            
            BroadcastProvider["Broadcast Provider"]:::provider
            click BroadcastProvider "https://github.com/summiya/mortgage-calculator/blob/master/app/Providers/BroadcastServiceProvider.php"
            
            AuthProvider["Auth Provider"]:::provider
            click AuthProvider "https://github.com/summiya/mortgage-calculator/blob/master/app/Providers/AuthServiceProvider.php"
            
            RouteProvider["Route Provider"]:::provider
            click RouteProvider "https://github.com/summiya/mortgage-calculator/blob/master/app/Providers/RouteServiceProvider.php"
        end
        
        subgraph Console["Console System"]
            ConsoleKernel["Console Kernel"]:::console
            click ConsoleKernel "https://github.com/summiya/mortgage-calculator/blob/master/app/Console/Kernel.php"
            
            ConsoleRoutes["Console Routes"]:::console
            click ConsoleRoutes "https://github.com/summiya/mortgage-calculator/blob/master/routes/console.php"
        end
        
        ExceptionHandler["Exception Handler"]:::error
        click ExceptionHandler "https://github.com/summiya/mortgage-calculator/blob/master/app/Exceptions/Handler.php"
    end

    subgraph Infrastructure["Infrastructure Layer"]
        subgraph Storage["Storage Systems"]
            FileStorage["File Storage"]:::storage
            click FileStorage "https://github.com/summiya/mortgage-calculator/tree/master/storage/app/"
            
            CacheStorage["Cache Storage"]:::storage
            click CacheStorage "https://github.com/summiya/mortgage-calculator/tree/master/storage/framework/cache/"
            
            SessionStorage["Session Storage"]:::storage
            click SessionStorage "https://github.com/summiya/mortgage-calculator/tree/master/storage/framework/sessions/"
            
            ViewCache["View Cache"]:::storage
            click ViewCache "https://github.com/summiya/mortgage-calculator/tree/master/storage/framework/views/"
        end
        
        subgraph Config["Configuration"]
            DBConfig["Database Config"]:::config
            click DBConfig "https://github.com/summiya/mortgage-calculator/blob/master/config/database.php"
            
            QueueConfig["Queue Config"]:::config
            click QueueConfig "https://github.com/summiya/mortgage-calculator/blob/master/config/queue.php"
            
            BroadcastConfig["Broadcasting Config"]:::config
            click BroadcastConfig "https://github.com/summiya/mortgage-calculator/blob/master/config/broadcasting.php"
            
            FSConfig["File Systems Config"]:::config
            click FSConfig "https://github.com/summiya/mortgage-calculator/blob/master/config/filesystems.php"
        end
        
        Database[(Database)]:::infrastructure
        Cache[(Cache)]:::infrastructure
        Queue[(Queue System)]:::infrastructure
        Broadcast[("Broadcasting Server")]:::infrastructure
    end

    %% Connections
    Browser & APIClient --> Entry
    Entry --> Bootstrap
    Bootstrap --> Kernel
    Kernel --> Middleware
    Middleware --> Routes
    Routes --> Controllers
    Controllers --> Models
    Models --> Database
    
    Controllers -.-> Cache
    Controllers -.-> Queue
    Controllers -.-> Broadcast
    
    Models --> FileStorage
    Cache --> CacheStorage
    
    %% Styles
    classDef client fill:#gray
    classDef core fill:#blue
    classDef http fill:#lightblue
    classDef business fill:#green
    classDef provider fill:#purple
    classDef console fill:#yellow
    classDef error fill:#red
    classDef storage fill:#orange
    classDef config fill:#pink
    classDef infrastructure fill:#lightgreen

    %% Legend
    subgraph Legend
        Client_["Client Component"]:::client
        Core_["Core Component"]:::core
        HTTP_["HTTP Component"]:::http
        Business_["Business Logic"]:::business
        Provider_["Service Provider"]:::provider
        Console_["Console Component"]:::console
        Error_["Error Handling"]:::error
        Storage_["Storage Component"]:::storage
        Config_["Configuration"]:::config
        Infra_["Infrastructure"]:::infrastructure
    end
```
