┌──────────────────────────────────────────────────────────┐
│ BFF Layer │
│ (REST Controllers — yeganə xarici API səthi) │
│ bff/auth/ bff/user/ bff/car/ bff/search/ ... │
├──────────────────────────────────────────────────────────┤
│ Application Layer │
│ (Use cases, orchestration, DTO mapping) │
├──────────────────────────────────────────────────────────┤
│ Domain Layer │
│ (Entities, Value Objects, Domain Services, Ports) │
├──────────────────────────────────────────────────────────┤
│ Infrastructure Layer │
│ (JPA Repos, Redis, External APIs, Adapters) │
└──────────────────────────────────────────────────────────┘
shared-kernelBütün modulların istifadə etdiyi ortaq komponentlər:
Dependency rule: Heç bir business logic burada olmur.
authPorts (public service interface):
AuthService.register()AuthService.login()AuthService.refreshToken()AuthService.resetPassword()SessionService.getActiveSessions()SessionService.revokeSession()Depends on: shared-kernel
userPorts:
UserService.getProfile()UserService.updateProfile()UserService.getPrivacySettings()PrivacyService.canViewProfile(viewerId, targetId)Depends on: shared-kernel
carPorts:
CarService.addCar()CarService.getUserCars()CarService.findByPlate()Depends on: shared-kernel, user (read-only: owner check)
documentPorts:
DocumentService.upload()DocumentService.getStatus()DocumentService.getUserDocuments()Depends on: shared-kernel, user
searchPorts:
SearchService.searchByPlate()SearchService.getHistory()Depends on: shared-kernel, car, carcoin, tracking
messagingPorts:
BubbleMessageService.send()DirectMessageService.send()ConversationService.getConversations()Depends on: shared-kernel, user, carcoin
feedPorts:
PostService.create()FeedService.getFeed()Depends on: shared-kernel, user, car
notificationPorts:
NotificationService.send()NotificationService.getUserNotifications()Depends on: shared-kernel, user
adminPorts:
VerificationService.getPending()ModerationService.getReports()Depends on: shared-kernel, user, document, car
carcoinPorts:
CoinService.getBalance()CoinService.spend()CoinService.earn()CoinPricingService.getPrice(action)Depends on: shared-kernel
trackingPorts:
TrackingService.logEvent()TrackingService.getPlateStats()Depends on: shared-kernel
shared-kernel ← hər modul
auth ← heç kim (digər modullar AuthService port-u ilə danışır)
user ← car, document, messaging, feed, notification, admin
car ← search, feed, admin
carcoin ← search, messaging
tracking ← search
document ← admin
Qadağalar:
Hər modul üçün:
module-name/
├── domain/
│ ├── model/ # Entity, Value Object
│ ├── port/
│ │ ├── in/ # Use case interfaces (driving ports)
│ │ └── out/ # Repository interfaces (driven ports)
│ └── service/ # Domain services
├── application/
│ ├── usecase/ # Use case implementations
│ ├── dto/ # Request/Response DTOs
│ └── mapper/ # MapStruct mappers
└── infrastructure/
├── persistence/ # JPA repositories, entities (DB-specific)
├── adapter/ # External service adapters
└── config/ # Module-specific config
Modullar arasında async əlaqə üçün Spring Application Events istifadə olunur:
UserRegisteredEvent → carcoin (başlanğıc coin ver), tracking (log)CarAddedEvent → carcoin (coin ver), tracking (log)SearchPerformedEvent → tracking (log), carcoin (coin sil)DocumentVerifiedEvent → user (badge update), carcoin (coin ver)Bu event-lər monolit daxilində Spring @EventListener / @Async ilə handle olunur.