Different ways to host your database
There are some factors in how a database can be hosted and how it works that are worth considering:
Local storage - Having the data stored locally and available offline is an important feature in mobile applications. With their portability, connections to the network can be inconsistent on mobile devices. With data stored locally on a mobile device, apps continue to be usable, even when offline, leading to a much better user experience.
Cloud - Many mobile applications require data sharing across users, devices, and a centralized back end — a capability not supported by local-only storage solutions. This means that mobile developers need to save their app data to the cloud or a self-hosted server.
A cloud database has several advantages. For example, MongoDB Atlas, MongoDB’s multi-cloud application data platform, combines a flexible document data model and unified query interface, to provide a first-class developer experience that can power almost any class of application while meeting the most demanding requirements for resilience, scale, and data privacy. However, the driver used to communicate with Atlas requires network access at all times, making the experience less than optimal for mobile use cases where devices are constantly disconnecting and reconnecting.
Server - You may prefer to self-host your data, using your own servers and data center. A database that can be self-hosted and work with mobile is therefore a consideration. However, this again would require internet access to reach so faces the same limitations around connectivity.
Locally and in the cloud - One option that addresses connectivity issues and ensures real-time data sharing capabilities is to use a cloud database and a local database. Then, connect the two with a synchronization mechanism. This is the most common architecture for building real-time, reactive mobile apps that appear “always on” for users. However, developing and maintaining an effective synchronization mechanism requires writing lots of networking code, error handling, and conflict resolution logic that is often complex and time-consuming for mobile development teams to devote resources to. Taking time to build custom data syncing mechanisms also means less time can be spent on building differentiating features within the application.