Skip to content

Architecture

lpachecob edited this page Mar 23, 2026 · 4 revisions

🏛️ Architecture: Pure DDD

In BOUNDLY, the framework is an implementation detail. The architecture follows the Clean/Hexagonal/DDD patterns, where the business domain is the core.


🌳 Directory Structure

🧠 Application/ (Use Cases)

Where your Actions live. These orchestrate the flow:

  • Actions/: Classes decorated with #[Action].
  • DTOs/: Inputs for your Actions.
  • Tests/: Integration tests for specific application features.

❤️ Domain/ (The Business)

The logic that would survive even if you change the framework:

  • Entities/: Classes decorated with #[Entity].
  • Events/: Domain events for side effects.
  • ValueObjects/: Immutable data objects.
  • Tests/: Pure unit tests for your business rules. (e.g., UserApiTest.php in Domain/Users/Tests/).

💎 Boilerplate Examples

The repository includes a ready-to-use User boilerplate to demonstrate the full architectural flow:

  • Domain: A clean User entity with Auditable and SoftDelete traits.
  • Application: A CreateUser Action demonstrates delegating to the DynamicRepository using a UserDTO.
  • Infrastructure: Automations for DB synchronization are already active for these examples.

🏚️ Infrastructure/ (Adapters)

Where the technical heavy lifting - and the "basement" - live:

  • FrameworkCore/: The BOUNDLY Engine (Registries, CLI, Dynamic Repos).
  • LaravelEngine/: The Basement. Contains Laravel internally (config, storage, database, etc.) to keep your root clean.
  • Providers/: Framework wiring.

🛠️ Entry Points

File Purpose
artisan CLI tool. Redirigido al sótano por defecto.
bootstrap/app.php The Ignitor. Connects BOUNDLY's clean root with Laravel's basement.
public/index.php Web entry point. Handles requests by booting the basement.

🧬 Why this structure?

  1. Screaming Architecture: When you open the project, it screams "Users", "Orders", "Products" (Domain), not "Models", "Views", "Controllers" (Framework).
  2. Encapsulation: The framework is hidden. If you ever need to replace Laravel, you only touch the basement.
  3. Purity: Zero framework dependencies in your Domain layer.

Next Step: CLI-Commands 🚀

Clone this wiki locally