(updated)
|
min. read

Atlas Device Sync Migration Example: Healthcare App Moves To PowerSync

Phillip van der Merwe

Introduction

In this post, we’ll show how WeKan, a MongoDB implementation partner, moved a customer’s healthcare proof-of-concept (POC) app from Realm and Atlas Device Sync to PowerSync. Ranjan Moses, Partner & Global Head - Presales & Solutions at WeKan and his team spoke to PowerSync about their experience.

You’ll see what motivated their migration, how they did it, and why PowerSync works for offline-first healthcare projects — or any apps that rely on MongoDB and need offline access.

Why Migrate?

WeKan’s customer had three critical reasons to migrate:

1. Move away from complex custom sync solution

Maintaining their own sync solution was getting more and more complicated: “they were handling all of the networking and the sync process — the online state, the offline state — through APIs and, you know, essentially maintaining their own sync system, if you can call it that”, Ranjan noted.

With an expansion of the app to handle large Electronic Health Records (EHR) on the horizon, this was becoming more urgent.

2. Offline capabilities

An offline-first architecture was critical: “They need the capability to have their appointments offline because doctors keep moving in and out of places with network coverage. They may not necessarily be sitting in the consulting room waiting for someone to show up: they could have a loss of connectivity and still need their schedule available.”

3. Atlas Device Sync and Realm deprecation

Realm and Atlas Device Sync met those needs at first, but with their deprecation, WeKan sought a new option. They chose PowerSync because it offers real-time data sync, offline capabilities, and fits neatly into the customer’s existing MongoDB stack.

Another reason was that WeKan wanted to create a real-world example app that MongoDB customers can reference: “It's pretty easy for someone to spin this up and try this out themselves, soup to nuts”.

The Healthcare POC App

Click to enlarge

WeKan built a simple app with two user types:

  • Doctors: View incoming appointments, add notes, and mark appointments as complete.
  • Patients: Schedule appointments and add dependents under a single profile.

Two collections support this flow:

  • Appointments: Stores times, dates, locations, and whether they’re active or complete.
  • Users: Identifies each doctor or patient and their associated data.

Where data was shared between users like doctors and patients (like appointment data, for example) data updated should sync to relevant users in real-time.

Replacing Realm and Atlas Device Sync with PowerSync

WeKan took their existing Realm-based app and:

  1. Duplicated the Project
  2. Added Auth0 for Authentication: Auth0 provided a straightforward user authentication solution.
  3. Removed Realm Logic: Stripped out Realm references and replaced them with PowerSync equivalents in the Swift code, using PowerSync’s Swift SDK.
  4. Tied In PowerSync Cloud: Using the PowerSync Dashboard, they created a hosted instance of the PowerSync Service and connected it to MongoDB.
  5. Separated Reads and Writes: The PowerSync Service ensures real-time sync so that in-app databases are always up to date for local reads, and a simple Node.js backend was used to process uploads of local writes (another option would have been to use PowerSync’s turnkey backend functionality).

The entire migration took a single frontend developer about two weeks.

Testing Offline Features

Offline features mattered most to the customer. To test them:

  • They turned off network connections on a test device.
  • They booked a new appointment.
  • When the device went back online, the appointment synced to the server and appeared on the doctor’s screen.

This flow is vital for roaming healthcare workers who may not have stable connections: “Every time the shift changes, they sync downstream and hold that data for the next eight hours or nine hours or whatever that shift is on the device."

Lessons Learned

Here’s what WeKan found:

  1. Minimal Code Changes: Because the backend still used MongoDB, the data models needed little work.
  2. Simple Swift SDK: They replaced Realm calls with equivalent calls in PowerSync’s Swift SDK.
  3. Offline-First Architecture: The app uses an on-device database to work fully offline, and syncs when users reconnect.
  4. Reasonable Migration Time: Two weeks of focused work got the POC running on PowerSync.
  5. All Managed by a Frontend Developer: A single frontend developer could manage the entire migration without support from a backend team.
“Our developer (a mobile engineer) was able to set up this whole thing without support from a backend developer. This gives us the confidence that it's going to be pretty easy for customers to migrate from Realm to PowerSync”

– Ranjan Moses, Partner & Global Head - Presales & Solutions at WeKan

Why PowerSync?

PowerSync offers:

Offline-First Functionality: Perfect for staff who need stable access to patient data.

Scalability: Handles heavy data loads like EHR records.

Security: Runs on secure MongoDB backends, with encryption where needed.

Flexibility: Connects to your chosen authentication provider and allows custom backend logic for accepting writes to MongoDB.

Conclusion

If you rely on MongoDB Realm and Atlas Device Sync, now is the time to plan your migration. WeKan’s experience shows that switching to PowerSync can be quick and painless. The healthcare POC app retained its core functionality — real-time data sync, offline access, and easy user management — and is now free of deprecated dependencies.

Need Help?

Contact us at PowerSync to learn how we can guide your migration from Realm and Atlas Device Sync.

Subscribe to receive PowerSync updates
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

By clicking "Subscribe" I agree to opt-in to PowerSync's mailing list
and accept the Privacy Policy.