Class diagrams describe the structure of a system: entities (classes), their attributes, methods, and relationships. They are useful for documenting data structures, API schemas, and application architecture.
Basic Syntax
classDiagram
class Task {
+String id
+String title
+String status
+Date createdAt
+assign(userId: String)
+complete()
}

Attributes and Methods
Access Modifiers
| Symbol | Access |
|---|---|
+ | public |
- | private |
# | protected |
~ | package/internal |
classDiagram
class User {
+String id
+String email
-String passwordHash
#String tenantId
+getProfile() Profile
-hashPassword(plain: String) String
}
Relationships
| Syntax | Relationship |
|---|---|
| `A — | > B` |
| `A .. | > B` |
A --> B | Association |
A --* B | Composition |
A --o B | Aggregation |
A .. B | Dependency |
classDiagram
Animal <|-- Dog
Animal <|-- Cat
Animal : +String name
Animal : +makeSound()*
class Dog {
+String breed
+makeSound()
}
class Cat {
+bool isIndoor
+makeSound()
}

Cardinality
classDiagram
Project "1" --> "many" Task : contains
Task "many" --> "1" User : assigned to
User "1" --> "many" Project : member of
Interfaces and Enumerations
classDiagram
class Serializable {
<<interface>>
+serialize() String
+deserialize(data: String)
}
class TaskStatus {
<<enumeration>>
BACKLOG
IN_PROGRESS
REVIEW
DONE
}
class Task {
+TaskStatus status
+serialize() String
+deserialize(data: String)
}
Serializable <|.. Task
Task --> TaskStatus
Example: FlowEra Architecture
classDiagram
class Flow {
+String id
+String name
+String tenantId
+String statusModelId
+createTask(data: CreateTaskDTO) Task
+getTasks(filter: Filter) Task[]
}
class Task {
+String id
+String flowId
+String title
+String status
+Properties properties
+assign(userId: String)
+updateStatus(status: String)
}
class StatusModel {
+String id
+String name
+StatusDef[] statuses
+getStatus(label: String) StatusDef
+isValidTransition(from: String, to: String) bool
}
class FieldTemplate {
+String id
+String flowId
+String name
+FieldType type
+bool required
+validate(value: any) bool
}
Flow "1" --* "many" Task : contains
Flow --> StatusModel : uses
Flow "1" --> "many" FieldTemplate : defines
