Group Chat App (Slack/Discord) 00:00:01 A message leaves the grey sending state Jo posts an update in a team channel. Design a group chat that can distinguish accepted, durably committed and visible on another member's device. A quick grey-to-sent animation should reflect a real service milestone. The client supplies the channel, message and a stable message identifier. Receiving an HTTP status is separate from making a retried submission safe. Membership comes from a short-lived cache, with the database as authority. The message now exists, on a second zone too. Gateways push to their own sockets. The sender's grey message becomes normal. Bind the client message identifier to the sender and channel. A durable deduplication decision can recover from a lost reply without generating a second announcement. 00:00:45 A crowded channel fans out by gateway Two thousand readers can share a much smaller set of gateways. A naive sender builds one inter-service push per reader. A grouped design sends to the gateways that currently hold interested connections. The service has committed event 412. It knows the subscribed gateways. No member list is read. About 20 sockets on each gateway. Two thousand screens with about one hundred copies between servers. Membership changes and stale subscriptions require reconciliation. Treat push as an optimization over recoverable durable channel history, especially when a gateway disconnects. 00:01:20 A reply must know which thread it belongs to A user replies inside a thread while other users are reading the channel root. The new reply needs its own identity and a durable link to the parent. The request names the parent message. The example commits the new reply and its required durable metadata together before announcing it. The channel learns the new total. A badge if connected, a phone notice if not and if wanted. Designate a source for thread history. Derived reply counts and notifications can recover from events, while client-facing state should define what may temporarily lag. 00:01:52 Search only the rooms the reader may enter The user searches for a quarterly report across their channels. Text ranking is only half the problem. A highly relevant result in a private room is still ineligible. The words are quarterly report. Perhaps 60 channels. Words first, then newer, then own channels. Each result links to its message with its neighbours. Constrain the candidate search by authorized scope and verify current access when opening the message. Avoid leaking the room through snippets or counts from a stale index. 00:02:22 The last message can vanish silently A gateway restarts just before it pushes event four hundred twelve. If no later message arrives, the client never receives a higher sequence number that would reveal the gap. The channel server restarts while sending 412. No event 413 comes to reveal the gap. It carries the newest number: 412. The client reads event 412 from the shard. Send a durable high-water mark in a heartbeat or synchronization response. The disconnected reader can compare it with its own cursor and request the missing range even in a quiet channel.