Design (LLD) a real-time collaborative document editing platform like Google Docs - Machine CodingSubhahu Jain·Jul 15, 2023·8 min readTable of contentsIssues in Above Design1️⃣ Naive Document Update Model (Fatal for Real-Time Editing)Current DesignProblemReal ScenarioSolution2️⃣ No Conflict Resolution (OT / CRDT Missing)What’s MissingRequired in Real SystemsExample ConflictSolution3️⃣ Document Is Not Thread-SafeCurrent FieldsConcurrency IssuesFailure ModesSolution4️⃣ Observer Pattern Is Synchronous (Does Not Scale)CurrentProblemsReal Systems UseSolution5️⃣ Cursor Tracking Is Incorrect Under Concurrent EditsCurrentProblemReal RequirementSolution6️⃣ Version History Is Not a Version HistoryCurrentProblemsReal Systems StoreSolution7️⃣ No Undo / Redo Despite Command Pattern ClaimClaimedRealitySolution8️⃣ Access Control via Proxy Is MissingClaimedMissingSecurity GapSolution9️⃣ User Presence Is Not Real-TimeCurrentProblemsReal Systems TrackSolution🔟 State Pattern Is Declared but UnusedClaimedRealityExample Missing RuleSolution1️⃣1️⃣ No Network Model (This Is a Single-JVM Design)MissingReal ArchitectureSolution1️⃣2️⃣ No Ordering Guarantees for EditsProblemReal FixSolutionPythonProgramming BlogsJavaScriptAWSBeginner Developers