Guide for expanding from Realm Sync to Web

Hi all,

I am looking for guidance how to approach creating a web app working with MongoDB Atlas/Realm, coming from the native Realm SDK for iOS.

Current project state is a fully implemented iOS app using the Realm Swift SDK with a MongoDB Atlas database and a Realm App to synchronize the local database with the sync schema definition and custom partitioning strategy (using a function). For authentication I am currently using the built-in Realm Email/User-Password service, as-well as “Sign in with Apple” and “Login with Google”. All of it is configured in MongoDB Atlas/Realm App.

Now we want to expand the iOS and Android app with a Web App offering the same functionality. Basically we are just editing the data in the database and visualizing on the different platforms. I decided to go with Realm Sync, because the native apps are offline-first, therefore I was looking for a smart solution to migrate the data into the cloud as soon as the user decides to do so.

Now for web this is a different topic, as the storage solutions of moderns browsers are not that sophisticated, but offline-first is also not required.
So I already looked into the Web SDK guides/tutorials in the documentation ( on how to get started, but I still have a few open questions, I hope you can answer for me.

Q1. Should I continue to use the built-in authentication of Realm for the web app, or should I go with a different auth provider, e.g. Auth0? I am worrying the verification of the authentication with Realm Sync is not available in my own backend (I couldn’t find a public key to verify the JWT Token signature created by the Realm App). If I have to change to the Custom JWT strategy, I should probably do that now, before creating a larger userbase, but I am wondering if User/Password in Realm is not available in a custom backend, or if I just can’t find how to set it up.

Q2. Offline-first synchronization like on iOS/Android is not really a thing in the web. Do I understand correctly, for web I do not interact with any kind of local database, but instead only work with the GraphQL endpoint + Realm functions?

Q3. We are using Next.js as the web app framework. It also includes the option to built the API backend used in the web-app. Is there any preference in using the Realm GraphQL endpoint vs. building the Next.js backend by myself to connect to the MongoDB database and create my own API endpoint? Of course it is more work, but it would also give me more freedom with the queries and self-hosted/container-based pricing seems cheaper than serverless-hosted by MongoDB.

I found an example in the Next.JS GitHub project, but it only uses the Realm GraphQL endpoint, rather than a custom endpoint.

Thanks in advance for your help!