Following the event storming session, the subsequent bounded contexts have been identified:

  • Users Management: it is responsible for managing the users’ lifecycle, from registration to deletion and the management of their profile information along with the authentication and authorization.
  • Groups Management: it is responsible for managing the group lifecycle, from creation to deletion, and the management of the group members.
  • Location Tracking: it is responsible for managing the location tracking of the users, including the sharing of the location with group members, the reception of location updates, the sending of SOS alerts and the management of their paths.
  • Notifications: it is responsible for managing the notifications, including the push notifications to the users’ devices.
  • Chat: it is responsible for managing the chat between the users and the group members.

In the following sections, we will provide a detailed view of each bounded context, including its Ubiquitous Language, the Commands and the Events guiding the interactions between the different contexts. These can be categorized as Driving or Driven Events: the former are the events triggered by the user’s actions and that drives an application use case, while the latter are the events that are triggered by the system as a reaction to a use case or a system state change. Moreover we distinguish between Commands and Events to highlight the difference between a request to perform an action (Command) and the notification of something meaningful that has happened (Event).

Users Management

Ubiquitous Language

ConceptDescriptionSynonyms
UserAn individual who has registered and can access the system with a unique identity.Member, Account Holder
ProfileCollection of personal information associated with a user.User Profile
AuthenticationThe process of verifying a user’s identity, typically through credentials like email/password.Login, Sign-in
AuthorizationDetermination of what actions a user is permitted to perform within the system.Permissions, Access Control
CredentialsInformation used to verify a user’s identity, such as email/password combinations or tokens.Login Details
SessionA period of time during which a user is actively authenticated in the system.User Session
RegistrationThe process by which a new user creates an account in the system.Sign-up, Account Creation

Events

🏷️ Event TypeEvent NameDescription
📥 Driven eventUserCreatedTriggered when a new user successfully completes the registration process.
📥 Driven eventProfileUpdatedTriggered when a user modifies their profile information.
📥 Driven eventUserDeletedTriggered when the user account is permanently deleted from the system.

Commands

CommandDescription
CreateUserRegister a new user in the system.
UpdateUserModify the existing user’s profile information.
AuthenticateUserVerify the user’s credentials to allow access to the system.
DeleteUserPermanently remove a user from the system.

Groups Management

Ubiquitous Language

ConceptDescriptionSynonyms
GroupA collection of users who are connected for shared tracking and communication purposes.Circle, Team
Group MemberA user who belongs to a group.Participant

Events

🏷️ Event TypeEvent NameDescription
📥 Driven eventGroupCreatedTriggered when a user creates a new group.
📥 Driven eventGroupMemberAddedTriggered when a user is added to an existing group.
📥 Driven eventGroupMemberRemovedTriggered when a member is removed from a group.

Commands

CommandDescription
CreateGroupCreate a new group in the system.
AddMemberToGroupAdd a new member to an existing group.
RemoveMemberToGroupRemove a member from an existing group.

Location Tracking

Ubiquitous Language

ConceptDescriptionSynonyms
LocationA specific point on a geographical plane, represented by coordinates that indicates where something / someone is located.Position
AddressA human-readable description of a location, usually including the street name, the city, the country, and the postal code along with the related location.
ETAEstimated Time of Arrival, the time at which a user is expected to reach a certain destination.
RouteA set of positions that can be interpolated forming a path between two geographical positions.Path
TrackingRepresent the user route information at a certain point in time.
StateState of a user at a certain time, the values that it could assume are: online, offline, SOS, Routing, Warning.
SessionAn aggregation of the user’s tracking information, the state and last location of a user in a certain period of time.

Events

🏷️ Event TypeEvent NameDescription
🚀 Driving eventSampledLocationThe event sent from the client application to update the user’s location.
🚀 Driving eventRoutingStartedThe event sent from the client application to start the user’s route tracking towards a destination.
🚀 Driving eventRoutingStoppedThe event sent from the client application to stop the user’s route tracking.
🚀 Driving eventSOSAlertTriggeredThe event sent from the client application to trigger an SOS alert, carrying the user’s location.
📥 Driven eventSOSAlertStoppedThe event sent from the client application to stop the SOS alert.
📥 Driven eventUserUpdateThe event sent from the Location Service to notify the client application about the user’s state or location update.

Notifications

Ubiquitous Language

ConceptDescriptionSynonyms
Push notificationA real-time message sent to a user’s device to inform about a relevant event.
Notification messageThe actual content of the push notification that is displayed to the user.
Registration tokenA unique token associated with a user’s device for sending push notifications.Token, Device Token

Commands

CommandDescription
Group Wise Push NotificationA push notification to be sent to all the members of a group.
Co Members Push NotificationA push notification to be sent to all users sharing at least one group with a specific user.

Chat

Ubiquitous Language

ConceptDescriptionSynonyms
ClientAn individual that connect to a chat groupUser, Group Member
GroupA set of Clients that chat between each otherChat Room
MessageA text message that is sent from a client in a group.

Events

🏷️ Event TypeEvent NameDescription
🚀 Driving eventClientJoinedToGroupThe event triggered when a client join a group in order to start chat.
🚀 Driving eventClientLeavedFromGroupThe event triggered when a client leaves a group.
🚀 Driving eventClientConnectedThe event sent from the client application when user logs in and is able to receive messages.
🚀 Driving eventClientDisconnectedThe event sent from the client application when user logs out and is no longer reachable.
📥 Driven eventMessageThe event sent from the client application when a new message is received in a group.

Commands

CommandDescription
DeleteGroupDelete a chat group.
ClientJoinsGroupAdd a new client in a group.
ClientLeavesGroupRemove a client from a group.
ClientConnectsMake a client become available for receiving new messages.
ClientDisconnectsMake a client unavailable for receiving new messages.
SendMessageSend a message in a group.

Bounded Context Integration

The boundary of each bounded context delineates the scope of the context: models in different bounded context can be evolved and implemented independently, but they need to be integrated to provide a coherent service to the users.

DDD provides a set of patterns for defining relationship and integrations between bounded contexts to be reified in the so-called Context Map, a visual representation of the system bounded contexts and the relationships between them.

The following diagram shows the context map of the PositionPal system:


Notifications
Context
Chat
Context
Location
Context
Groups
Management
Context
Users
Management
Context
U
D
Conforms
Shared Kernel

The shared kernel collects the shared entities and domain logic that are in common between the bounded contexts. As per best practices, the overlapping module will be limited as much as possible to avoid coupling between the contexts and exposing only the part of the model that, otherwise, would be duplicated in all the contexts.

The conformist pattern applies to users and groups management context: the downstream context (Group Management) conform to the upstream context (Users Management) model to simplify the integration and avoid the complexity of translation between bounded contexts. Although this approach may constrain the downstream team’s design flexibility, it significantly simplifies integration. Since the upstream context (Users Management) has more influence in this relationship, conforming to its model facilitates clearer communication and reduces integration overhead.