Skip to content

Commit f9750f7

Browse files
authored
Merge pull request #18
feat: Spring WebFlux Code Generator without axon
2 parents b30a176 + e78a0e3 commit f9750f7

File tree

5 files changed

+218
-3
lines changed

5 files changed

+218
-3
lines changed

DOC/.HELP.md

-3
This file was deleted.

DOC/HELP/.HELP.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ameliore ce text et n'utilise pas le pronom je,
2+
Explique (quest je ce je veux faire,
3+
pourquoi je le fais et comment je le fais
4+
5+
Expliquer toujours , Qu est ce que je veux faire , pourquoi je l'ai fais et comment et mettez des domaines d'
6+
applications et une introduction et conclusions je l'ai fais, et n'utilisez jamais le pronom je dans les articles
Loading

src/content/blog/assets/tree.md

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
tree src
2+
src
3+
├── main
4+
│   ├── java
5+
│   │   └── com
6+
│   │   └── pcoundia
7+
│   │   ├── MainApplication.java
8+
│   │   ├── shared
9+
│   │   │   ├── Presentation
10+
│   │   │   │   └── StatusController.java
11+
│   │   │   ├── application
12+
│   │   │   │   └── ApiResponseDto.java
13+
│   │   │   └── infrastructure
14+
│   │   │   ├── FileStorageService.java
15+
│   │   │   ├── FileStorageServiceImpl.java
16+
│   │   │   ├── config
17+
│   │   │   │   └── DatabaseConfiguration.java
18+
│   │   │   ├── exception
19+
│   │   │   │   └── GlobalExceptionHandler.java
20+
│   │   │   ├── security
21+
│   │   │   │   └── SecurityConfig.java
22+
│   │   │   └── webflux
23+
│   │   │   └── CorsGlobalConfiguration.java
24+
│   │   └── transactions
25+
│   │   ├── application
26+
│   │   │   ├── command
27+
│   │   │   │   ├── CreateTransactionCommand.java
28+
│   │   │   │   ├── DeleteTransactionCommand.java
29+
│   │   │   │   └── UpdateTransactionCommand.java
30+
│   │   │   ├── commandHandler
31+
│   │   │   │   ├── CreateTransactionCommandHandler.java
32+
│   │   │   │   ├── DeleteTransactionCommandHandler.java
33+
│   │   │   │   └── UpdateTransactionCommandHandler.java
34+
│   │   │   ├── dto
35+
│   │   │   │   ├── TransactionPagedResponse.java
36+
│   │   │   │   ├── TransactionRequest.java
37+
│   │   │   │   └── TransactionResponse.java
38+
│   │   │   ├── mapper
39+
│   │   │   │   └── TransactionMapper.java
40+
│   │   │   ├── query
41+
│   │   │   │   ├── FindByIdTransactionQuery.java
42+
│   │   │   │   └── ListTransactionQuery.java
43+
│   │   │   └── queryHandler
44+
│   │   │   ├── FindByIdTransactionHandler.java
45+
│   │   │   └── ListTransactionQueryHandler.java
46+
│   │   ├── domain
47+
│   │   │   ├── TransactionAggregate.java
48+
│   │   │   ├── exception
49+
│   │   │   │   ├── TransactionAmountNotValid.java
50+
│   │   │   │   ├── TransactionIdNotValid.java
51+
│   │   │   │   ├── TransactionNotFoundException.java
52+
│   │   │   │   └── TransactionReferenceNotValid.java
53+
│   │   │   └── valueObject
54+
│   │   │   ├── TransactionAmount.java
55+
│   │   │   ├── TransactionId.java
56+
│   │   │   └── TransactionReference.java
57+
│   │   ├── infrastructure
58+
│   │   │   ├── entity
59+
│   │   │   │   └── Transaction.java
60+
│   │   │   └── repository
61+
│   │   │   └── TransactionRepository.java
62+
│   │   └── presentation
63+
│   │   ├── controller
64+
│   │   │   ├── AddTransactionController.java
65+
│   │   │   ├── DeleteTransactionController.java
66+
│   │   │   ├── FindByIdTransactionController.java
67+
│   │   │   ├── TransactionListController.java
68+
│   │   │   ├── TransactionSseController.java
69+
│   │   │   └── UpdateTransactionController.java
70+
│   │   └── sse
71+
│   │   └── TransactionPublisher.java
72+
│   └── resources
73+
│   ├── application-test.properties
74+
│   ├── application.properties
75+
│   ├── schema-domain.sql
76+
│   └── schema-others.sql
77+
└── test
78+
└── java
79+
└── com
80+
└── pcoundia
81+
├── ProductCommandApplicationTests.java
82+
├── shared
83+
│   ├── BaseIntegrationTests.java
84+
│   └── BaseUnitTests.java
85+
└── transactions
86+
├── application
87+
│   ├── CreateTransactionCommandHandlerTest.java
88+
│   ├── DeleteTransactionCommandHandlerTest.java
89+
│   └── UpdateTransactionCommandHandlerTest.java
90+
├── domain
91+
│   └── TransactionAggregateTests.java
92+
├── presentation
93+
│   └── controller
94+
│   ├── StatusControllerTest.java
95+
│   ├── TransactionCreateControllerIntegrationTest.java
96+
│   ├── TransactionDeleteControllerIntegrationTest.java
97+
│   ├── TransactionFindAllControllerIntegrationTest.java
98+
│   ├── TransactionFindByIdControllerIntegrationTest.java
99+
│   ├── TransactionFixtures.java
100+
│   ├── TransactionSseControllerTest.java
101+
│   └── TransactionUpdateControllerIntegrationTest.java
102+
└── shared
103+
├── BaseIntegrationTests.java
104+
└── BaseUnitTests.java
105+
106+
42 directories, 61 files
+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
title: "Spring WebFlux Code Generator"
3+
date: "2025-04-17"
4+
tags: ["Spring Boot", "WebFlux", "CQRS", "DDD", "R2DBC"]
5+
excerpt: "Découvrez un générateur de code backend réactif basé sur Spring WebFlux, R2DBC et les principes DDD/CQRS, sans dépendance à Axon."
6+
author: "Papa COUNDIA"
7+
link: "https://github.com/coundia/cqrs-webflux-starter"
8+
---
9+
10+
## 🚀 Introduction
11+
12+
La structuration d’une architecture backend propre, modulaire et réactive peut rapidement devenir répétitive et chronophage.
13+
Le **Spring WebFlux Code Generator** répond à ce défi en proposant un outil de génération automatique de code basé
14+
sur **Spring Boot**,
15+
**Spring WebFlux**, **R2DBC** et les principes **DDD** et **CQRS**.
16+
Contrairement à d'autres solutions,
17+
il ne dépend pas d'Axon et offre une totale liberté d'implémentation.
18+
19+
## 🎯 Objectif
20+
21+
Automatiser la création de code backend structuré en quatre couches bien définies :
22+
23+
- **Domain** : Modèles, événements, objets de valeur
24+
- **Application** : Use cases, commandes, requêtes, DTO
25+
- **Infrastructure** : Entités, mapping, repository R2DBC, configuration
26+
- **Presentation** : Contrôleurs REST et SSE
27+
28+
Le tout, en exploitant les atouts suivants :
29+
30+
- Spring WebFlux pour un traitement non-bloquant
31+
- R2DBC pour la persistance réactive
32+
- SSE (Server Sent Events) pour le streaming temps réel
33+
- Mustache comme moteur de templates pour générer le code
34+
35+
## 💠 Stack Technique
36+
37+
- Spring Boot 3+
38+
- Spring WebFlux
39+
- Spring R2DBC
40+
- PostgreSQL
41+
- Mustache (template engine)
42+
- Swagger/OpenAPI
43+
- Java 17+
44+
45+
## 📦 Architecture Générée
46+
47+
```text
48+
project-root/
49+
├── domain/
50+
│ └── model, events, valueObjects
51+
├── application/
52+
│ └── usecases, commands, queries, handlers, dto
53+
├── infrastructure/
54+
│ └── repository, entity, config
55+
├── presentation/
56+
│ └── controller (REST, SSE)
57+
```
58+
59+
## ⚙️ Utilisation
60+
61+
Pour générer une entité complète :
62+
63+
```bash
64+
POST http://127.0.0.1:8070/api/v1/generator/all
65+
Accept: application/x-ndjson
66+
Content-Type: application/json
67+
68+
{
69+
"outputDir": "/Users/pcoundia/projects/cqrs-rabbitmq-webflux-starter/src/main/java/com/pcoundia/transactions",
70+
"definition": {
71+
"name": "Transaction",
72+
"table": "transactions",
73+
"fields": [
74+
{ "name": "id", "type": "String" },
75+
{ "name": "reference", "type": "String" },
76+
{ "name": "amount", "type": "Double" }
77+
]
78+
}
79+
}
80+
```
81+
82+
## 📱 Domaines d'application
83+
84+
- Systèmes temps réel (finance, IoT, messagerie)
85+
- Backends orientés microservices
86+
- Dashboards de monitoring
87+
- Applications SaaS back-office
88+
89+
👉 Voir le projet généré : [GitHub - cqrs-webflux-starter](https://github.com/coundia/cqrs-webflux-starter)
90+
91+
# Code généré
92+
93+
[tree.md](assets/tree.md)
94+
95+
# Documentation générée
96+
97+
![api_webflux_generator.png](assets/api_webflux_generator.png)
98+
99+
- 🧩 Client SSE Angular : [angular-client-sse](https://github.com/coundia/angular-client-sse)
100+
101+
102+
Ce projet démontre la puissance de l’automatisation dans les architectures modernes.
103+
Il constitue une excellente base pour tout projet ambitieux nécessitant une gestion claire et efficace de la logique métier.
104+
105+
Ce projet est en constante évolution, restez connecté sur github.
106+

0 commit comments

Comments
 (0)