Help picking the right MongoDB tools

Hi,

I’m a Frontend Developer building a new web application with MongoDB Atlas, MongoDB Realm, Next.js, and React.
I am reading the documentation for Authentication in MongoDB Realm, and I’m trying to understand whether I need to use Node.js SDK or Web SDK?

I’m guessing Web SDK is more suitable for me, but it says: “The Web SDK does not support JavaScript or TypeScript applications written for the Node.js environment”. Can someone clarify how I am going to have Node.js in the backend? I’m confused on the backend part (I’m not a backend developer, as I mentioned above).

If I go with Web SDK, I will have to use GraphQL or the MongoDB query language.
I was planning to use Node.js and Express on the backend. With MongoDB Realm, I can implement Authentication and other features, which makes me question whether I even need Node.js and Express on the backend.

Does it mean I don’t have to use Node.js in the backend?
How do I talk to the Database then (using Node drivers?).

If anyone could explain to me how to best set up my application (especially the backend part) with the tools I mentioned above, that would be helpful. Thank you!

1 Like

Hi! MongoDB Realm is a backend-as-a-service, so we’ll take care of the backend and deploying your app. You just need to configure parts of your backend using the MongoDB Realm Admin. MongoDB Realm lets you define permissions, handles authentication, and provides SDKs to more easily use these services and access data.

I’m guessing Web SDK is more suitable for me, but it says: “The Web SDK does not support JavaScript or TypeScript applications written for the Node.js environment

Correct, you will need to use the Web SDK here if your application is running on the browser. If you felt like that language is confusing, then we can make sure to clear that up a little more. Next.JS has also provided an example using Realm-web

If I go with Web SDK, I will have to use GraphQL or the MongoDB query language.
I was planning to use Node.js and Express on the backend.‘’

If you use the Web SDK you have 2 options:
a. Use our generated GraphQL API - Once you’ve defined a schema based on what your documents look like, we’ll automatically create a GraphQL API for you that you can use to read and write data to your Atlas cluster
b. Use the remote Mongo Client - The SDK comes with built in methods to help you read and write data to your Atlas cluster

Both require authentication and will obey the permissions you have set for your application.

which makes me question whether I even need Node.js and Express on the backend.

You do not need the backend at all.

How do I talk to the Database then (using Node drivers?).

See above explanation around web SDK and links. Realm gets rid of the need to build your backend/use drivers to read and write to your Database. A small interactive quick-start for our Web SDK might be useful to get up and running here.

3 Likes

Thank you so much for your reply, Sumedha! It makes sense now!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.