# divineninja/lara-clean architecture

> Architecture diagram of the GitHub repository divineninja/lara-clean, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/divineninja/lara-clean
- Repository: https://github.com/divineninja/lara-clean

## Overview

LaraClean is a Laravel package for scaffolding domain-oriented application code. The main workflow starts with an Artisan user running `make:domain`; that command delegates model, DTO, and migration generation to the package’s other commands. Those commands render package stubs into the application’s domain directories. Users can also invoke each generator separately. The service provider registers the commands and loads migrations from existing domain directories. The README documents these capabilities; the migration-loading relationship is visible in the provider, while generated application files are represented conceptually.

Main entry points: [`src/LaraCleanServiceProvider.php`](https://github.com/divineninja/lara-clean/blob/main/src/LaraCleanServiceProvider.php) (Service Provider), [`src/Console/Commands/MakeDomain.php`](https://github.com/divineninja/lara-clean/blob/main/src/Console/Commands/MakeDomain.php) (Domain Generator), [`src/Console/Commands/MakeDomainModel.php`](https://github.com/divineninja/lara-clean/blob/main/src/Console/Commands/MakeDomainModel.php) (Model Generator), [`src/Console/Commands/MakeDomainDto.php`](https://github.com/divineninja/lara-clean/blob/main/src/Console/Commands/MakeDomainDto.php) (DTO Generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Laravel Integration"]
  node_provider["Service Provider"]
end

subgraph group_scaffold["Domain Scaffolding"]
  node_domain_command["Domain Generator<br/>[MakeDomain.php]"]
  node_model_command["Model Generator"]
  node_dto_command["DTO Generator<br/>[MakeDomainDto.php]"]
  node_migration_command["Migration Generator"]
  node_domain_files["Generated Domain Files"]
end

subgraph group_templates["Generation Templates"]
  node_model_stub["Model Template<br/>[model.stub]"]
  node_dto_stub["DTO Template<br/>[dto.stub]"]
  node_migration_stub["Migration Template<br/>[migration.stub]"]
end

node_artisan(("Artisan User"))
node_migration_runtime["Laravel Migrations"]
node_class_generator["Laravel Class Generator"]

node_artisan -->|"loads package"| node_provider
node_provider -->|"registers commands"| node_domain_command
node_provider -->|"registers commands"| node_model_command
node_provider -->|"registers commands"| node_dto_command
node_provider -->|"registers commands"| node_migration_command
node_artisan -->|"runs command"| node_domain_command
node_domain_command -->|"calls generator"| node_model_command
node_domain_command -->|"calls generator"| node_dto_command
node_domain_command -->|"calls generator"| node_migration_command
node_domain_command -->|"calls make:class"| node_class_generator
node_model_command -->|"reads template"| node_model_stub
node_dto_command -->|"reads template"| node_dto_stub
node_migration_command -->|"reads template"| node_migration_stub
node_model_command -->|"writes model"| node_domain_files
node_dto_command -->|"writes DTO"| node_domain_files
node_migration_command -->|"writes migration"| node_domain_files
node_provider -->|"loads domain migrations"| node_migration_runtime

click node_provider "https://github.com/divineninja/lara-clean/blob/main/src/LaraCleanServiceProvider.php"
click node_domain_command "https://github.com/divineninja/lara-clean/blob/main/src/Console/Commands/MakeDomain.php"
click node_model_command "https://github.com/divineninja/lara-clean/blob/main/src/Console/Commands/MakeDomainModel.php"
click node_dto_command "https://github.com/divineninja/lara-clean/blob/main/src/Console/Commands/MakeDomainDto.php"
click node_migration_command "https://github.com/divineninja/lara-clean/blob/main/src/Console/Commands/MakeDomainMigration.php"
click node_model_stub "https://github.com/divineninja/lara-clean/blob/main/src/stubs/model.stub"
click node_dto_stub "https://github.com/divineninja/lara-clean/blob/main/src/stubs/dto.stub"
click node_migration_stub "https://github.com/divineninja/lara-clean/blob/main/src/stubs/migration.stub"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_provider,node_artisan toneBlue
class node_domain_command,node_model_command,node_dto_command,node_migration_command,node_domain_files toneAmber
class node_model_stub,node_dto_stub,node_migration_stub toneMint
class node_migration_runtime,node_class_generator toneIndigo
```

## Components

### Laravel Integration

- [Service Provider](https://github.com/divineninja/lara-clean/blob/main/src/LaraCleanServiceProvider.php): `src/LaraCleanServiceProvider.php`

### Domain Scaffolding

- [Domain Generator](https://github.com/divineninja/lara-clean/blob/main/src/Console/Commands/MakeDomain.php): `src/Console/Commands/MakeDomain.php`
- [Model Generator](https://github.com/divineninja/lara-clean/blob/main/src/Console/Commands/MakeDomainModel.php): `src/Console/Commands/MakeDomainModel.php`
- [DTO Generator](https://github.com/divineninja/lara-clean/blob/main/src/Console/Commands/MakeDomainDto.php): `src/Console/Commands/MakeDomainDto.php`
- [Migration Generator](https://github.com/divineninja/lara-clean/blob/main/src/Console/Commands/MakeDomainMigration.php): `src/Console/Commands/MakeDomainMigration.php`
- **Generated Domain Files**

### Generation Templates

- [Model Template](https://github.com/divineninja/lara-clean/blob/main/src/stubs/model.stub): `src/stubs/model.stub`
- [DTO Template](https://github.com/divineninja/lara-clean/blob/main/src/stubs/dto.stub): `src/stubs/dto.stub`
- [Migration Template](https://github.com/divineninja/lara-clean/blob/main/src/stubs/migration.stub): `src/stubs/migration.stub`

### Other components

- **Artisan User**
- **Laravel Migrations**
- **Laravel Class Generator**

## Connections

- Artisan User → Service Provider: loads package
- Service Provider → Domain Generator: registers commands (evidence: `src/LaraCleanServiceProvider.php`)
- Service Provider → Model Generator: registers commands (evidence: `src/LaraCleanServiceProvider.php`)
- Service Provider → DTO Generator: registers commands (evidence: `src/LaraCleanServiceProvider.php`)
- Service Provider → Migration Generator: registers commands (evidence: `src/LaraCleanServiceProvider.php`)
- Artisan User → Domain Generator: runs command (evidence: `Readme.md`)
- Domain Generator → Model Generator: calls generator (evidence: `src/Console/Commands/MakeDomain.php`)
- Domain Generator → DTO Generator: calls generator (evidence: `src/Console/Commands/MakeDomain.php`)
- Domain Generator → Migration Generator: calls generator (evidence: `src/Console/Commands/MakeDomain.php`)
- Domain Generator → Laravel Class Generator: calls make:class (evidence: `src/Console/Commands/MakeDomain.php`)
- Model Generator → Model Template: reads template (evidence: `src/Console/Commands/MakeDomainModel.php`)
- DTO Generator → DTO Template: reads template (evidence: `src/Console/Commands/MakeDomainDto.php`)
- Migration Generator → Migration Template: reads template (evidence: `src/Console/Commands/MakeDomainMigration.php`)
- Model Generator → Generated Domain Files: writes model (evidence: `src/Console/Commands/MakeDomainModel.php`)
- DTO Generator → Generated Domain Files: writes DTO (evidence: `src/Console/Commands/MakeDomainDto.php`)
- Migration Generator → Generated Domain Files: writes migration (evidence: `src/Console/Commands/MakeDomainMigration.php`)
- Service Provider → Laravel Migrations: loads domain migrations (evidence: `src/LaraCleanServiceProvider.php`)
