docs: clean
This commit is contained in:
@@ -1,11 +0,0 @@
|
|||||||
Architecture
|
|
||||||
============
|
|
||||||
|
|
||||||
The Workflow
|
|
||||||
------------
|
|
||||||

|
|
||||||
|
|
||||||
The business Entities
|
|
||||||
---------------------
|
|
||||||
|
|
||||||

|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
# Exemple de structure
|
|
||||||
|
|
||||||
Les couches, du plus interne au plus externe
|
|
||||||
```
|
|
||||||
Domain (le cœur, ne dépend de RIEN d'externe)
|
|
||||||
↑
|
|
||||||
Application (orchestre le Domain, ne connaît pas l'infra concrète)
|
|
||||||
↑
|
|
||||||
Infrastructure (WebSocket, DB, event store — dépend de tout le reste)
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
src/
|
|
||||||
└── contexts/
|
|
||||||
├── auth/
|
|
||||||
└── ...
|
|
||||||
└── game/
|
|
||||||
├── domain/ ← Le cœur métier, zéro dépendance externe
|
|
||||||
│ ├── game/
|
|
||||||
│ │ ├── Game.ts ← Aggregate Root
|
|
||||||
│ │ ├── Player.ts ← Entity interne
|
|
||||||
│ │ ├── Card.ts ← Entity
|
|
||||||
│ │ ├── Color.ts ← Value Object
|
|
||||||
│ │ ├── Deck.ts ← VO ou petite structure
|
|
||||||
│ │ └── errors/
|
|
||||||
│ │ ├── InvalidMoveError.ts
|
|
||||||
│ │ └── ColorChoiceRequiredError.ts
|
|
||||||
│ └── events/ ← Events de DOMAINE (internes)
|
|
||||||
│ ├── CardPlayed.ts
|
|
||||||
│ ├── CardDrawn.ts
|
|
||||||
│ ├── TurnPassed.ts
|
|
||||||
│ └── DomainEvent.ts ← interface/type de base
|
|
||||||
├── application/ ← Orchestration, cas d'usage
|
|
||||||
│ ├── commands/ ← Les Commandes (intentions)
|
|
||||||
│ │ ├── PlayCardCommand.ts
|
|
||||||
│ │ └── DrawCardCommand.ts
|
|
||||||
│ ├── handlers/ ← Un handler par commande
|
|
||||||
│ │ ├── PlayCardHandler.ts ← charge l'aggregate, appelle game.playCard(), save
|
|
||||||
│ │ └── DrawCardHandler.ts
|
|
||||||
│ ├── projections/ ← LA LOGIQUE de construction des projections
|
|
||||||
│ │ ├── GameSummaryProjector.kt ← écoute les events, met à jour la vue
|
|
||||||
│ │ └── PlayerStatsProjector.kt
|
|
||||||
│ └── ports/ ← INTERFACES seulement (le "hexagone")
|
|
||||||
│ ├── GameRepository.ts ← interface, pas d'implémentation
|
|
||||||
│ ├── EventPublisher.ts ← interface, pas d'implémentation
|
|
||||||
│ └── ProjectionStore.kt ← interface, où lire/écrire la projection
|
|
||||||
├── infrastructure/ ← Tout ce qui est technique/externe
|
|
||||||
│ ├── persistence/
|
|
||||||
│ │ ├── EventStoreGameRepository.ts ← implémente GameRepository
|
|
||||||
│ │ ├── EventStore.ts
|
|
||||||
│ │ ├── projections/
|
|
||||||
│ │ │ ├── GameSummaryProjectionStore.kt ← implémentation concrète (DB, table dédiée)
|
|
||||||
│ │ │ └── models/
|
|
||||||
│ │ │ └── GameSummaryView.kt ← structure de la vue elle-même
|
|
||||||
│ ├── websocket/
|
|
||||||
│ │ ├── WebSocketServer.ts
|
|
||||||
│ │ ├── connectionManager.ts ← Map<gameId, Map<playerId, WebSocket>>
|
|
||||||
│ │ └── commandRouter.ts ← reçoit le message brut, dispatch vers le bon handler
|
|
||||||
│ └── eventPublisher/
|
|
||||||
│ └── WebSocketEventPublisher.ts ← implémente EventPublisher, fait le broadcast
|
|
||||||
└── presentation/ ← Traduction vers/depuis le client (le fameux DTO layer)
|
|
||||||
├── clientEvents/
|
|
||||||
│ ├── ClientEvent.ts ← types des events envoyés au front
|
|
||||||
│ └── toClientEvent.ts ← fonction de traduction domain event → client event
|
|
||||||
└── clientCommands/
|
|
||||||
└── parseIncomingCommand.ts ← valide/parse le message brut du client → Command
|
|
||||||
```
|
|
||||||
+1
-1
@@ -23,7 +23,7 @@ Api url:
|
|||||||
- [Backend API](http://api.traefik.me/)
|
- [Backend API](http://api.traefik.me/)
|
||||||
- [Frontend web site](http://app.traefik.me/) (WIP)
|
- [Frontend web site](http://app.traefik.me/) (WIP)
|
||||||
|
|
||||||
Exposed url on test env:
|
Exposed url on dev env:
|
||||||
- [PostgreSql](http://localhost:5432/)
|
- [PostgreSql](http://localhost:5432/)
|
||||||
- [Redis](http://localhost:6379/)
|
- [Redis](http://localhost:6379/)
|
||||||
- [RabbitMQ](http://localhost:15672/)
|
- [RabbitMQ](http://localhost:15672/)
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
@startuml
|
|
||||||
'https://plantuml.com/class-diagram
|
|
||||||
|
|
||||||
left to right direction
|
|
||||||
|
|
||||||
class GameList <<Projection>> {
|
|
||||||
+ status: Status
|
|
||||||
}
|
|
||||||
class GameState <<Projection>> {
|
|
||||||
+ players: List<Player>
|
|
||||||
+ currentPlayerTurn: Player
|
|
||||||
+ lastCardPlayer: Player
|
|
||||||
+ colorOnCurrentStack: Color
|
|
||||||
+ direction: Direction
|
|
||||||
+ readyPlayers: List<Player>
|
|
||||||
+ deck: Deck
|
|
||||||
+ isStarted: Boolean
|
|
||||||
+ playerWins: List<Player>
|
|
||||||
}
|
|
||||||
interface Card {
|
|
||||||
+ id: UUID
|
|
||||||
}
|
|
||||||
enum Color {
|
|
||||||
+ Blue
|
|
||||||
+ Red
|
|
||||||
+ Yellow
|
|
||||||
+ Green
|
|
||||||
}
|
|
||||||
class GameId {
|
|
||||||
+ id: UUID
|
|
||||||
}
|
|
||||||
class Player {
|
|
||||||
+ id: PlayerId
|
|
||||||
+ name: String
|
|
||||||
}
|
|
||||||
class Deck {
|
|
||||||
+ stack: Stack
|
|
||||||
+ discard: Discard
|
|
||||||
+ playersHands: PlayersHands
|
|
||||||
}
|
|
||||||
class Stack {
|
|
||||||
+ cards: List<Card>
|
|
||||||
+ shuffle()
|
|
||||||
}
|
|
||||||
class Discard {
|
|
||||||
+ cards: List<Card>
|
|
||||||
}
|
|
||||||
class PlayerHands {
|
|
||||||
+ map: Map<PlayerId, List<Card>>
|
|
||||||
}
|
|
||||||
|
|
||||||
class NumericCard {
|
|
||||||
+ number: Int
|
|
||||||
+ color: Color
|
|
||||||
}
|
|
||||||
class ReverseCard {
|
|
||||||
+ color: Color
|
|
||||||
}
|
|
||||||
class PassCard {
|
|
||||||
+ color: Color
|
|
||||||
}
|
|
||||||
class Plus2Card {
|
|
||||||
+ color: Color
|
|
||||||
}
|
|
||||||
class Plus4Card
|
|
||||||
class ChangeColorCard
|
|
||||||
|
|
||||||
GameState *-- Deck
|
|
||||||
GameState o-- "many" Player
|
|
||||||
Deck *-- PlayerHands
|
|
||||||
PlayerHands *-- "many" Card
|
|
||||||
PlayerHands o-- "many" Player
|
|
||||||
Stack *-- "many" Card
|
|
||||||
Discard *-- "many" Card
|
|
||||||
Deck *-- Stack
|
|
||||||
Deck *-- Discard
|
|
||||||
GameState *-- GameId
|
|
||||||
Card <|--- NumericCard
|
|
||||||
Card <|--- ReverseCard
|
|
||||||
Card <|--- PassCard
|
|
||||||
Card <|--- ChangeColorCard
|
|
||||||
Card <|--- Plus2Card
|
|
||||||
Card <|--- Plus4Card
|
|
||||||
|
|
||||||
ReverseCard o-- Color
|
|
||||||
NumericCard o-- Color
|
|
||||||
PassCard o-- Color
|
|
||||||
Plus2Card o-- Color
|
|
||||||
|
|
||||||
GameList *-- GameId
|
|
||||||
GameList o-- "many" Player
|
|
||||||
|
|
||||||
@enduml
|
|
||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 48 KiB |
@@ -1,84 +0,0 @@
|
|||||||
@startuml
|
|
||||||
'https://plantuml.com/use-case-diagram
|
|
||||||
|
|
||||||
package Legend {
|
|
||||||
usecase (Queries) #7693C4
|
|
||||||
usecase (Projections) #AB64C9
|
|
||||||
usecase (Events) #5FAD56
|
|
||||||
}
|
|
||||||
|
|
||||||
actor User
|
|
||||||
entity Query #7693C4
|
|
||||||
|
|
||||||
entity Command #5FAD56
|
|
||||||
entity Event #5FAD56
|
|
||||||
entity Projection #AB64C9
|
|
||||||
|
|
||||||
database Postgresql
|
|
||||||
database Redis
|
|
||||||
queue RabbitMQ
|
|
||||||
|
|
||||||
usecase (Web socket adapter) #5FAD56
|
|
||||||
usecase (Command handler) #5FAD56
|
|
||||||
usecase/ (Action) #5FAD56
|
|
||||||
usecase (Event handler) #5FAD56
|
|
||||||
usecase (Version builder) #5FAD56
|
|
||||||
usecase (Event store) #5FAD56
|
|
||||||
usecase (Event stream) #5FAD56
|
|
||||||
usecase (Event bus) #5FAD56
|
|
||||||
usecase/ (Reaction listener) #5FAD56
|
|
||||||
|
|
||||||
usecase/ (Projection builder) #AB64C9
|
|
||||||
usecase (Projection repository) #AB64C9
|
|
||||||
usecase (Projection bus) #AB64C9
|
|
||||||
|
|
||||||
usecase (Controller) #7693C4
|
|
||||||
|
|
||||||
User -> Query : <<create>>
|
|
||||||
Command <- User : <<create>>
|
|
||||||
User ---> (Controller) : Get \nprojection
|
|
||||||
User <-- (Controller) : Returns \nprojection
|
|
||||||
|
|
||||||
(Controller) --------> (Projection repository) : Get \nprojection
|
|
||||||
|
|
||||||
User -> (Web socket adapter) : Send \ncommand
|
|
||||||
(Web socket adapter) --> (Command handler) : Send \ncommand
|
|
||||||
(Web socket adapter) ...> User : Send notification \n(error or success)
|
|
||||||
|
|
||||||
(Command handler) ..> (Web socket adapter) : Send \nnotification
|
|
||||||
(Command handler) -> (Action) : Execute action
|
|
||||||
(Command handler) <- (Action) : Returns \nevent builder
|
|
||||||
(Command handler) ---> (Event handler) : Dispatch \nevent \n(send an event builder)
|
|
||||||
(Command handler) --> Event : <<Create>>
|
|
||||||
|
|
||||||
(Event handler) --> (Event store) : Publish \nevent
|
|
||||||
(Event handler) <-- (Reaction listener) : Dispatch \n new event
|
|
||||||
(Version builder) <- (Event handler) : build next version
|
|
||||||
note "Acquire a lock, \nget the next event version, \nand then, build the event " as EventHandlerNote
|
|
||||||
EventHandlerNote <-- (Event handler)
|
|
||||||
|
|
||||||
(Event store) -left-> (Event stream)
|
|
||||||
(Event store) ---> (Event bus) : Publish \nevent
|
|
||||||
|
|
||||||
(Event stream) --> Postgresql : Persist \nevent
|
|
||||||
(Event bus) -> RabbitMQ : Publish \nevent
|
|
||||||
(Event bus) -> RabbitMQ : Subscribe \nto event
|
|
||||||
(Event bus) <. RabbitMQ : Emit event
|
|
||||||
|
|
||||||
(Reaction listener) ---> (Projection bus) : Subscribe
|
|
||||||
(Reaction listener) <.. (Projection bus) : Emit projection
|
|
||||||
|
|
||||||
(Projection bus) <- (Projection repository) : Publish \nprojection
|
|
||||||
RabbitMQ <- (Projection bus) : Publish \nprojection
|
|
||||||
RabbitMQ <- (Projection bus) : Subscribe \nto projection
|
|
||||||
RabbitMQ .> (Projection bus) : Emit projection
|
|
||||||
|
|
||||||
(Event bus) <---- (Projection repository) : Subscribe
|
|
||||||
(Event bus) ..> (Projection repository) : Emit event
|
|
||||||
|
|
||||||
(Projection repository) --> Redis : Persist \nprojection
|
|
||||||
(Projection repository) <- Redis : Get \nprojection
|
|
||||||
(Projection repository) -> (Projection builder) : Build \nprojection
|
|
||||||
|
|
||||||
(Projection builder) --> Projection : <<create projection>>
|
|
||||||
@enduml
|
|
||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 35 KiB |
Reference in New Issue
Block a user