Design a 1:1 Messaging App
Requirements
Conversations
- User sees a list of conversations, with the most recently active conversations first.
- Scrolling down shows additional conversations.
- Tapping the compose button starts a new conversation.
Conversation
- User sees a list of messages sorted in order.
- Scrolling up reveals additional messages.
- User can insert a message and send it.
Ask from candidate
- Clear and comprehensive API proposal that meets the product needs.
- Clear and comprehensive data model proposal that fits the API design, is scalable, and reliable.
- Clear data flow for both online and offline messaging.
Non-requirements (the following are NOT in scope for this problem)
- User authentication
- Group chat (1:1 only)
- Read receipts
- Typing indicators
- Contact is online indicators
- Attachments
- Contact management. (You can pull contacts from the device or manually enter in a phone number.)
- Name entry. (We can assume that is pulled from the device.)
这道 Lyft VO 题目本质上是在设计一个 1 对 1 即时通讯系统,重点不是算法,而是产品级系统设计:如何定义会话列表和消息列表的接口,如何建模 conversation、message、participant 等核心数据,以及如何支持按时间排序的会话列表、向上加载历史消息、发送消息和离线补发。回答时应突出数据模型的可扩展性与可靠性,例如用消息游标做分页、用最近活跃时间维护会话排序,并说明在线发送与离线缓存 / 同步的完整数据流。题目明确排除了群聊、已读回执、输入中状态、在线状态、附件和联系人管理,因此讨论范围应聚焦在基础 1:1 消息收发链路上。
正文完