Skip to content

Instantly share code, notes, and snippets.

@andreaskweber
Created December 8, 2025 12:25
Show Gist options
  • Select an option

  • Save andreaskweber/b2c53445aaa032bf4eeb56f119f001ac to your computer and use it in GitHub Desktop.

Select an option

Save andreaskweber/b2c53445aaa032bf4eeb56f119f001ac to your computer and use it in GitHub Desktop.
Social Media Domain Model Analysis

Social Media Domain Model Analysis


🚨 Missing Relationships (Immediate Issues)

Object Issue Fix
rm-post-details No respondsToQueryIds Needs a GetPostDetails query
cmd-flag-content No emitsEventIds Should emit ContentFlagged
cmd-send-push No emitsEventIds Should emit PushNotificationSent
evt-toxic-content-detected No aggregateId Should belong to agg-post or new aggregate

πŸ‘€ Missing Actors

Actor Rationale
Guest Views public content but cannot interact (different permissions than User)
ContentOwner Could be distinct from User for content lifecycle control (delete own posts vs admin delete)

Note: If User already covers content ownership, no new actor neededβ€”just more explicit commands.


⚑ Missing Commands (Write Side)

User Commands (act-user)

Command Target Events Rationale
DeletePost agg-post PostDeleted Users delete their own posts
EditPost agg-post PostEdited Users edit their own posts
DeleteComment agg-comment CommentDeleted Users delete their own comments
UnlikePost agg-post PostUnliked Undo like action
ReportContent agg-post ContentReported User-initiated (vs system FlagContent)

Moderator Commands (act-moderator)

Command Target Events Rationale
RemoveContent agg-post ContentRemoved After review, remove flagged content
ApproveContent agg-post ContentApproved After review, mark as safe
BanUser (new aggregate) UserBanned Temporary/permanent user ban

πŸ“… Missing Events

Event Aggregate Rationale
PostDeleted agg-post Track post lifecycle
PostEdited agg-post Audit trail for edits
CommentDeleted agg-comment Track comment lifecycle
PostUnliked agg-post Track engagement changes
ContentFlagged agg-post Missing from cmd-flag-content
ContentReported agg-post User reports
ContentRemoved agg-post Moderation action taken
ContentApproved agg-post Moderation action taken

πŸ“– Missing Read Models

Read Model Consumers Subscribes To Query
ModerationQueue act-moderator ContentFlagged, ContentReported GetModerationQueue
UserNotifications act-user CommentAdded, PostLiked, ContentRemoved GetMyNotifications
UserProfile act-user, act-moderator PostPublished, PostDeleted GetUserProfile

❓ Missing Queries

Query Returns Actors Rationale
GetPostDetails rm-post-details act-user, act-moderator Critical: ReadModel exists but no query!
GetModerationQueue rm-moderation-queue act-moderator Moderators need work queue
GetMyNotifications rm-user-notifications act-user Users check notifications
GetUserProfile rm-user-profile act-user, act-moderator View user's posts
SearchPosts (new) act-user Discovery feature

πŸ”„ Missing Policies

Policy Trigger Action Rationale
NotifyOnContentRemoval ContentRemoved cmd-send-push Notify user when their content is removed
UserReportEscalationPolicy ContentReported cmd-flag-content Escalate user reports to moderation

πŸ“Š Priority Summary

High Priority (Broken Relationships):

  1. Add GetPostDetails query β†’ rm-post-details
  2. Add emitsEventIds to cmd-flag-content and cmd-send-push
  3. Add aggregateId to evt-toxic-content-detected

Medium Priority (Core User Flows):

  1. Add DeletePost, EditPost, DeleteComment commands
  2. Add ModerationQueue read model for moderators
  3. Add RemoveContent, ApproveContent commands for moderation workflow

Lower Priority (Polish):

  1. User notifications system
  2. Content reporting (user-initiated)
  3. Search functionality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment