ANN: Couchbase Lite for C (preview)

A number of people have asked us for a Couchbase Lite that isn’t tied to a runtime like Java, .NET or Cocoa, for use on Linux or on embedded systems like the Raspberry Pi. Others have asked for additional language bindings like JavaScript, Python, Rust…

I’m happy to say that we’re giving the first group their wish, and making the second group’s wishes more easily attainable. Couchbase Lite For C is a full implementation of Couchbase Lite with an ANSI C API, and no dependencies on a high-level runtime.

  • The API functions are mostly one-to-one compatible with the class methods in the 2.x API. Some things are necessarily different because C does not come with automatic memory management or a high-level class library, but if you’re used to the Java/C#/Swift/Obj-C API you should be right at home — see some small code examples.
  • It’s portable to any Unix-like OS (or recent MS Windows); it just needs a filesystem and TCP/IP networking.
  • It should run on fairly constrained systems like the Raspberry Pi (but not Arduino…)
  • The C API is easy to write language bindings for; there’s an example Python3 binding included.
  • There’s also a C++ wrapper API that’s nicer to use, if you like C++.

That being said, this is early access to an alpha-quality project. Some functionality isn’t ready yet, there’s been little testing, and we haven’t yet ported it beyond macOS/Windows/Ubuntu. In other words, this is not yet an official Couchbase product, and we are not yet providing official support. But we are actively working on it, and we hope to get community involvement too.

A special shout-out to the brave few who have been learning and hacking on the internal Couchbase Lite Core API: Thanks for inspiring us to make this; we hope you’ll switch over to Couchbase Lite For C (it should be pretty easy) and keep helping out!


@jens I will probably adhere to this when Android and iOS is available as well. Until there I will keep tinkering directly with couchbase-lite-core. I will definitely try to keep an eye on this as well. Thanks and congratulations for this effort and release!

Would you be willing to contribute to these platforms ? That is one of our primary motivations to release this as a community project.

@priya.rajagopal I don’t have the necessary knowledge to contribute to this yet. I’m into this for the last two months. I’m still scratching my head in many aspects.

But… I keep wondering myself… If Couchbase Lite for C is written on top of couchbase-lite-core, why not only maintain couchbase-lite-core as THE framework for low level C/C++ usages? It already builds for all OS’s and does what it is supposed to.

What are the REAL benefits of using Couchbase Lite for C instead of couchbase-lite-core directly?


Best regards,


There is a lot missing from lite core that lite provides such as TLS transport and network reachability. Also as you’ve noticed it is difficult to work with because the concepts are a bit vague and disjointed. The benefit would be having a consistent API with the other platforms. You could possibly also think of lite for C as an evolution of lite core.

Other reasons for keeping the separation:

  • We want our public APIs to be compatible across platforms; the LiteCore API doesn’t match our API spec (it just evolved over time.)
  • We need to be able to change LiteCore’s API freely to add features or fix bugs.

But over time the two will grow closer together, and maybe eventually there will only be Couchbase Lite_C.


Thanks for your replies. I’m looking forward to use of a complete Couchbase Lite for C then.

The main reason that made me look and found for couchbase is the replication. While Couchbase Lite for C doesn’t have that implemented, I prefer to stick myself to Couchbase Lite Core. :slight_smile:

Couchbase Lite for C has replication implemented, just not with TLS (the same as LiteCore). It’s incomplete compared to other Couchbase Lite implementations but it has everything LiteCore provides except for query which is being redone in a C-friendly way.

Couchbase Lite for C will most likely end up being a supported product while LiteCore will never (barring its assimilation into the C library).

I wonder if at last couchbase lite C will support android. I need this support and I see an android cmake file.

Is there any update on the status of this or a good place to ask questions about it? I’d be willing to help get Android support working if there’s a roadmap for it and could get some help with where the current troubles are.