Skip to main content

Shared modules

Libraries, not processes. A service opts in by Gradle dependency. Do not put a use case here.

ModulePublic typesUse it when
shared-databaseDataSourceFactory, PostgresConfig, JpaBaseConfigYou need the standard Postgres pool
shared-redisIntegrationEventConsumerSupport, RedisStreamConsumerSupportYou consume a stream
shared-eventsIntegrationEventEnvelope, *EventRoutes, *EventStreams, *EventTypesYou name a fact that crosses a process
shared-outboxOutboxWriter, JdbcOutboxWriter, OutboxRelayEngineYou publish a fact, or you are the relay
shared-inboxInboxMessage, JdbcInboxMessageRepository, InboxMessageWorkerYou handle a fact asynchronously
shared-idempotencyIdempotencyFilterA retried POST must not double-apply
shared-communication-portsEmailSenderPort, SmsSenderPort, OtpSenderPortYou send mail or OTP without importing the provider SDK
shared-loggingRequestCorrelation, HttpAccessLogFilter, StructuredLog, UseCaseObservationAspectYou log a request or a use case
shared-securityJwtAuthenticationFilter, JsonAuthenticationEntryPoint, JsonAccessDeniedHandlerThe route accepts a user JWT
shared-webGlobalExceptionHandlerYou map errors to the standard body
shared-feignShared response records (UserProfileResponse, ExpenseResponse, and others)You share a DTO shape across services
shared-i18nI18nMessageService, MessageKeys, SupportedLocaleYou return localized copy

application-shared.yml in shared-logging is on the classpath of every service. Override a key in the service file rather than forking the shared file for one context.

Event route constants are the contract. Adding a type means updating the producer, the consumer, and both service pages. A stringly-typed event name that is not in *EventTypes will be published and then ignored.