Why sqlite as an embedded database?

I’m wondering why not embed Couchbase instead of sqlite? Not a full server. Perhaps a stripped down one node server (removing analytics and whatever else is not needed) ?

Have you not heard of Couchbase Lite? I don’t understand this question.

I should’ve been more clear. I was referring to CBL. In other words, my understanding is CBL uses sqlite as the storage engine. Why not use Couchstore as the storage engine?

Mostly because CouchStore is a low-level key-value store, not a database. If we’d started with that, we would have had to implement indexers and a full query engine on top of it, both of which SQLite already has.

CouchStore is also aimed at server systems with tons of RAM and disk space and fast I/O. For instance, it’s an append-only store that reclaims space by copying all the live data to a new file, then deleting the old one. This results in a lot of write amplification and needs lots of free space, which is not good for consumer-grade devices.

SQLite was designed to work well on modest hardware, and has been very painstakingly performance tuned over many years.

You might be interested to know that the very first attempt at Couchbase Mobile, back in 2011, literally ported CouchDB to iOS and Android. That included the Erlang and SpiderMonkey interpreters. The code was quite large and startup time was terrible. We abandoned the effort after a few months and started over with mobile-specific native code.