Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Offline first collaboration with event sourcing
Search
Steven Chan
May 10, 2017
Programming
500
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Offline first collaboration with event sourcing
Demo code at
https://github.com/stevenchan/event-sourcing-todo-example
Steven Chan
May 10, 2017
More Decks by Steven Chan
See All by Steven Chan
Shape Recognition
stevenchan
0
49
Other Decks in Programming
See All in Programming
wkhtmltopdfの次どうするか問題2026
willnet
2
1.4k
What We Talk About When We Talk About XP
m_seki
2
650
Are APIs Still Relevant in the AI Era?
soyuka
0
250
Building an Out-of-Order CPU
latte72
1
790
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
410
新卒PdEのリアル
ryu1013
1
500
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
120
スマート反転とウェブアクセシビリティ
camiha
0
210
速習iPhone Duo対応
yuukiw00w
1
580
setup-vp GitLab対応の裏側
naokihaba
0
110
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
370
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
3
350
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
247
13k
Optimizing for Happiness
mojombo
378
71k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
450
Git: the NoSQL Database
bkeepers
PRO
432
67k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
510
Optimising Largest Contentful Paint
csswizardry
37
4k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
280
sira's awesome portfolio website redesign presentation
elsirapls
0
410
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
550
Joys of Absence: A Defence of Solitary Play
codingconduct
1
520
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
58k
[SF Ruby Conf 2025] Rails X
palkan
3
1.4k
Transcript
Offline First Collaboration with Event Sourcing Steven Chan - @stevnchan
GoodNotes
Syncing is hard
What we have tried
Apple CloudKit • Remote database API • Need to implement
syncing with local cache ourselves • Designing a correct algorithm to sync two object graphs is hard • Limited schema migration support • Undocumented limit for sharing records
Google Firebase • Real-time database • Mobile SDKs available •
Offline mode: store updates in a queue • Performance become worse as the queue become long
Event sourcing to rescue
Event sourcing to rescue 1. Store all changes as events
in a single queue 2. Only need to sync the event queue 3. Derive the app state from the event queue 4. Migration = rewrite the derivation function
Todo app example 1. {inserted, id123, “Buy milk”} 2. {completed,
id123} 3. {deleted, id123}
Update app state 1. {inserted, id123, “Buy milk”} 2. {completed,
id123} 3. {deleted, id123}
Update app state 1. {inserted, id123, “Buy milk”} 2. {completed,
id123} 3. {deleted, id123}
Update app state 1. {inserted, id123, “Buy milk”} 2. {completed,
id123} 3. {deleted, id123}
Update app state 1. {inserted, id123, “Buy milk”} 2. {completed,
id123} 3. {deleted, id123}
Syncing • Server: maintain an event queue = the source
of truth • Clients: upload local events to server, download unseen events, and then update the app state. • That’s it!
Syncing A B C A B C D E F
Client Server F D E
Syncing A B C A B C D E F
Client Server F D E
Syncing A B C A B C D E F
Client Server F D E
Conflicts handling • Pick the latest value by update time
• Pick the value with the largest update count • Use vector clocks to detect conflicts
Demo
Q&A