01Chapter 1: Clarifying requirements and scopeThis chapter assumes you know basic client-server and HTTP concepts. You should also be familiar with databases and key-value stores, and understand what a persistent connection over TCP is. Later chapters use short JavaScript and Python snippets, so you should be able to read both.2 min read
02Chapter 2: Estimating traffic, connections, and storageThis chapter assumes you know basic client-server concepts, what a persistent connection is, and how to read short Python snippets. You will turn the requirements from the previous chapter into rough numbers. Those numbers drive the choices in later chapters: protocol, server count, and storage.3 min read
03Chapter 3: Polling, long polling, and WebSocketThis chapter compares three ways to push chat messages to a client. It assumes you know basic HTTP, understand what a persistent TCP connection is, and can read short JavaScript snippets.2 min read
05Chapter 5: Modeling users, conversations, and messagesThis chapter assumes you know basic relational and key-value database ideas, and that you have seen the high-level split between stateless APIs and stateful chat servers. Here we decide what data the system stores and how it is keyed.2 min read
06Chapter 6: Following a one-to-one message end to endThis chapter assumes you know the basics of HTTP and WebSocket, and that you have read the architecture chapter. It follows one message from Alice's phone to Bob's phone. You should be able to explain each hop and say what fails at each one.2 min read
07Chapter 7: Ordering messages and generating IDsThis chapter assumes you know how a one-to-one message travels from sender to recipient (the previous chapter) and are comfortable with key-value stores and short Python snippets. Here you will see how a chat system keeps messages in a consistent order and gives each one a unique ID.3 min read
08Chapter 8: Acknowledgements, retries, and deduplicationThis chapter assumes you know how a one-to-one message travels from sender to chat server to recipient, and that each chat has an ordered sequence of messages. Here we cover how to make sure a message arrives at least once without showing up twice.3 min read
09Chapter 9: Choosing storage for chat historyThis chapter assumes you know the message model from earlier chapters (a chat_id, a per-chat seq, a sender_id) and the basics of relational and key-value stores. It explains how to pick a database for messages by starting from how the system reads and writes them.2 min read
10Chapter 10: Group chat and fan-out strategiesThis chapter assumes you know how a one-to-one message flows through a chat server, and that each chat has its own sequence numbers and idempotent writes (covered in earlier chapters). Here we extend that flow to groups.2 min read
11Chapter 11: Presence with heartbeatsPresence tells users whether a contact is online. This chapter assumes you know how WebSocket connections work and how a key-value store with expiring keys behaves. It covers how heartbeats produce presence, the failure modes, and how to limit the cost of presence updates.3 min read
12Chapter 12: Notifying offline usersThis chapter assumes you have read the chapters on the one-to-one message flow and on presence. You should know that a chat server pushes messages over a persistent connection, and that presence comes from heartbeats with a time-to-live (TTL).3 min read
13Chapter 13: Syncing multiple devices and loading historyThis chapter assumes you know how per-chat sequence numbers work (see ordering and IDs) and how chat history is stored, partitioned by chat and ordered by sequence. Here you will see how a user's phone, laptop, and tablet stay consistent, and how a client loads history without fetching everything.2 min read
14Chapter 14: Scaling connection servers and routing messagesThis chapter assumes you know how WebSocket connections work, what a chat server does, and how a key-value store or pub/sub system behaves. Earlier chapters covered the architecture and group fan-out. Here the question is how to run many connection servers and get a message to the one that holds the3 min read
15Chapter 15: Handling media and attachmentsThis chapter assumes you know the one-to-one message flow, the message data model, and basic object storage ideas such as buckets and keys.2 min read
16Chapter 16: Security, privacy, and rate limitingThis chapter assumes you know how WebSocket connections work, how the chat servers from earlier chapters are laid out, and the basics of HTTP authentication. It covers three things: who may connect, who may read a message, and how to stop one client from overwhelming the system.3 min read