PRODUCT

Versioned Data Sync Spec

📄 Engineering spec for Halal Maps — Designed for scale, speed, and reliability

🔧 Purpose

To keep users’ restaurant data updated without wasting bandwidth. The sync system enables:

🧩 The Problem

Restaurant data changes frequently — status updates, business details, etc. Fetching the full dataset every time leads to:

The solution needed to:

🧠 Solution Overview

We implemented a multi-stage versioned sync system, optimised for bandwidth efficiency and safety.

3 Layers:

🔄 Sync Logic (Client-Side)

  1. On launch, app checks last time a version check was performed
  2. If more than 24 hours → fetch live metadata.json
  3. If app version/hash mismatch live metadata → fetch manifest.json
  4. Based on manifest, download either a full or diff update path
  5. Validate update via SHA-256 hash to confirm download integrity
  6. Apply and save locally

🔁 Version Flow Logic

The sync system manages data updates through a version chain, where each dataset file is either a full version or a diff(incremental) update. Each file includes:

There are two main update paths the system supports:

1. Diff-Based Update Chain (for active users)

Users who started from the first full version (1.00) are updated progressively using small diff files:

1.00 (full) → 1.01 (diff) → 1.02 (diff) → 1.04 (diff)

Each diff contains only the data changes from the previous version. ✅ This path is ideal for users who open the app regularly and stay up to date. ✅ It saves bandwidth because most diffs are just a few kilobytes.

2. Full Update Entry Point (for new or out-of-sync users)

At a certain point, we create a new full snapshot (e.g. at diff update 1.02 we simultaneously created a full checkpoint update 1.03) that becomes the new entry point:

1.03 (full) → 1.04 (diff)

This path is used when:

✅ This keeps syncing reliable without forcing a long diff chain ✅ Users still get to the latest version (1.04) in just two steps

🌍 Why This Matters

This hybrid system is designed to minimise bandwidth usage while keeping all users in sync:

📁 Example of a version chain

🛠 Debugging & Recovery

The sync system includes built-in safeguards for debugging and rollback without disrupting users

🧯 Handling Faulty Updates

If an update is later found to be faulty:

🔐 Hash Validation on Device

Each file is hashed using SHA-256, and the client always verifies it before applying:

🔐 Example

✅ Why This Matters

🛠 Backend Dashboard

📊 Results

🧱 Possible Future Improvements

👥 Stakeholder Benefits

✅ Summary

This sync system is lightweight, scalable, and robust — keeping user data fresh without compromising performance. Built for Halal Maps, it’s equally applicable to any product handling structured, evolving datasets that requires offline functionality.