Develop with ease, architect with confidence

Couchbase Mobile allows you to easily develop mobile and edge applications that are extremely fast and reliable, even where no internet exists, maximizing business uptime. Couchbase Mobile is developer-friendly and can run anywhere – in the cloud, at the edge, and directly on mobile and edge devices – with automatic synchronization to ensure low latency, data integrity, and high availability for applications.

Solve your toughest challenges with an edge-ready mobile database

Speed

Guaranteed low latency and lightning-fast data access regardless of internet speed and bandwidth, essential for real-time, mission-critical applications.

Reliability

Uninterrupted access to data regardless of internet connectivity to provide reliable user experiences and 100% business uptime.

Security

Secures data in motion and at rest, and guarantees compliance with data privacy, sovereignty, and residency regulations.

Developer Agility

Development is fast and easy with full SQL support, simple-to-use APIs for database operations, and comprehensive platform and language support.

Enable modern mobile apps that are always fast and always on

See why you need an embedded database at the edge

Blazing speed, guaranteed

Couchbase Mobile provides real-time responsiveness through its ability to run anywhere without a central cloud control point, including on device, ensuring maximum speed and throughput for latency-sensitive applications.

100% uptime

With the combination of built-in synchronization and the ability to run as a self-contained partition in any part of the edge architecture, including on device, Couchbase Mobile provides the highest guarantees of availability for applications.

Superior security and data governance

Couchbase Mobile provides rock-solid security with role-based access control, AES 256 encryption at rest, and TLS 1.2 encryption on the wire. Comply with privacy regulations by isolating data with precision, sensitive information never has to leave the edge.

Accelerated development

Couchbase Mobile is developer-friendly:  

  • Native support for iOS, Android, and Windows platforms
  • .NET and Java support for desktop and web server apps
  • C-API for developing on nearly any embedded platform in any language
  • Full SQL support – reuse queries across platforms
  • Schema-less JSON format simplifies app upgrades without requiring tedious data migration

What does developing with Couchbase Mobile look like?

  // Create or open a database
let database: Database
do {
   database = try Database(name: "mydb")
} catch {
   fatalError("Error opening database")
}
// Create a new document (i.e. a record) in the database.
let mutableDoc = MutableDocument()
   .setFloat(2.0, forKey: "version")
   .setString("SDK", forKey: "type")
// Save it to the database.
do {
   try database.saveDocument(mutableDoc)
} catch {
   fatalError("Error saving document")
}
// Update a document.
if let mutableDoc = database.document(withID: mutableDoc.id)?.toMutable() {
   mutableDoc.setString("Swift", forKey: "language")
   do {
       try database.saveDocument(mutableDoc)
       let document = database.document(withID: mutableDoc.id)!
       // Log the document ID (generated by the database)
       // and properties
       print("Updated document id \(document.id), adding language \(document.string(forKey: "language")!)")
   } catch {
       fatalError("Error updating document")
   }
}
// Create a query to fetch documents of type SDK.
let query = QueryBuilder
   .select(SelectResult.all())
   .from(DataSource.database(database))
  .where(Expression.property("type").equalTo(Expression.string("SDK")))
// Run the query.
do {
   let result = try query.execute()
   print("Number of rows :: \(result.allResults().count)")
} catch {
   fatalError("Error running the query")
}
// Create replicators to push and pull changes to and from the cloud.
let targetEndpoint = URLEndpoint(url: URL(string: "ws://localhost:4984/getting-started-db")!)
var replConfig = ReplicatorConfiguration(database: database, target: targetEndpoint)
replConfig.replicatorType = .pushAndPull
 
// Add authentication.
replConfig.authenticator = BasicAuthenticator(username: "john", password: "pass")
 
// Create replicator (make sure to add an instance or static variable named replicator)
let replicator = Replicator(config: replConfig)
// Optionally,Listen to replicator change events.
replicator.addChangeListener { (change) in
if let error = change.status.error as NSError? {
       print("Error code :: \(error.code)")
     }
}
// Start replication.
replicator.start()
  // Create or open database
var database = new Database("mydb");
 
// Create a new document (i.e. a record) in the database
string id = null;
using (var mutableDoc = new MutableDocument())
{
   mutableDoc.SetFloat("version", 2.0f)
       .SetString("type", "SDK");
 
   // Save it to the database
   database.Save(mutableDoc);
   id = mutableDoc.Id;
}
 
// Update a document
using (var doc = database.GetDocument(id))
using (var mutableDoc = doc.ToMutable())
{
   mutableDoc.SetString("language", "C#");
   database.Save(mutableDoc);
 
   using (var docAgain = database.GetDocument(id))
   {
       Console.WriteLine($"Document ID :: {docAgain.Id}");
       Console.WriteLine($"Learning {docAgain.GetString("language")}");
   }
}
 
// Create a query to fetch documents of type SDK
// i.e. SELECT * FROM database WHERE type = "SDK"
using (var query = QueryBuilder.Select(SelectResult.All())
   .From(DataSource.Database(database))
   .Where(Expression.Property("type").EqualTo(Expression.String("SDK"))))
{
   // Run the query
   var result = query.Execute();
   Console.WriteLine($"Number of rows :: {result.AllResults().Count}");
}
 
// Create replicator to push and pull changes to and from the cloud
var targetEndpoint = new URLEndpoint(new Uri("ws://localhost:4984/getting-started-db"));
var replConfig = new ReplicatorConfiguration(database, targetEndpoint);
 
// Add authentication
replConfig.Authenticator = new BasicAuthenticator("john", "pass");
 
// Optionally, Create replicator (make sure to add an instance or static variable
// named _Replicator)
var _Replicator = new Replicator(replConfig);
_Replicator.AddChangeListener((sender, args) =>
{
   if (args.Status.Error != null)
   {
       Console.WriteLine($"Error :: {args.Status.Error}");
   }
});
 
// Start replicator
_Replicator.Start();
// Create or open a database
val cfg = DatabaseConfigurationFactory.create()
val database = Database(  "mydb", cfg)
​// Create a new document (i.e. a record) in the database.
var mutableDoc = MutableDocument().setFloat("version", 2.0f).setString("type", "SDK")
// Save it to the database.
database.save(mutableDoc)
​// Retrieve and update a document.
mutableDoc = database.getDocument(mutableDoc.id)!!.toMutable().setString("language", "Java")
database.save(mutableDoc)
// Retrieve immutable document and log the document ID generated by the database and some document properties
val document = database.getDocument(mutableDoc.id)!!
Log.i(TAG, "Document ID :: ${document.id}")
Log.i(TAG, "Learning ${document.getString("language")}")
​// Create a query to fetch documents of type SDK.
val rs = QueryBuilder.select(SelectResult.all())
  .from(DataSource.database(database))
  .where(Expression.property("type").equalTo(Expression.string("SDK")))
  .execute()
Log.i(TAG, "Number of rows :: ${rs.allResults().size}")
​
// Create a replicator to push and pull changes to and from the cloud.
val replicator = Replicator(
  ReplicatorConfigurationFactory.create(
      database = database,
      target = URLEndpoint(URI("ws://localhost:4984/getting-started-db")),
      type = ReplicatorType.PUSH_AND_PULL,
      authenticator = BasicAuthenticator("sync-gateway", "password".toCharArray())
  )
)
​// Optional, Listen to replicator change events.
replicator.addChangeListener { change ->
  val err = change.status.error
  if (err != null) {
      Log.i(TAG, "Error code ::  ${err.code}")
  }
}
​// Start replication.
replicator.start()
  // Open or create the database
CBLError err;
CBLDatabase* database = CBLDatabase_Open(FLSTR("mydb"), NULL, &err);
if(!database) {
   // Error handling.  For brevity, this is truncated in the rest of the snippet
   fprintf(stderr, "Error opening database (%d / %d)\n", err.domain, err.code);
   FLSliceResult msg = CBLError_Message(&err);
   fprintf(stderr, "%.*s\n", (int)msg.size, (const char *)msg.buf);
   FLSliceResult_Release(msg);
   return;
}
 
// Create a new document (i.e. a record) in the database
CBLDocument* mutableDoc = CBLDocument_Create();
FLMutableDict properties = CBLDocument_MutableProperties(mutableDoc);
FLMutableDict_SetFloat(properties, FLSTR("version"), 3.0f);
 
// Save it to the database
if(!CBLDatabase_SaveDocument(database, mutableDoc, &err)) {
   // Failed to save, do error handling as above
   return;
}
 
FLStringResult id = FLSlice_Copy(CBLDocument_ID(mutableDoc));
CBLDocument_Release(mutableDoc);
 
// Update a document
mutableDoc = CBLDatabase_GetMutableDocument(database, FLSliceResult_AsSlice(id), &err);
if(!mutableDoc) {
   return;
}
 
properties = CBLDocument_MutableProperties(mutableDoc);
FLMutableDict_SetString(properties, FLSTR("language"), FLSTR("C"));
if(!CBLDatabase_SaveDocument(database, mutableDoc, &err)) {
   return;
}
 
// Note const here, means readonly
const CBLDocument* docAgain = CBLDatabase_GetDocument(database, FLSliceResult_AsSlice(id), &err);
if(!docAgain) {
     return;
}
 
// No copy this time, so no release later (notice it is not FLStringResult this time)
FLString retrievedID = CBLDocument_ID(docAgain);
FLDict retrievedProperties = CBLDocument_Properties(docAgain);
FLString retrievedLanguage = FLValue_AsString(FLDict_Get(retrievedProperties, FLSTR("language")));
printf("Document ID :: %.*s\n", (int)retrievedID.size, (const char *)retrievedID.buf);
 
CBLDocument_Release(mutableDoc);
CBLDocument_Release(docAgain);
FLSliceResult_Release(id);
 
// Create a query to fetch documents of type SDK
int errorPos;
CBLQuery* query = CBLDatabase_CreateQuery(database, kCBLN1QLLanguage, FLSTR("SELECT * FROM _ WHERE type = \"SDK\""), &errorPos, &err);
if(!query) {
   // Failed to create query, do error handling as above
   // Note that errorPos will contain the position in the N1QL string
   // that the parse failed, if applicable
   return;
}
 
CBLResultSet* result = CBLQuery_Execute(query, &err);
if(!result) {
   // Failed to run query, do error handling as above
   return;
}
 
CBLResultSet_Release(result);
CBLQuery_Release(query);
 
// Create replicator to push and pull changes to and from the cloud
CBLEndpoint* targetEndpoint = CBLEndpoint_CreateWithURL(FLSTR("ws://localhost:4984/getting-started-db"), &err);
if(!targetEndpoint) {
   // Failed to create endpoint, do error handling as above
   return;
}
 
CBLReplicatorConfiguration replConfig;
CBLAuthenticator* basicAuth = CBLAuth_CreatePassword(FLSTR("john"), FLSTR("pass"));
memset(&replConfig, 0, sizeof(replConfig));
replConfig.database = database;
replConfig.endpoint = targetEndpoint;
replConfig.authenticator = basicAuth;
 
CBLReplicator* replicator = CBLReplicator_Create(&replConfig, &err);
CBLAuth_Free(basicAuth);
CBLEndpoint_Free(targetEndpoint);
if(!replicator) {
   // Failed to create replicator, do error handling as above
   return;
}
 
// Optionally, add replication listener
CBLListenerToken* token = CBLReplicator_AddChangeListener(replicator, getting_started_change_listener, NULL);
 
// Start the replicator
CBLReplicator_Start(replicator, false);

Related features and capabilities

Couchbase Lite

Couchbase Lite, our embedded database, manages, and stores data locally on the device. It has full CRUD and SQL++ query functionality, and supports all major platforms including iOS, OS X, tvOS, Android, Linux, Windows, Xamarin, Kotlin, Ionic, and more.

Learn more
Sync Gateway

Couchbase Mobile includes a secure gateway for data synchronization over the web, as well as peer-to-peer sync between Couchbase Lite instances, with support for authentication, authorization, and fine-grained access control. Synchronization is bi-directional and elastically scalable in real time as capacity demands change throughout the day. Choose from fully managed sync with Capella App Services, or install and manage Couchbase Sync Gateway yourself.

Learn more
C-API

The C-API allows embedding Couchbase Lite on any embedded application (embedded Linux, ARM32, ARM64). Developers can use FFI to bind to C-API for any language (Dart, Rust, Python, Node.js, etc.).

Learn more
Rest APIs

REST APIs provide full programmatic access for reading and writing data, as well as securely administering synchronization over the web. Input and output is JSON, and it’s easy to integrate with existing apps and REST architectures.

Learn more
JSON

Couchbase Mobile uses JSON as its lightweight and flexible data modeling language. All data is stored and transmitted as JSON, including the embedded database, the database server, REST APIs, stream APIs, and batch APIs.

Learn more
Events

Couchbase Mobile raises events when data changes in the database. These events can be subscribed to on both the device and server.

Couchbase Server

Couchbase Server, our database server, manages and stores data in the cloud. It scales easily to billions of records and terabytes of data, supports millions of concurrent users, and provides 24x365 uptime.

Learn more

Products

Couchbase Lite

Embedded NoSQL, JSON document database and alternative to SQLite with full CRUD. Built from the ground up as a native database for mobile devices and custom embedded hardware. Couchbase Lite leads all SQLite alternatives.

Learn more
Sync Gateway

Couchbase Mobile includes a secure gateway for data synchronization over the web, with support for authentication, authorization, and fine-grained access control. Choose from fully managed sync with Capella App Services, or install and manage Couchbase Sync Gateway yourself.

Learn More

Platforms & Languages

Platforms

Couchbase Mobile supports all major mobile platforms in addition to traditional desktop and server environments.

Languages

Couchbase Mobile supports all major mobile programming languages.

Customer success spotlight

PepsiCo relies on Couchbase to power apps that operate even when offline, and sync in real time when connected, allowing reps in the field to service customers anywhere – regardless of internet speed or connectivity.

Learn More
Sync in real time
Service customers anywhere

Doddle’s storefront package pickup and return service uses a mobile app that enables customers and employees to quickly manage transactions anytime, with or without a network connection.

Learn More
<3 months of development
100+ stores

BD radically changed the traditional patient/doctor relationship by enabling remote patients to share real-time health data with their doctors for immediate diagnostics and care.

Learn More
1K+ employees
50+ countries

Tommy Hilfiger transformed the buying experience for retailers by creating a powerful digital showroom that minimizes the shipment of sample garments.

Learn More
80% fewer samples produced

Use Cases & Solutions

Edge Computing

Deploy and run mobile applications across complex edge computing topologies to meet any speed, availability or security requirement.

Learn more
Peer-to-Peer Services

Achieve real-time responsiveness and 100% uptime for offline-first applications with an embedded database and direct collaboration between edge devices.

Learn More
Field Service

Enable field employees with one platform to manage data from different sources, push that data to the edge, and ensure that data is available online and offline.

Learn More
IoT Data Management

Manage, support, and drive real-time data insights at the edge with embedded and cloud databases, sync, and guaranteed data availability.

Learn More

Ready to create amazing customer experiences?

The easiest and fastest way to begin with Couchbase

Author