ObjectBox Data Sync Setup Steps for Java (5 Minute tutorial)

Note: ObjectBox Data Sync always includes MongoDB Connector

1Register for Trial

2Pull Docker Image

docker pull objectboxio/sync-server-trial

3Update Build Configuration

Go to your gradle build file and make this change:

// Change from: apply plugin: 'io.objectbox' // To: apply plugin: 'io.objectbox.sync'

4Add @Sync to Entities

Add the import and annotation to each entity you want to sync:

import io.objectbox.annotation.Sync; // Add this import @Sync // Add this annotation @Entity public class YourEntity { // Your entity fields (no relationships to non-synced entities) }

5Generate Data Model

  • Build project → find gradle-support/objectbox-models/default.json
  • Copy to project root as objectbox-model.json

6Start Sync Server

Windows:
docker run --rm -it --volume "%cd%:/data" --publish 127.0.0.1:9999:9999 --publish 127.0.0.1:9980:9980 objectboxio/sync-server-trial --model /data/objectbox-model.json --unsecured-no-authentication --admin-bind 0.0.0.0:9980
Linux/Mac:
docker run --rm -it --volume "$(pwd):/data" --publish 127.0.0.1:9999:9999 --publish 127.0.0.1:9980:9980 objectboxio/sync-server-trial --model /data/objectbox-model.json --unsecured-no-authentication --admin-bind 0.0.0.0:9980

7Add Sync Client to App

Add these imports to your main application class:

import io.objectbox.sync.Sync; import io.objectbox.sync.SyncClient; import io.objectbox.sync.SyncCredentials;

Add this code after creating your ObjectBox store:

if (Sync.isAvailable()) { SyncClient syncClient = Sync.client(store, "ws://127.0.0.1:9999", SyncCredentials.none()).build(); syncClient.start(); logger.info("Sync client started"); }
Note:
  • Important: Never close ObjectBox store while sync is active (generally, there is rarely ever need to close the store, so if you feel you need to, be very careful with this)
  • Only sync entities that don't have relationships to non-synced entities
  • Vector embeddings are not yet syncable (reach out to us if you need this!)
  • Keep the store open throughout application lifecycle
  • To test, run app with different database paths and add data in one instance, verify it syncs to the other
ObjectBox Data Sync Server & MongoDB Connector Updates

ObjectBox Data Sync Server & MongoDB Connector Updates

We’re excited to announce the latest updates to ObjectBox Sync Server with our recent 2025-06-02 and 2025-05-27 releases. These updates bring significant improvements to data handling, authentication, and user interface, making your data synchronization experience even smoother.

Powering Up Your Data Flow

Exciting news for developers! Starting from late May 2025, ObjectBox Sync Server trials are publicly available as Docker images on Docker Hub. This means you can now effortlessly pull our Sync Server trial directly with a simple command:

This provides a straightforward, no-fuss way to start testing the Sync Server with your data. Each trial gives you 30 days per dataset to explore the full spectrum of ObjectBox Sync capabilities, allowing you to experience its power and ease of use firsthand.

New “JSON to Native” External Property Type

Managing complex, nested JSON structures and mapping them to native database objects can be cumbersome and lead to data integrity issues. One of the most powerful additions in the 2025-05-27 release is the new “JSON to native” property type mapping. This feature allows you to convert strings to nested documents in MongoDB, providing a more elegant way to handle complex data structures. Note: This feature requires client version 4.3 or newer to function correctly.

Here’s how you can implement it in your applications:

Key Advantages of “JSON to Native”

  • You can use your preferred JSON API to access the data
  • It supports nested documents and arrays
  • The order of keys is preserved, unlike with flex properties

Increased Maximum Sync Message Size

We’ve increased the maximum Sync message size to 32 MB, allowing for larger data transfers between clients and the server. This improvement is particularly useful for applications that need to synchronize larger chunks of data or complex documents. Clients version 4.3.0 and above are required.

Enhanced JWT Authentication

JWT authentication has been improved with more flexible options for public key configurations. Public key URLs can now refer directly to PEM public key or X509 certificate files, in addition to the previously supported JSON formats.

This means you can now use the following formats for your public key URL:

  1. Key-value JSON file
  2. JWKS (JSON Web Key Set)
  3. PEM public keyfile
  4. PEM certificate file

This enhancement provides more flexibility when integrating ObjectBox Sync Server with various authentication providers and existing security infrastructures..

Admin UI Improvements

The 2025-06-02 release includes several user experience improvements to the Admin UI:

  • Resolved issues on the GraphQL page for more reliable interactions
  • Enhanced menu UI with improved icons and optimized padding for better visual clarity and navigation

Getting Started with the ObjectBox Sync Server Trial (including the MongoDB Connector)

If you haven’t tried ObjectBox Sync Server yet, now is a great time to start! With our publicly available Docker images, you can quickly set up and start testing (just ensure Docker is installed on your system):

  • Note: this assumes you already have an existing data model (objectbox-model.json) ready. If you don’t, you can use the existing ObjectBox Sync Examples repository for a quick start.
  • Then, access the Admin UI by opening your web browser and navigate to http://127.0.0.1:9980
  • Follow the on-screen instructions in the Admin UI to activate your 30-day trial per dataset.

Or just go here to register and follow the step by step guide to get syncing now.
If you are using Java, you can also follow this 7 easy steps to sstart syncing your data in minutes.

What’s Next?

We’re continuously working to improve ObjectBox Sync to make your data synchronization experience seamless and robust. Stay tuned for more updates and improvements in the coming months!

For detailed information about these features, please refer to our documentation:

Data Sync Alternatives: Offline vs. Online Solutions

Data Sync Alternatives: Offline vs. Online Solutions

Ever waited to order or pay with a waiter holding their ordering device in the air for a signal? These moments show why offline-first Data Sync is essential. With more and more services relying on the availability of on-device apps and the IoT market projected to hit $1.1 trillion by 2026, choosing the right solution – particularly online-only or offline-first data sync – is more crucial than ever. In this blog, we discuss their differences and highlight common Data Sync alternatives.

What is Data Sync?

Data synchronization (Sync) aligns data between two or more devices to maintain consistency over time. It is an essential component in applications ranging from IoT and mobile apps to cloud computing. Challenges in data synchronization include asynchrony, conflicts, and managing data across flaky networks.

Data Sync vs. Data Replication

Data Synchronization is often confused with Data Replication. Nevertheless, they serve different purposes:

  • Data Replication: A unidirectional process (works in one direction only) that duplicates data across storage locations to ensure availability and prevent loss. It is simple but limited in its application, and efficiency, and lacks conflict management.
  • Data Synchronization: A bidirectional process that harmonizes all or a subset of data between two or more devices. It ensures consistency across devices and entails conflict resolution. It is inherently more complex but also more flexible.

Online vs Offline Solutions: Why Offline Sync Matters

Online-only synchronization solutions rely entirely on cloud infrastructure, requiring a stable internet connection to function. While these tools offer simplicity and scalability, their dependency on constant cloud connectivity brings limitations: Online Data Sync solutions cannot guarantee response rates and their speed varies depending on the network. They do not work when offline or in on-premise settings. Using an Online Sync solution often entails sharing the data and might not comply with data privacy requirements. So, do read the terms and conditions.

Offline-first solutions (offline Sync) focus on local data storage and processing, ensuring the app remains fully functional even without an internet connection. When a network is available, the app synchronizes seamlessly with a server, the cloud, or other devices as needed. These solutions are ideal for on-premise scenarios with unreliable or no internet access, mission-critical applications that must always operate, real-time and high-performance use cases, as well as situations requiring high data privacy and data security compliance.

A less discussed, but in our view also relevant point, is sustainability. While there might be exceptions depending on the use case, for most applications offline-first solutions are more resourceful and therefore more sustainable. If CO2 footprint or battery usage is of concern to you, you might want to look into offline-first Data Sync alternatives.

Now, let’s have a look at current options:

Data Sync Alternatives

(If you are on mobile, click here for a view that’s optimized for mobile)

Solution Company Type Offline Support Self-hosted Sync Decentralized Sync Database Type of DB OS/Platforms Languages Open-Source Component License Other Considerations Country
Firebase Google
 (Firebase was acquired by Google in 2014)
Online Local cache only, no persistence, syncs when online Cloud: Firebase Realtime Database; Edge: Only caching, no DB (called Firestore) Document store iOS, Android, Web Java
JavaScript
Objective-C
Swift
Kotlin
C++
Dart
C#
Python, Go, Node.js
proprietory Tied to Google Cloud, requires internet connectivity 🇺🇸
Supabase Supabase Online Limited Cloud DB: PostgreSQL Relational document store Primarily a cloud solution JavaScript/TypeScript
Flutter/Dart
C#
Swift
Kotlin
Python
Apache License 2.0 Supabase is mainly designed as a SaaS, for use cases with constant connectivity 🇸🇬
ObjectBox Sync ObjectBox Offline-first In development ObjectBox Object-oriented embedded NoSQL DB Android, Linux, Ubuntu,
Windows,
macOS, iOS,
QNX, Raspbian,
any POSIX system really,
any cloud (e.g. AWS/Azure/Google Cloud),
bare metal
C
C++
Java
Kotlin
Swift
Go
Flutter / Dart
Python
DB: Open source bindings, Apache 2.0, closed core Highly efficient (saves CPU, Memory, battery, and bandwidth); fully offline-first, supports on-premise settings, 100% cloud optional 🇩🇪
Couchbase (Lite + Couchbase Sync Gateway) Couchbase (a merger of Couch One and Membase) Online The CE Sync is a bare minimum and typically not usable; Self-hosted Sync with Couchbase Servers is available as part of their Enterprise offering ✅ as part of the Enterprise offering; gets expensive quickly Edge: Couchbase Lite; Server: Couchbase Multi-model NoSQL document-oriented database Couchbase Lite: iOS, Android, macOS, Linux, Windows, Raspbian and Raspberry Pi OS

Couchbase Sync Gateway: Red Hat Enterprise Linux (RHEL) 9.x, Alma Linux 9.x, Rocky Linux 9.x, Ubuntu, Debian (11.x, 12.x), Windows Server 2022
.Net
C
Go
Java
JavaScript info
Kotlin
PHP
Python
Ruby
Scala
Couchbase Lite is available under different licenses; the open source Community Edition does not get regular updates and misses many features especially around Sync (e.g. it does not include Delta Sync making it slow and expensive) Typically requires Couchbase servers, quickly gets expensive 🇺🇸
MongoDB Realm + Atlas Device Sync MongoDB
 (Realm was acquired by MongoDB in 2019)
Offline-First Cloud-based sync only Cloud: MongoDB, Edge: Mongo Realm DB MongoDB: NoSQL document store; RealmDB: Embedded NoSQL DB MongoDB: Linux
OS X
Solaris
Windows
Mongo Realm DB:
Android, iOS
more than 20 languages, e.g. Java, C, C#, C++ MongoDB changed its license from open source (AGPL) to MongoDB Inc.’s Server Side Public License (SSPL) in 2018. RealmDB is open source under the Apache 2.0 License. The Data Sync was proprietary.  Deprecated (in Sep 2024); End-of-life in Sep 2025; ObjectBox offers a migration option 🇺🇸

While SQLite does not offer a sync solution out-of-the-box, various vendors have built something on top, or integrated with SQLite giving them offline persistence.

Key Considerations for Choosing a Data Sync Solution

When selecting a synchronization solution, consider:

  1. Connectivity Requirements: Will the application function in offline environments; how will it work with flaky network conditions; how is the user experience when there is intermittent connectivity?
  2. Data Privacy & Security: How critical is it to ensure sensitive data remains local? Data compliance? How important is it that data is not breached?
  3. Scalability and Performance: What are the expected data loads and network constraints? How important is speed for the users? Is there any need to guarantee QoS parameters? How much will the cloud and networking costs be?
  4. Conflict Resolution: How does the solution handle data conflicts?
  5. Delta Sync: Does the solution always synchronize all data or only changes (data delta)? Can a subset of data be synchronized? How efficient is the Sync protocol (affecting costs and speed)?

The Shift Towards Edge Computing

The trend toward Edge Computing highlights the growing preference for offline-first solutions. By processing and storing data closer to its source, Edge Computing reduces cloud dependency, enhances privacy, and improves efficiency. Data synchronization plays an important role in this shift, ensuring seamless operation across decentralized networks.

Offline and online synchronization solutions each have their merits, but the rise of edge computing and data privacy concerns has propelled offline Sync to the forefront. Developers must assess their application’s unique requirements to select the most appropriate synchronization method. As the industry evolves, hybrid and offline-first solutions are going to dominate, offering the best balance of functionality, privacy, and performance.

The Critical Role of Databases for Edge AI

The Critical Role of Databases for Edge AI

Edge AI vs. Cloud AI

Edge AI is where Edge Computing meets AI

What is Edge AI? Edge AI (also: “on-device AI”, “local AI”) brings artificial intelligence to applications at the network’s edge, such as mobile devices, IoT, and other embedded systems like, e.g., interactive kiosks. Edge AI combines AI with Edge Computing, a decentralized paradigm designed to bring computing as close as possible to where data is generated and utilized.

What is Cloud AI? As opposed to this, cloud AI refers to an architecture where applications rely on data and AI models hosted on distant cloud infrastructure. The cloud offers extensive storage and processing power.

An Edge for Edge AI: The Cloud 

 

Cloud AI to Edge AI architecture

Example: Edge-Cloud AI setup with a secure, two-way Data Sync architecture

Today, there is a broad spectrum of application architectures combining Edge Computing and Cloud Computing, and the same applies to AI. For example, “Apple Intelligence” performs many AI tasks directly on the phone (on-device AI) while sending more complex requests to a private, secure cloud. This approach combines the best of both worlds – with the cloud giving an edge to the local AI rather than the other way around. Let’s have a look at the advantages on-device AI brings to the table.

Benefits of Local AI on the Edge

  • Enhanced Privacy. Local data processing reduces the risk of breaches.
  • Faster Response Rates. Processing data locally cuts down travel time for data, speeding up responses.
  • Increased Availability. On-device processing makes apps fully offline-capable. Operations can continue smoothly during internet or data center disruptions.
  • Sustainability/costs. Keeping data where it is produced and used minimizes data transfers, cutting networking costs and reducing energy consumption—and with it, CO2 emissions.

Challenges of Local AI on the Edge

  • Data Storage and Processing: Local AI requires an on-device database that runs on a wide variety of edge devices (Mobile,IoT, Embedded) and performs complex tasks such as vector search locally on the device with minimal resource consumption.
  • Data Sync: It’s vital to keep data consistent across devices, necessitating robust bi-directional Data Sync solutions. Implementing such a solution oneself requires specialized tech talent, is non-trivial and time-consuming, and will be an ongoing maintenance factor. 
  • Small Language Models: Small Language Models (SLMs) like Phi-2 (Microsoft Research), TinyStories (HuggingFace), and Mini-Giants (arXiv) are efficient and resource-friendly but often need enhancement with local vector databases for better response accuracy. An on-device vector database allows on-device semantic search with private, contextual information, reducing latency while enabling faster and more relevant outputs. For complex queries requiring larger models, a database that works both on-device and in the cloud (or a large on-premise server) is perfect for scalability and flexibility in on-device AI applications.

On-device AI Use Cases

On-device AI is revolutionizing numerous sectors by enabling real-time data processing wherever and whenever it’s needed. It enhances security systems, improves customer experiences in retail, supports predictive maintenance in industrial environments, and facilitates immediate medical diagnostics. On-device AI is essential for personalizing in-car experiences, delivering reliable remote medical care, and powering personal AI assistants on mobile devices—always keeping user privacy intact.

Personalized In-Car Experience: Features like climate control, lighting, and entertainment can be adjusted dynamically in vehicles based on real-time inputs and user habits, improving comfort and satisfaction. Recent studies, such as one by MHP, emphasize the increasing consumer demand for these AI-enabled features. This demand is driven by a desire for smarter, more responsive vehicle technology.

Remote Care: In healthcare, on-device AI enables on-device data processing that’s crucial for swift diagnostics and treatment. This secure, offline-capable technology aligns with health regulations like HIPAA and boosts emergency response speeds and patient care quality.

Personal AI Assistants: Today’s personal AI assistants often depend on the cloud, raising privacy issues. However, some companies, including Apple, are shifting towards on-device processing for basic tasks and secure, anonymized cloud processing for more complex functions, enhancing user privacy.

ObjectBox for On-Device AI – an edge for everyone

Edge Cloud spectrum

The continuum from Edge to Cloud

ObjectBox supports AI applications from Edge to cloud. It stands out as the first on-device vector database, enabling powerful Edge AI on mobile, IoT, and other embedded devices with minimal hardware needs. It works offline and supports efficient, private AI applications with a seamless bi-directional Data Sync solution, completely on-premise, and optional integration with MongoDB for enhanced backend features and cloud AI.

Interested in extending your AI to the edge? Let’s connect to explore how we can transform your applications.

MongoDB Realm & Device Sync alternatives – ObjectBox

MongoDB Realm & Device Sync alternatives – ObjectBox

With the recent deprecation of MongoDB Realm’s Device Sync feature, many developers need a reliable alternative for data synchronization in their applications. MongoDB announced that end-of-life for Atlas Data API, Custom HTTPS Endpoints, Atlas Device Sync (Realm Device Sync), Atlas Device SDKs (Realm), Atlas Data Lake (Preview) is only on the 30th of Sep 2025. And there are alternatives. For one, there is ObjectBox, a powerful and highly efficient Edge database with out-of-the-box Data Sync. We’re working on delivering all the functionalities and features you need and make ObjectBox a drop-in replacement for Mongo Device Sync asap. Please help us prioritize the most important things by filling out our questionnaire.

Now, let’s have a look at what ObjectBox can offer:

High-performance on-device database

ObjectBox is designed from the ground up for resource-efficiency and performance. It offers superfast database operations (CRUD: Create, Read, Update, Delete), often outperforming other database solutions, including Mongo Realm. However, we all know benchmarking is hard and it depends on the use case. So, check out our open-source benchmarks and make up your mind yourself. 

Migration with native language APIs

While we do hope that our intuitive native-language APIs (Swift, Java/Kotlin, C/C++, Flutter / Dart, Python) and setup are straightforward and quick for anyone to adapt, we are also listening to you and willing to invest in making the migration easier. Reach out to us with your feedback.

2024 CRUD performance ObjectBox Android

Cross-Platform Support

Like Mongo Realm, ObjectBox supports any POSIX system, including Android, iOS, Linux, Windows, and MacOS. This cross-platform compatibility ensures that you can maintain a consistent data layer across all your applications.

Efficient Sync Solution

ObjectBox offers its own Data Sync (ObjectBox Sync), which provides reliable and efficient data syncing between devices and servers. This feature is the one you are looking for if you relied on Realm’s Device Sync capabilities. ObjectBox was built with Data Sync in mind. We do have a cluster-mode that has been heavily tested for efficiency and reliability by industrial customers. We can handle millions of concurrent connections while providing realtime synchronization.

Offline-First Approach

ObjectBox embraces an offline-first architecture, allowing your apps to work seamlessly without an internet connection. Data is stored locally and can be synced between devices when offline or synced back to, e.g., a cloud once a connection becomes available again, ensuring a smooth user experience in various network conditions.

Active Development and Support

Unlike MongoDB Realm Device Sync (Atlas Device Sync), which is now deprecated, ObjectBox is actively developed and supported. This means you’ll benefit from regular updates, bug fixes, and new features, ensuring your data management solution remains robust and up-to-date.

Vector Search

We recently extended our database to become the very first on-device vector database enabling on-device AI (e.g. RAG, genAI, more efficient AI) on Mobile, IoT, and other embedded devices, see the vector search docs here. While extending our offering to serve MongoDB Realm customers wanting to migrate is the priority now, we’ll be extending Data Sync to synchronize vector embeddings next year too.

Conclusion

As MongoDB Realm’s Device Sync reaches its end of life, now is the perfect time to explore alternatives that cannot only replace but potentially enhance your app’s data management capabilities. To learn more about how ObjectBox can help you transition from Realm, visit the ObjectBox docs or schedule a call.