Docs Menu

Atlas Device SDK for Node.js

Use the Atlas Device SDK for Node.js to build for server applications, desktop applications, CLIs, IoT programs, and more in JavaScript or TypeScript.

The Node.js SDK does not support applications written for web browsers. For Web apps, use the Web SDK. For React Native development, use the React Native SDK.

To get started with the Node.js SDK, see Quick Start.

What You Can Do

Use the SDK's open-source database - Realm - as an object store on the device. Use Device Sync to keep data in sync with your MongoDB Atlas cluster and other clients.

1

To get started, install the Node.js SDK.

2

Use JavaScript to idiomatically define an object schema.

3

You can configure your database to do things like populate initial data on load, use an encryption key to secure data, and more. To begin working with your data, configure and open a database.

4

You can create, read, update, and delete objects from the device database. Construct complex queries to filter data.

5

Live objects mean that your data is always up-to-date. Register a change listener to react to changes and perform logic like updating your UI.

Atlas Device SDK Mobile Illustration
1

Configure Device Sync in an App Services App. Define data access rules or use Development Mode to infer a schema from your client's data model. Then, connect to the backend App from your Node.js client.

2

App Services provides access to custom JWT authentication, our built-in email/password provider, anonymous authentication, and popular authentication providers like Apple, Google, and Facebook. Use these providers to authenticate a user in your client.

3

To get started syncing data, open a synced database. To determine what data a synced database can read and write, subscribe to a query.

4

The APIs for reading and writing data are the same for both synced and non-synced databases. Data that you read and write on the device is automatically kept in sync with your Atlas cluster and other clients. Apps keep working offline and sync changes when a network connection is available.

Device Sync Illustration

Use Atlas App Services in your Node.js application with the Realm SDK.

To invoke serverless backend logic from your Node.js client, call Atlas Functions.

Query data stored in MongoDB directly from your client application code with MongoDB Data Access.

Authenticate users with built-in and third-party authentication providers. Access App Services with authenticated users.

App Services Illustration
Essential Documentation
Atlas Device SDK Icon

JavaScript API Reference

Explore generated reference docs for the Node.js SDK.

Node.js Reference

Explore engineering and expert-provided example projects to learn best practices and common development patterns using the Node.js SDK. Check out the Example Projects page for more Node.js sample apps.

Virtual Space Icon

Vehicle Simulator and Controller

Build a connected platform to monitor vehicle analytics using MongoDB Atlas and the AWS ecosystem.

Example project

Atlas Device SDK Offline Icon

Offline Login and Database Access

Log in a Device Sync user and open a synced database offline.

Example project

Users Icon

User's Online State

Detect connectivity and activity of users and devices.

Example project

Cloud Mobile Transfer Icon

Connection State Change & Error Handling

Learn best practices around handling Sync errors and client reset strategies.

Example project