Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the application from a layered architecture to Domain-Driven Design (DDD), splitting functionality into two bounded contexts: auth and user. This represents a significant architectural improvement that better separates concerns and prepares the codebase for potential microservice extraction.
Key Changes:
- Introduced DDD tactical patterns with domain/application/infrastructure/interfaces layers
- Split into
authanduserbounded contexts with separate domain models - Created a shared kernel for common value objects (Email, domain events)
- Implemented CQRS-style separation with UserQueryService and UserCommandService
- Added domain events for cross-context communication (UserRegisteredEvent, UserLoggedInEvent)
Reviewed changes
Copilot reviewed 132 out of 133 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
auth/domain/model/* |
Auth bounded context domain models (AuthUser, RefreshToken, TokenFamily, etc.) |
auth/application/service/* |
Auth application services orchestrating authentication flows |
auth/infrastructure/* |
Persistence adapters, security implementations (JWT, BCrypt) |
auth/interfaces/rest/* |
REST controllers and request/response DTOs for auth endpoints |
user/domain/model/* |
User bounded context domain models (User, UserId, UserName, UserRole) |
user/application/service/* |
User query and command services with CQRS separation |
user/infrastructure/* |
User persistence adapters and auth context integration |
user/interfaces/rest/* |
User and admin user REST controllers |
shared/kernel/* |
Shared value objects (Email), domain events, and exception hierarchy |
infrastructure/* |
Cross-cutting concerns (security filters, config, resolvers) |
test/** |
Comprehensive test structure mirroring the domain organization |
build.gradle.kts |
Updated Jacoco exclusions to match new DDD structure |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/main/java/org/nkcoder/user/interfaces/rest/request/ChangePasswordRequest.java
Show resolved
Hide resolved
src/main/java/org/nkcoder/user/interfaces/rest/request/AdminResetPasswordRequest.java
Show resolved
Hide resolved
src/main/java/org/nkcoder/auth/interfaces/rest/request/RegisterRequest.java
Show resolved
Hide resolved
src/main/java/org/nkcoder/auth/infrastructure/persistence/entity/AuthUserJpaEntity.java
Show resolved
Hide resolved
src/main/java/org/nkcoder/auth/infrastructure/persistence/entity/RefreshTokenJpaEntity.java
Show resolved
Hide resolved
src/main/java/org/nkcoder/user/infrastructure/persistence/entity/UserJpaEntity.java
Show resolved
Hide resolved
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.
What
Split into
userandauthdomain using DDD pattern.