feat: scaffold CQRS sample with DDD and package-by-feature design (Helidon MP + MongoDB)#1
Draft
Copilot wants to merge 2 commits into
Draft
feat: scaffold CQRS sample with DDD and package-by-feature design (Helidon MP + MongoDB)#1Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
…ing Helidon MP + MongoDB Agent-Logs-Url: https://github.com/soujava/helidon-mongodb-cqrs/sessions/935ddb4c-bdbf-4d6d-9bba-2fe68b868911 Co-authored-by: otaviojava <863011+otaviojava@users.noreply.github.com>
…ation, logging) Agent-Logs-Url: https://github.com/soujava/helidon-mongodb-cqrs/sessions/935ddb4c-bdbf-4d6d-9bba-2fe68b868911 Co-authored-by: otaviojava <863011+otaviojava@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
otaviojava
April 26, 2026 09:06
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repository contained only a README. This PR builds the full project from scratch, applying Domain-Driven Design and package-by-feature organization throughout.
Structure
Each bounded context owns its full vertical slice — no cross-feature leakage:
DDD application
Orderis the aggregate root — all invariants enforced internally, state changes only through named business methods (confirm(),cancel())OrderId/OrderStatusare immutable value objectsOrderCreatedEvent, etc.) are registered on the aggregate and collected viaAggregateRootOrderRepositoryinterface lives in the domain; MongoDB implementation lives ininfrastructure— domain has zero persistence importsCQRS wiring
Handlers register themselves at CDI startup via
OrderHandlerRegistrar(@Observes @Initialized), keeping theCommandBus/QueryBusdecoupled from any feature.OrderResourcedispatches only through the bus interfaces — no domain logic in the API layer.Key decisions
OrderViewMappercentralises aggregate → read model conversion, shared by both query handlersDomainExceptionMapper(@Provider) mapsIllegalArgumentException→ 400,IllegalStateException→ 409, logs unexpected errors server-sideOrderResource.createOrder()validates payload nulls before dispatch to give clean API errorsmongodb.uri,mongodb.database,server.port) externalised via MicroProfile Config