# blumilksoftware/toby architecture

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

## Overview

##### Main System Components

a) Frontend Layer:
- Vue.js based SPA (evident from /resources/js structure)
- Inertia.js for frontend-backend communication
- Key frontend modules:
- Dashboard
- Vacation Management
- Benefits Management
- Equipment Management
- User Management

b) Backend Layer:
- Laravel PHP Framework
- Key backend modules:
- Authentication & Authorization
- API Controllers
- Domain Services
- Action Classes
- State Management
- Notification System

c) External Integrations:
- Slack Integration (extensive /app/Slack directory)
- Google Calendar Integration
- Email Services

d) Storage:
- PostgreSQL Database
- File Storage (for resumes, avatars)

##### Architectural Patterns to Highlight

a) Domain-Driven Design elements:
- Actions pattern (/app/Actions)
- Domain Services (/app/Domain)
- State Pattern for requests (/app/States)

b) Service Layer:
- Clear separation of concerns
- Dedicated services for different business functions

##### Key Workflows

Flow for core features:
- Vacation Request Processing
- Overtime Request Management
- Benefits Management
- Daily Summary Generation
- Notification Distribution

**┌─────────────────────────────────────────────────────┐**
- Client Layer                       │
- (Vue.js Components, Inertia, Frontend Resources)    │
- ┤
- API Layer                          │
- (Controllers, Resources, Requests)                  │
- ┤
- Domain Layer                        │
- (Actions, Domain Services, State Management)        │
- ┤
- Integration Layer                     │
- (Slack, Google Calendar, Email Services)           │
- ┤
- Persistence Layer                     │
- (Database, File Storage)                           │
- ┘

##### Deployment Architecture

Show:
- Docker containerization
- Development vs Production environments
- Database backup system
- Queue worker processes

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        FE[Frontend SPA]:::frontend
        DASH[Dashboard]:::frontend
        VAC_UI[Vacation Management UI]:::frontend
        BEN_UI[Benefits Management UI]:::frontend
        EQ_UI[Equipment Management UI]:::frontend
        USER_UI[User Management UI]:::frontend
        
        FE --> DASH
        FE --> VAC_UI
        FE --> BEN_UI
        FE --> EQ_UI
        FE --> USER_UI
    end

    subgraph API
        API_CTRL[API Controllers]:::api
        AUTH[Authentication]:::api
        VAC_CTRL[Vacation Controller]:::api
        BEN_CTRL[Benefits Controller]:::api
        EQ_CTRL[Equipment Controller]:::api
        GOOGLE_CTRL[Google Controller]:::api
    end

    subgraph Domain
        DOM_SERV[Domain Services]:::domain
        STATE_MGT[State Management]:::domain
        VAC_ACT[Vacation Actions]:::domain
        BEN_SERV[Benefits Service]:::domain
        EQ_SERV[Equipment Service]:::domain
        NOTIF[Notification System]:::domain
    end

    subgraph Integrations
        SLACK[Slack Integration]:::integration
        GCAL[Google Calendar]:::integration
        EMAIL[Email Services]:::integration
    end

    subgraph Storage
        DB[(PostgreSQL)]:::storage
        FILES[File Storage]:::storage
    end

    %% Client to API Connections
    DASH --> API_CTRL
    VAC_UI --> VAC_CTRL
    BEN_UI --> BEN_CTRL
    EQ_UI --> EQ_CTRL
    USER_UI --> AUTH

    %% API to Domain Connections
    API_CTRL --> DOM_SERV
    VAC_CTRL --> VAC_ACT
    VAC_CTRL --> STATE_MGT
    BEN_CTRL --> BEN_SERV
    EQ_CTRL --> EQ_SERV
    
    %% Domain to Integration Connections
    DOM_SERV --> NOTIF
    VAC_ACT --> SLACK
    VAC_ACT --> GCAL
    NOTIF --> EMAIL
    NOTIF --> SLACK

    %% Storage Connections
    DOM_SERV --> DB
    VAC_ACT --> DB
    BEN_SERV --> DB
    EQ_SERV --> DB
    USER_UI --> FILES

    %% Click Events
    click FE "https://github.com/blumilksoftware/toby/tree/main/resources/js/Pages"
    click API_CTRL "https://github.com/blumilksoftware/toby/tree/main/app/Http/Controllers/Api"
    click DOM_SERV "https://github.com/blumilksoftware/toby/tree/main/app/Domain"
    click STATE_MGT "https://github.com/blumilksoftware/toby/tree/main/app/States"
    click SLACK "https://github.com/blumilksoftware/toby/tree/main/app/Slack"
    click NOTIF "https://github.com/blumilksoftware/toby/tree/main/app/Notifications"
    click AUTH "https://github.com/blumilksoftware/toby/blob/main/app/Http/Controllers/LoginController.php"
    click VAC_CTRL "https://github.com/blumilksoftware/toby/blob/main/app/Http/Controllers/VacationRequestController.php"
    click VAC_ACT "https://github.com/blumilksoftware/toby/tree/main/app/Actions/VacationRequest"
    click BEN_CTRL "https://github.com/blumilksoftware/toby/blob/main/app/Http/Controllers/BenefitController.php"
    click EQ_CTRL "https://github.com/blumilksoftware/toby/blob/main/app/Http/Controllers/EquipmentController.php"
    click GOOGLE_CTRL "https://github.com/blumilksoftware/toby/blob/main/app/Http/Controllers/GoogleController.php"
    click EMAIL "https://github.com/blumilksoftware/toby/tree/main/app/Notifications"

    %% Styles
    classDef frontend fill:#2196F3,color:white
    classDef api fill:#4CAF50,color:white
    classDef domain fill:#FF9800,color:white
    classDef integration fill:#9C27B0,color:white
    classDef storage fill:#607D8B,color:white

    %% Legend
    subgraph Legend
        L_FE[Frontend]:::frontend
        L_API[API]:::api
        L_DOM[Domain]:::domain
        L_INT[Integration]:::integration
        L_ST[Storage]:::storage
    end
```
