# abd-wazzan/laravel-api-boilerplate architecture

> Architecture diagram of the GitHub repository abd-wazzan/laravel-api-boilerplate, 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/abd-wazzan/laravel-api-boilerplate
- Repository: https://github.com/abd-wazzan/laravel-api-boilerplate

## Overview

##### Main Components

a. Architectural Layers:
- Application Layer (src/app)
- Domain Layer (src/domain)
- Shared Layer (src/shared)
- Infrastructure Layer (represented by Laravel framework components)

b. Key Components:
- HTTP/API Interface
- Authentication (Passport)
- Database Layer
- External Services Integration
- Development Tools (Telescope, Scribe, etc.)

**[Client Applications] → [API Layer] → [Application Layer] → [Domain Layer] → [Infrastructure Layer]**
- ↓
- [Shared Layer]

**[API Layer]**
- Controllers
- Middleware
- Resources
- Routes

**[Application Layer]**
- Console Commands
- HTTP Handlers
- Service Providers
- Exception Handlers

**[Domain Layer]**
- Models
- Actions
- Events
- Listeners
- Business Logic

**[Shared Layer]**
- Helpers
- Traits
- Enums

##### Important Relationships to Highlight

- Dependency flow following DDD principles (as shown in the README's dependency illustration)
- API response flow using ApiResponseHelper
- Authentication flow with Passport
- Database interactions
- How the shared components are accessed by other layers

##### Implementation Details

Use these symbols:
- Rectangles for components/modules
- Diamonds for decision points (◇)

##### The development and testing tools integration

Remember to:
- Use consistent naming conventions
- Version information
- Document any assumptions or constraints

This structure will accurately represent the project's DDD architecture while maintaining clarity and providing valuable insight into the system's organization and flow.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        CA[Client Applications]
    end

    subgraph API_Layer
        API[HTTP/API Interface]:::api
        CONT[Controllers]:::api
        MID[Middleware]:::api
        AUTH[Authentication]:::security
        ROUTES["API Routes"]:::api
    end

    subgraph Application_Layer
        CMD[Console Commands]:::app
        HTTP[HTTP Handlers]:::app
        PROV[Service Providers]:::app
        EXC[Exception Handlers]:::app
        RESP[API Response Helper]:::app
        DOC[API Documentation]:::app
    end

    subgraph Domain_Layer
        MOD[Domain Models]:::domain
        ACT[Actions]:::domain
        EVT[Events]:::domain
        LST[Listeners]:::domain
        BL[Business Logic]:::domain
    end

    subgraph Shared_Layer
        HELP[Global Helpers]:::shared
        TRAIT[Traits]:::shared
        ENUM[Enums]:::shared
    end

    subgraph Infrastructure_Layer
        DB[(Database)]:::infra
        MIG[Migrations]:::infra
        SEED[Seeders]:::infra
        TEST[Testing Framework]:::infra
        TEL[Telescope]:::infra
        SCRB[Scribe]:::infra
    end

    %% Relationships
    CA --> API
    API --> CONT
    API --> MID
    API --> AUTH
    API --> ROUTES

    CONT --> HTTP
    MID --> HTTP
    HTTP --> RESP
    HTTP --> PROV
    HTTP --> EXC
    HTTP --> CMD

    HTTP --> MOD
    MOD --> ACT
    ACT --> EVT
    EVT --> LST
    ACT --> BL

    MOD --> DB
    MIG --> DB
    SEED --> DB

    %% Shared Layer Access
    MOD --> HELP
    MOD --> TRAIT
    MOD --> ENUM
    HTTP --> HELP
    HTTP --> TRAIT
    HTTP --> ENUM

    %% Development Tools
    DOC --> SCRB
    HTTP --> TEL
    HTTP --> TEST

    %% Click Events
    click API "https://github.com/abd-wazzan/laravel-api-boilerplate/tree/1.x/src/app/Http/"
    click CONT "https://github.com/abd-wazzan/laravel-api-boilerplate/tree/1.x/src/app/Http/Controllers/"
    click MID "https://github.com/abd-wazzan/laravel-api-boilerplate/tree/1.x/src/app/Http/Middleware/"
    click AUTH "https://github.com/abd-wazzan/laravel-api-boilerplate/blob/1.x/src/app/Http/Middleware/Authenticate.php"
    click ROUTES "https://github.com/abd-wazzan/laravel-api-boilerplate/blob/1.x/routes/api.php"
    click CMD "https://github.com/abd-wazzan/laravel-api-boilerplate/tree/1.x/src/app/Console/"
    click PROV "https://github.com/abd-wazzan/laravel-api-boilerplate/tree/1.x/src/app/Providers/"
    click EXC "https://github.com/abd-wazzan/laravel-api-boilerplate/tree/1.x/src/app/Exceptions/"
    click RESP "https://github.com/abd-wazzan/laravel-api-boilerplate/blob/1.x/src/app/Traits/ApiResponseHelper.php"
    click DOC "https://github.com/abd-wazzan/laravel-api-boilerplate/tree/1.x/src/app/Helpers/DocStrategies/"
    click MOD "https://github.com/abd-wazzan/laravel-api-boilerplate/tree/1.x/src/domain/Client/Models/"
    click HELP "https://github.com/abd-wazzan/laravel-api-boilerplate/blob/1.x/src/shared/Helpers/global.php"
    click ENUM "https://github.com/abd-wazzan/laravel-api-boilerplate/tree/1.x/src/shared/Enums/"
    click MIG "https://github.com/abd-wazzan/laravel-api-boilerplate/tree/1.x/database/migrations/"
    click SEED "https://github.com/abd-wazzan/laravel-api-boilerplate/tree/1.x/database/seeders/"
    click TEST "https://github.com/abd-wazzan/laravel-api-boilerplate/tree/1.x/tests/"

    %% Styling
    classDef api fill:#2196F3,stroke:#1565C0,color:white
    classDef app fill:#FFC107,stroke:#FFA000,color:black
    classDef domain fill:#4CAF50,stroke:#388E3C,color:white
    classDef shared fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef infra fill:#9E9E9E,stroke:#616161,color:white
    classDef security fill:#f44336,stroke:#c62828,color:white

    %% Legend
    subgraph Legend
        L1[API Components]:::api
        L2[Application Components]:::app
        L3[Domain Components]:::domain
        L4[Shared Components]:::shared
        L5[Infrastructure Components]:::infra
        L6[Security Components]:::security
    end
```
