System Design Atlas

Creator community with feeds and moderation

04 / 10Worked example

Interfaces

How does the Publish post contract distinguish a retry from new intent?

The load profile leads to the concrete command “Publish post”. Its payload includes creator, post revision and audience. An idempotency key recognises the same intent after a response is lost; an aggregate version protects the changing business state.

Starting point A large creator determines peak fanout load.

Assumptions for the example case

A fictional example design for a local community with text posts, a chronological home feed and traceable moderation. A feed projection with lag below 30 seconds is within the assumed target; from 30 seconds, the backlog is displayed and reported. All figures and test targets are illustrative assumptions.

Commands, retries and current state

Command, Commit and Replay

CommandPost B-31 · Revision R-31 · Decision M-31
Command → Community-APICheck content and expected version
Community APIAccept the command or recognise a replay
Community-API → ErgebnisjournalCommit the result before responding
Result journalFingerprint + stored record

Identical content returns the stored record; altered content produces a conflict.

Publish post binds the creator, post revision and audience. The same key refers to the stored result; altered content produces a conflict.

Proposed API for this example

  1. POST/creator-community/{id}/commands

    Publish a post

    Input
    Creator, post revision and audience; expected aggregate version, authorised role and stable command key.
    Result
    Durably stored business result and new version; version or content conflicts produce no partial effects. An accepted external request receives an open status.
    Retry behaviour
    The key is scoped to the actor, operation and business object. After authentication, first compare the existing result and canonical content: identical content returns the stored evidence; changed content produces a conflict. Only new keys trigger validation of the current version.
  2. GET/creator-community/{id}

    Read the current business state and reason for investigation.

    Input
    Authorised identity and business object.
    Result
    Post with its current version, evidence and reason for outstanding processing.
    Retry behaviour
    Repeating a read creates no business change; access is checked again.

Additional state changes

OperationInputResult and protection
Block a postModeration, current version, documented reasonveröffentlicht → gesperrt; old feed references remain invisible.
Lift the blockModeration, renewed review and current versiongesperrt → veröffentlicht with a new decision.
Delete a postThe post’s creator, version and confirmationgelöscht is terminal; old jobs cannot reactivate the post.
Read a postMember, post and current access rightsContent only with allowed visibility; media access follows the same check.

Block a post

Input
Moderation, current version, documented reason
Result and protection
veröffentlicht → gesperrt; old feed references remain invisible.

Lift the block

Input
Moderation, renewed review and current version
Result and protection
gesperrt → veröffentlicht with a new decision.

Delete a post

Input
The post’s creator, version and confirmation
Result and protection
gelöscht is terminal; old jobs cannot reactivate the post.

Read a post

Input
Member, post and current access rights
Result and protection
Content only with allowed visibility; media access follows the same check.

Messages across the external boundary

Source contract
ActivityPub describes publication and deletion activities and tombstones. This case remains a local community; it derives no guarantee of effective remote deletion from that specification.
System responsibility
Feed fanout reads an old publication job after a post has been blocked. It may still create references, but the community API checks authoritative post state before delivery and hides the content. Any cached visibility decision requires versioned invalidation.

Publication binds the revision and audience

Publication binds the revision and audience

Publication binds the revision and audience.

Publish post may arrive again after a response is lost.

Creator, post revision and audience must remain identical on replay. The exercise specifies the input and expected result.

Alternative considered
A key stored only in volatile memory loses its evidence on restart.
Trade-off
The journal for Publish post requires durable retention and protected access.
Reassess
The documented retry window and journal volume determine the future archiving strategy.

Try it yourself

For Publish post, predict the outcomes of an identical retry, the same key with a changed audience, and a new key with a stale version.

A hint for your attempt

Retry identity and current state require separate checks.

Compare with a possible solution
Identical
The stored result for post B-31 is returned; the effect is not repeated.
Changed
The same key with altered canonical content results in conflict.
New intent with a stale version
A new key with a stale version is rejected before any business change. The interface reloads the current state and asks the user to confirm the decision again.

Apply to your project

Which input fields make two change intentions different in your project?

Next, moderation decisions have their own history.