# damian-git-99/microservices-example-ddd-cqrs-hexagonal architecture

> Architecture diagram of the GitHub repository damian-git-99/microservices-example-ddd-cqrs-hexagonal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal
- Repository: https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal

## Overview

This repository documents three Spring Boot microservices: user management, post management, and email notifications. The principal cross-service workflow is user creation triggering a notification; the README describes event-based communication but does not show the implementation. Posts and users expose separate CRUD/query capabilities. The tree supports identifying application, domain, and infrastructure areas, but no source excerpts were provided, so internal calls and storage/message-broker links are omitted unless documented.

Main entry points: [`posts/posts-infrastructure/posts-rest/src/main/java`](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-infrastructure/posts-rest/src/main/java) (Posts API), [`users/users-infrastructure/users-rest/src/main/java`](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/users/users-infrastructure/users-rest/src/main/java) (User API), [`posts/posts-domain/src/main/java/com/microservices/example/post/domain`](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-domain/src/main/java/com/microservices/example/post/domain) (Post domain), [`users/users-application/src/main/java`](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/users/users-application/src/main/java) (User commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_users["User service"]
  node_user_api["User API"]
  node_user_commands["User commands"]
  node_user_queries["User queries"]
  node_user_domain["User domain"]
  node_user_store[("User persistence")]
end

subgraph group_posts["Posts service"]
  node_post_api["Posts API"]
  node_post_create["Create post"]
  node_post_delete["Delete post"]
  node_post_find["Find post"]
  node_post_user_find["Posts by user"]
  node_post_domain["Post domain"]
  node_post_store[("Post persistence")]
end

subgraph group_notifications["Notifications"]
  node_notification_listener["User-created listener"]
  node_email_service["Email sending<br/>[EmailService.java]"]
end

subgraph group_shared["Shared architecture"]
  node_command_bus["Command bus"]
  node_event_bus["Event bus"]
end

node_client(("API client"))
node_email_provider["Gmail"]

node_client -->|"sends requests"| node_user_api
node_client -->|"sends requests"| node_post_api
node_user_api -.->|"routes commands"| node_user_commands
node_user_api -.->|"routes queries"| node_user_queries
node_user_commands -.->|"manages users"| node_user_domain
node_user_queries -.->|"queries users"| node_user_domain
node_user_api -->|"user-created event"| node_notification_listener
node_post_api -.->|"routes creation"| node_post_create
node_post_api -.->|"routes deletion"| node_post_delete
node_post_api -.->|"routes lookup"| node_post_find
node_post_api -.->|"routes user lookup"| node_post_user_find
node_post_create -.->|"creates posts"| node_post_domain
node_post_delete -.->|"deletes posts"| node_post_domain
node_post_find -.->|"finds posts"| node_post_domain
node_post_user_find -.->|"finds user posts"| node_post_domain
node_notification_listener -.->|"requests email"| node_email_service
node_email_service -->|"sends email"| node_email_provider

click node_user_api "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/users/users-infrastructure/users-rest/src/main/java"
click node_user_commands "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/users/users-application/src/main/java"
click node_user_queries "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/users/users-application/src/main/java"
click node_user_domain "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/users/users-domain/src/main/java"
click node_user_store "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/users/users-infrastructure/mysql-users-repository/src/main/java"
click node_post_api "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-infrastructure/posts-rest/src/main/java"
click node_post_create "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-application/src/main/java/com/microservices/example/post/application/create_post"
click node_post_delete "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-application/src/main/java/com/microservices/example/post/application/delete_post"
click node_post_find "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-application/src/main/java/com/microservices/example/post/application/find_post_by_id"
click node_post_user_find "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-application/src/main/java/com/microservices/example/post/application/find_posts_by_user"
click node_post_domain "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-domain/src/main/java/com/microservices/example/post/domain"
click node_post_store "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-infrastructure/mysql-posts-repository/src/main/java"
click node_notification_listener "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/blob/main/notifications/notification-application/src/main/java/com/microservices/example/notification/application/event/listeners/UserCreatedEventListener.java"
click node_email_service "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/blob/main/notifications/notification-application/src/main/java/com/microservices/example/notification/application/event/services/EmailService.java"
click node_command_bus "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/blob/main/common/infrastructure-common/src/main/java/com/microservices/example/common/infrastructure/command/SpringCommandBus.java"
click node_event_bus "https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/blob/main/common/infrastructure-common/src/main/java/com/microservices/example/common/infrastructure/events/EventBusRabbitMQ.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user_api,node_user_commands,node_user_queries,node_user_domain,node_user_store,node_client toneBlue
class node_post_api,node_post_create,node_post_delete,node_post_find,node_post_user_find,node_post_domain,node_post_store toneAmber
class node_notification_listener,node_email_service toneMint
class node_command_bus,node_event_bus toneRose
class node_email_provider toneIndigo
```

## Components

### User service

- [User API](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/users/users-infrastructure/users-rest/src/main/java): `users/users-infrastructure/users-rest/src/main/java`
- [User commands](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/users/users-application/src/main/java): `users/users-application/src/main/java`
- [User queries](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/users/users-application/src/main/java): `users/users-application/src/main/java`
- [User domain](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/users/users-domain/src/main/java): `users/users-domain/src/main/java`
- [User persistence](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/users/users-infrastructure/mysql-users-repository/src/main/java): `users/users-infrastructure/mysql-users-repository/src/main/java`

### Posts service

- [Posts API](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-infrastructure/posts-rest/src/main/java): `posts/posts-infrastructure/posts-rest/src/main/java`
- [Create post](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-application/src/main/java/com/microservices/example/post/application/create_post): `posts/posts-application/src/main/java/com/microservices/example/post/application/create_post`
- [Delete post](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-application/src/main/java/com/microservices/example/post/application/delete_post): `posts/posts-application/src/main/java/com/microservices/example/post/application/delete_post`
- [Find post](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-application/src/main/java/com/microservices/example/post/application/find_post_by_id): `posts/posts-application/src/main/java/com/microservices/example/post/application/find_post_by_id`
- [Posts by user](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-application/src/main/java/com/microservices/example/post/application/find_posts_by_user): `posts/posts-application/src/main/java/com/microservices/example/post/application/find_posts_by_user`
- [Post domain](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-domain/src/main/java/com/microservices/example/post/domain): `posts/posts-domain/src/main/java/com/microservices/example/post/domain`
- [Post persistence](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/tree/main/posts/posts-infrastructure/mysql-posts-repository/src/main/java): `posts/posts-infrastructure/mysql-posts-repository/src/main/java`

### Notifications

- [User-created listener](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/blob/main/notifications/notification-application/src/main/java/com/microservices/example/notification/application/event/listeners/UserCreatedEventListener.java): `notifications/notification-application/src/main/java/com/microservices/example/notification/application/event/listeners/UserCreatedEventListener.java`
- [Email sending](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/blob/main/notifications/notification-application/src/main/java/com/microservices/example/notification/application/event/services/EmailService.java): `notifications/notification-application/src/main/java/com/microservices/example/notification/application/event/services/EmailService.java`

### Shared architecture

- [Command bus](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/blob/main/common/infrastructure-common/src/main/java/com/microservices/example/common/infrastructure/command/SpringCommandBus.java): `common/infrastructure-common/src/main/java/com/microservices/example/common/infrastructure/command/SpringCommandBus.java`
- [Event bus](https://github.com/damian-git-99/microservices-example-ddd-cqrs-hexagonal/blob/main/common/infrastructure-common/src/main/java/com/microservices/example/common/infrastructure/events/EventBusRabbitMQ.java): `common/infrastructure-common/src/main/java/com/microservices/example/common/infrastructure/events/EventBusRabbitMQ.java`

### Other components

- **API client**
- **Gmail**

## Connections

- API client → User API: sends requests (evidence: `README.md`)
- API client → Posts API: sends requests (evidence: `README.md`)
- User API → User commands: routes commands
- User API → User queries: routes queries
- User commands → User domain: manages users
- User queries → User domain: queries users
- User API → User-created listener: user-created event (evidence: `README.md`)
- Posts API → Create post: routes creation
- Posts API → Delete post: routes deletion
- Posts API → Find post: routes lookup
- Posts API → Posts by user: routes user lookup
- Create post → Post domain: creates posts
- Delete post → Post domain: deletes posts
- Find post → Post domain: finds posts
- Posts by user → Post domain: finds user posts
- User-created listener → Email sending: requests email
- Email sending → Gmail: sends email (evidence: `README.md`)
