Design a system that allows multiple users to collaborate on a document.
Description
For MVP, focus on:
- Defining back-end APIs for interaction between client and server.
- Defining the document storage layer.
- Explaining how edits are propagated to other users and how changes are rendered on the client side.
After MVP:
- Enhance the design to support millions of documents.
- Identify and fix bottlenecks that affect scaling.
This problem asks you to design a collaborative document editing system for multiple users. A strong MVP answer should cover client-server APIs, the document storage model, and the mechanism for propagating edits to other users while keeping client-side rendering consistent. The scaling discussion should then extend the design to millions of documents and identify bottlenecks such as synchronization latency, hot documents, storage pressure, and fan-out of real-time updates.