← Back

Sep 27, 2024

Mem 2.0 Dev Update #5: Redesigned Sync

When we set out to build Mem 2.0, coming later this year, we knew we needed to push the boundaries of speed and reliability in note-taking. That’s why we invented and built a brand-new data syncing engine from the ground up.

In Mem 2.0, you’ll notice every action feels instant, and your notes stay perfectly synced across all devices, regardless of your connection or location.

Mem's sync system works like a postal service for your notes. When you make changes on your device, it's like writing a letter and placing it in your local mailbox, where it's immediately accessible. Even if you're offline, these updates are stored locally. Once you're back online, your device sends these letters to a central post office (the server), which then distributes the updates to all your other devices. This ensures that every "mailbox" (device) you check has the most recent and accurate version of your notes, keeping everything in sync, just like a reliable postal service delivering your mail on time.

We’re about to dive deep into the engineering specifics, so read on if you're curious about the nitty gritty details.

1. “Local-first, event driven” architecture
Our sync system follows a “local-first, event-driven” approach, where all changes are first saved directly to your device for instant access (local-first), and these changes trigger specific actions (events) that are sent to the server to update and sync across all your devices, ensuring everything stays up to date, even when you’re offline.

2. Optimistic updates
Sometimes when your network conditions aren't ideal, it can take time for your local changes to sync, leading to delays or incomplete updates. We solved this issue by designing Mem’s sync system with an “optimistic updates” approach. This means that we immediately apply changes you make on your device as if they’ve already been synced to the server, allowing you to continue working without delay. Once a network connection is available, the system verifies and syncs these changes in the background.

3. Unlocking collaboration
Our new sync system supports seamless collaboration. When you share a note or collection with others, the sync system automatically routes updates to the right people, ensuring that everyone sees the most up-to-date version of shared content. If multiple people edit a note or collection at the same time, the server intelligently merges those changes and resolves edit conflicts in real-time. This allows you and your team to work together without worrying about overwriting each other’s work.

4. Scalability
We intentionally designed our new sync system to be flexible and scalable by organizing data into separate models—such as notes and collections—allowing us to introduce new features without disrupting the entire architecture. By using an event-driven approach, we make sure the system can easily handle new types of actions and updates. This careful design allows us to scale up our sync system as we introduce more data types and larger amounts of information, while keeping our sync system fast and reliable.

This wraps up our fifth installment of Mem 2.0 development updates, where we share the details on what to expect when Mem 2.0 arrives later this year. In case you missed it, you can read our last Mem 2.0 development update about the brand new Mem 2.0 iOS app.