|
| 1 | +--- |
| 2 | +title: Architecture |
| 3 | +--- |
| 4 | + |
| 5 | +# Architecture |
| 6 | + |
| 7 | +`bITdevKit` is designed around clean architecture with modular vertical slices. The goal is to keep |
| 8 | +business logic explicit, testable, and isolated from infrastructure choices. |
| 9 | + |
| 10 | +## High-level architecture map |
| 11 | + |
| 12 | +```mermaid |
| 13 | +flowchart TB |
| 14 | + Presentation[Presentation] |
| 15 | + Infrastructure[Infrastructure] |
| 16 | + Application[Application] |
| 17 | + Domain[Domain] |
| 18 | +
|
| 19 | + Presentation --> Application |
| 20 | + Infrastructure --> Application |
| 21 | + Infrastructure --> Domain |
| 22 | + Application --> Domain |
| 23 | +``` |
| 24 | + |
| 25 | +## Layer responsibilities |
| 26 | + |
| 27 | +### Domain |
| 28 | + |
| 29 | +- aggregates, entities, value objects, typed ids |
| 30 | +- domain events, domain policies, and business rules |
| 31 | +- no dependency on outer layers |
| 32 | + |
| 33 | +### Application |
| 34 | + |
| 35 | +- commands, queries, handlers, DTOs, specifications |
| 36 | +- orchestration through requester/notifier flows |
| 37 | +- depends on domain, not on infrastructure |
| 38 | + |
| 39 | +### Infrastructure |
| 40 | + |
| 41 | +- persistence, messaging transports, queue brokers, storage providers |
| 42 | +- implements abstractions required by inner layers |
| 43 | +- contains integration details and operational mechanics |
| 44 | + |
| 45 | +### Presentation |
| 46 | + |
| 47 | +- minimal API endpoints, web-facing modules, console-facing features |
| 48 | +- request/response mapping and endpoint composition |
| 49 | + |
| 50 | +## Modular vertical slices |
| 51 | + |
| 52 | +The preferred shape is a modular monolith where each module owns its own domain, application, |
| 53 | +infrastructure, and presentation concerns. |
| 54 | + |
| 55 | +```text |
| 56 | +Module/ |
| 57 | +├── Module.Domain |
| 58 | +├── Module.Application |
| 59 | +├── Module.Infrastructure |
| 60 | +└── Module.Presentation |
| 61 | +``` |
| 62 | + |
| 63 | +This keeps business capabilities cohesive while still allowing a single host application to compose |
| 64 | +many modules together. |
| 65 | + |
| 66 | +## Request flow in practice |
| 67 | + |
| 68 | +```mermaid |
| 69 | +sequenceDiagram |
| 70 | + participant Client |
| 71 | + participant Endpoint as Presentation Endpoint |
| 72 | + participant Requester as IRequester |
| 73 | + participant Handler as Application Handler |
| 74 | + participant Domain as Aggregate |
| 75 | + participant Repository as Repository / Provider |
| 76 | +
|
| 77 | + Client->>Endpoint: HTTP request |
| 78 | + Endpoint->>Requester: SendAsync(command/query) |
| 79 | + Requester->>Handler: Dispatch through behaviors |
| 80 | + Handler->>Domain: Execute business logic |
| 81 | + Handler->>Repository: Persist or query |
| 82 | + Repository-->>Handler: Result |
| 83 | + Handler-->>Requester: Result |
| 84 | + Requester-->>Endpoint: Result |
| 85 | + Endpoint-->>Client: HTTP response |
| 86 | +``` |
| 87 | + |
| 88 | +## Architectural building blocks that matter most |
| 89 | + |
| 90 | +- [DDD Introduction](reference/introduction-ddd-guide.md) |
| 91 | +- [Domain](reference/features-domain.md) |
| 92 | +- [Application Commands and Queries](reference/features-application-commands-queries.md) |
| 93 | +- [Requester and Notifier](reference/features-requester-notifier.md) |
| 94 | +- [Modules](reference/features-modules.md) |
| 95 | +- [Presentation Endpoints](reference/features-presentation-endpoints.md) |
| 96 | + |
| 97 | +## Related decisions |
| 98 | + |
| 99 | +- [Messaging vs Queueing](decisions-messaging-vs-queueing.md) |
| 100 | +- [Repository vs ActiveEntity](decisions-repository-vs-activeentity.md) |
0 commit comments