Docs Menu

Docs HomeAtlas App Services

Introduction to Atlas App Services for Backend and Web Developers

On this page

  • What Problem Does App Services Solve?
  • User Authentication and Management
  • Schema Validation and Data Access Rules
  • Event-Driven Serverless Functions
  • Secure Client-Side Queries
  • Synchronize Data Across Devices
  • Get Started with App Services
  • Prebuilt Applications
  • Tutorials
  • Summary

As a backend developer, you can use Atlas App Services to rapidly develop cloud-based applications. App Services Apps can react to changes in your MongoDB Atlas data, connect that data to other systems, and scale to meet demand. App Services does this without the need to manage database and server infrastructure.

As a web developer, you have to deal with lots of overhead when sending data from a server to the browser. This includes things like authentication and data validation. And then the application has to be scalable and secure. Many libraries and frameworks exist to provide these services. Selecting the best ones for your project requires deep understanding of the tradeoffs.

As a mobile app developer, syncing data across devices poses challenges. You might write a lot of custom conflict resolution code yourself, or you might use a platform-specific backend like CloudKit that's not designed for developing cross-platform applications. Atlas Device Sync provides an offline-first, cross-platform solution for syncing data between a backend and mobile devices. When you combine this with App Services's authentication and data validation, you solve a host of common mobile app development issues.

App Services is a serverless application backend that streamlines solving these common challenges. App Services provides configurable functions, integrated data access, and security rules. With App Services, you can focus on building unique features instead of boilerplate backend code.

It takes time, resources, and expertise to build, administer, and maintain backend infrastructure. However, a lot of these features are similar across applications. App Services manages the backend infrastructure and user management for you. This frees you to focus on the features that makes your app special, not boilerplate code.

App Services is:

Serverless:
  • Deploy server-side applications without having to set up and manage server infrastructure. App Services includes provisioning, deployment, operating systems, web servers, logging, backups, and redundancy.

  • Run cloud-based Atlas Functions that can crunch data or interact with Node.js modules.

  • Skip writing an authentication API on top of your App Services instance. Authenticated clients can interact with parts of the database based on their permissions.

Dynamic and responsive:
  • React to data changes in MongoDB Atlas, process data from HTTPS endpoints, or run Atlas Functions on a schedule with Atlas Triggers.

  • Get up and running quickly for free, then scale according to the demands of your application.

  • Pay for and receive only the exact amount of compute you need at any given time with usage-based pricing. Usage under a certain amount per month is always free.

Simply secure:
  • Let users log in with familiar authentication providers that are built into App Services.

  • Control which users may read and write data on a per-field basis with role-based permissions that you can define declaratively or with a function.

  • Enforce data integrity by defining validation logic.

Synchronized:
  • Seamlessly sync data across devices with Atlas Device Sync .

  • Avoid writing complex synchronization logic with the Database SDKs.

Secure user authentication is essential for most apps. Some apps authenticate users with traditional email/password combinations. Others use API keys or third-party authentication providers like Facebook and Google. These methods often require a lot of complex boilerplate code.

App Services provides built-in user management and authentication methods. These features encapsulate complexity and make it easy to integrate third-party authentication providers. You can enable authentication providers in your server-side configuration then immediately log in from any client application using a Realm SDK.

To learn more about authentication in App Services, see Users & Authentication.

Modern applications require that data is available using consistent types and formats. Data consistency guarantees that all the application's components can work together. It's also important to make sure that any given piece of data is only accessible to an authorized user. For example, you might grant a user access to only their own data.

App Services validates data with a schema you define in the JSON schema standard. A schema serves as the source of truth for defining data types in your application. App Services also uses the schema to map data between your application and a MongoDB Atlas collection.

You can also configure App Services to secure data with role-based data access rules. These rules determine each user's access to every document for every request. A user can only insert, read, or modify data if both they and the document meet pre-defined conditions.

To learn more about defining a schema and access rules for your data, see collection rules.

Many applications require that some business logic runs on a server. Usually this logic deals with sensitive user data or interacting with external services. Apps might also need to respond in real time when something happens in the app or in an external service.

App Services lets you define serverless JavaScript functions called Atlas Functions. You can use Atlas Functions for the following common backend use cases:

  • Call from client applications with the Realm Web SDK.

  • Execute Atlas Functions in response to trigger events, like an update to a document in MongoDB or at a scheduled time.

  • HTTPS endpoints that execute a function in response to external applications.

To learn more about defining and using serverless functions, see Atlas Functions and Atlas Triggers.

Developers need efficient, secure data access. If the data is on a server, you need an API to access the data and prevent unauthorized access.

The Realm Database SDKs provide a secure MongoDB client to interact with data in your MongoDB data sources.

App Services's server-side rules ensures that users only read and modify permitted documents. Rules consist of one or more user roles for each collection. A role determines if a given user has permission to access and edit a document. App Services determines a role for each document in every request. It then enforces the role's permissions before responding.

GraphQL is a standard, open-source API architecture that is an alternative to REST and other HTTP APIs. It features a query language that lets you access only the data you need.

GraphQL has a couple of primary benefits for web developers:

  • Minimize Bandwidth: GraphQL queries specify the exact fields to return. This lets you to avoid fetching unnecessary data.

  • Minimize Roundtrips: A single GraphQL endpoint handles all requests. You can group your GraphQL queries into a single request to one endpoint instead of sending requests to multiple endpoints.

App Services generates a GraphQL API for your application based on your data model. The API includes a set of CRUD operations that you can access with a GraphQL client or in a HTTP request. You can also create custom resolvers backed by functions.

To learn more about the Atlas GraphQL API, see Atlas GraphQL API.

Traditionally developers query the database on the server and access the server from the client through a HTTP API. This requires more developer resources and lacks the flexibility of directly querying a database.

App Services includes the Query API, a powerful API that lets you access MongoDB Atlas data from the client. You can query Atlas like you're using a database driver and App Services enforces data access rules rules for all requests.

To learn more about the built-in MongoDB service, see MongoDB Data Sources.

Synchronizing data is a hard problem for mobile app developers. Device Sync provides offline-first sync capabilities for your mobile application. Client applications use Realm Database to persist data to the local device. When the device has a network connection, Sync seamlessly sends the data to the App. The app stores the data to a linked MongoDB Atlas data source, and updates the data on other client devices.

Device Sync provides conflict resolution to handle multiple users updating the same data. When combined with user authentication and management and schema validation and data access, Device Sync provides a secure way for your mobile clients to sync data across devices and with the cloud.

To explore a prebuilt app that you can customize, create a template app. Template applications are working apps that use App Services services to do things like:

  • Use Sync to synchronize data between mobile clients and the linked MongoDB Atlas collection.

  • Host a Todo web app using the GraphQL API

  • Host a Todo web app using the Realm Web SDK

  • Manage event-driven Database Triggers to update views in a separate collection

Template apps are working apps you can run and change to experiment with App Services. These apps are a good choice for developers who prefer to learn by experimentation, versus the tutorials, which provide a deeper, step-by-step process for building apps.

Check out our tutorials to learn more about how to build App Services Applications. Tutorials start with our Template Apps and and then walk you through building additional features powered by App Services, including Device Sync and Role-based Permissions.

  • App Services is a serverless application platform that makes it easy to deploy and scale.

  • You can build an app with custom logic via functions and triggers, custom permissions via rules, and authentication via third-party SSO.

  • App Services's built-in authentication system simplifies user data access. You can add users to your app and define permissions that control who can read and write data.

  • Backend use cases for App Services include:

    • Crunching data

    • Reacting to data changes in MongoDB Atlas

    • Interacting with third-party services

←  What are the Atlas Application Services?Get Started →
Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.