A Pet Photo Is Not Posted Until It Has a Receipt: Build a Durable Community Outbox
A community prompt such as “show us your pet” sounds almost too simple to architect: choose a photo, add a caption, and post it. Then a mobile connection drops at exactly the wrong moment. The author presses Post again. The first request may have succeeded, the announcement may have been delivered, and the browser has no receipt. A convincing demo retries everything. A reliable community product…
The article describes how to build a reliable system for posting community photos with a receipt mechanism. It outlines the main design considerations and dependencies.
The system distinguishes between two approaches: directly sending photos as chat messages, or saving a canonical post that is later announced in chat. The second design is chosen, as it allows for moderated, editable or long-lived community content stored in an application database.
The article emphasizes that a failed announcement should not erase a saved post, and retrying an announcement should never create a duplicate canonical post. This distinction allows the system to truthfully represent that a failed announcement does not result in an extra saved post, even if retries occur.
The core components are modeled as two state machines. The first represents the browser's role in preparing media content, moving through stages like uploading, accepting, blocking, or failing. The second represents the server's responsibilities for maintaining the canonical post and announcement status, including queued, sending, sent, failed or unknown outcomes.
The unknown state is distinguished from failed to capture situations where the application cannot definitively determine whether the external announcement succeeded. Automatic retries are suggested where failures are expected, but unknown outcomes should only be handled if duplicate announcements are acceptable or the downstream system provides an idempotency contract that the application has verified.
The tutorial provides TypeScript interfaces for managing submissions, posts, and repositories, along with utilities to fingerprint submissions and build canonical post records. It also references a messaging layer like Tencent RTC's Social Messaging solution to handle the actual community announcements.
In summary, the article provides a structured approach for building a robust, durable community photo posting system that maintains accurate records of both the submitted content and its eventual announcement status, even in the face of network issues, failures or uncertain outcomes.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.