Mobile app architecture with NodeJS and Flutter

Hi, I’m a beginner at mobile app development and am having trouble with understanding where to integrate Realm. I’m building my mobile frontend on Realm and backend on NodeJS, and there are Realm SDKs for both.

Do I need to connect both my frontend and backend to the Realm SDKs? Or only the backend? If I only connect the backend, how does the local sync work (since requests from my Flutter app to NodeJS presumably would not go through)?

Did you find https://www.mongodb.com/docs/realm/introduction/?

Realm is an embedded database that runs on your phone/tablet/desktop. It has the ability to synchronise with a MongoDB running on Atlas using Atlas Device Sync (ADS for short).

There is no direct peer-to-peer sync between devices running Realm - all sync happens through Atlas in a star topology.

You do not (typically) run Realm in server-side processes, but it is obviously possible since we support both Linux and Windows for many of our Realm SDKs.

Yes, I’ve read the docs. Where I’m confused is on the backend NodeJS part. I think I should be accessing my data through a REST API or GraphQL, but the Realm NodeJS SDK exists. Is there one I should prefer?

In addition, I would. like to kick off business logic on my backend based on writes to the database, which I could do with subscriptions in the NodeJS SDK, but if I use another way to connect, I would need to use something like Triggers. Is that understanding correct?

Hi, @Kasper_Nielsen1 would you be able to help?

I haven’t understood uour question properly but if you are asking there is a node js sdk then yes there is one

G’day @thinkpurple,

Welcome to MongoDB Community :wave:

Realm has 7 SDKs that you can select from to create your mobile application. If you create your backend with MongoDB Atlas, the same SDK can be used to connect your mobile application to the backend.

These are different options that you can use as per your use case. GraphQL and Data API provide other ways to access the data without the need for a backend. You can create HTTP endpoints that you can use within the client. If you are using node js to create your backend, then you can use MongoDB Driver to connect your application to MongoDB. If you want to use Realm SDKs, you can use MongoDB Atlas to create your backend and use Atlas Device Sync to sync your data between the mobile client and Atlas on the cloud.

You can read mobile bytes or articles on our developer Hub to get started with Atlas and Realm.

  1. Mobile Bytes
  2. MongoDB Developer Hub
  3. Realm Medium Publication.

I hope the provided information helps.

Cheers, :performing_arts:
henna