Package Diagram

Visualize namespace organization, layered architecture boundaries, and import/merge dependencies across modules.

Open in Live Sandbox ↗
Sandbox ↗
1dialect uml;
2​
3uml::package_diagram "Clean Architecture Layer Governance" {
4 schema {
5 #[layer(level: 0, name: "domain")]
6 package layer @Domain [label: "Core Domain Layer"] {
7 package module @Entities [label: "Domain Entities"];
8 package module @ValueObjects [label: "Value Objects"];
9 package module @DomainServices [label: "Domain Services"];
10 }
11​
12 #[layer(level: 1, name: "application")]
13 package layer @Application [label: "Application Use Cases (CQRS)"] {
14 package module @Commands [label: "Command Handlers"];
15 package module @Queries [label: "Query Projections"];
16 }
17​
18 #[layer(level: 2, name: "infrastructure")]
19 package layer @Infrastructure [label: "Infrastructure & External Adapters"] {
20 package module @Persistence [label: "PostgreSQL DAO"];
21 package module @Messaging [label: "Kafka Event Publisher"];
22 }
23​
24 #[layer(level: 2, name: "presentation")]
25 package layer @Presentation [label: "Presentation & REST API"] {
26 package module @Controllers [label: "HTTP Endpoints"];
27 package module @Dtos [label: "Request/Response DTOs"];
28 }
29 }
30​
31 flow {
32 Presentation -> import Application;
33 Application -> import Domain;
34 Infrastructure -> access Domain;
35 Infrastructure -> import Application;
36 }
37}
38​
Errors: 0 | package-diagram
Read-Only Preview

Core Syntax Reference

ConstructPurpose
package @Domain { ... }Declare nested namespace containers
App ..> Domain: "<<import>>";Model package-level import and access dependencies