Framework
Tencent/wcdb avatar
Tencent/wcdb

WCDB: Tencent's SQLite Framework for Mobile Apps

WCDB is a cross-platform database framework developed by WeChat.

11,637 stars1,502 forksCNOASSERTION

At a glance

What is it?
WCDB is a cross-platform database framework built on SQLite and SQLCipher, used in WeChat and shipped as libraries for C++, Java, Kotlin, Swift and Objective-C. It bundles ORM, a query builder, encryption, corruption repair and Zstd field compression, but the README sends you to the wiki for install steps.
Who is it for?
WCDB fits teams already building native mobile or desktop apps in C++, Java, Kotlin, Swift or Objective-C who want SQLite plus encryption, repair and migration handled by one library, and who accept that setup instructions live in the wiki rather than the README. It is a poor fit for server-side or web workloads, for projects that want a pure SQLite dependency with no bundled forks, and for anyone unwilling to verify the LICENSE file, since the repository reports NOASSERTION.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 172 days ago.
What is it written in?
Mainly C, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The mobile database gap WCDB tries to close

SQLite ships with almost every phone, but using it directly in an app means writing SQL strings, managing schema upgrades by hand, and deciding what happens when the file is corrupted or needs to be encrypted. WCDB is Tencent's answer to that gap. The README describes it as a mobile database framework used in the WeChat application, based on SQLite and SQLCipher, with interfaces in C++, Java, Kotlin, Swift and Objective-C. The stated audience is app developers on iOS, macOS, Android, Windows, Linux and OpenHarmony, which the platform badge lists explicitly.

The scope is deliberately wider than a thin SQLite wrapper. The feature list covers ORM, a query builder the project calls WINQ, encryption, corruption recovery, SQL injection protection, model upgrade, full-text search, data migration and Zstd-based field compression. That is the checklist a mobile team usually assembles from several libraries. WCDB's bet is that one framework with shared underlying logic across five languages is easier to keep consistent than five separate stacks.

ORM and WINQ: how queries are actually built

The mechanism the README shows is a class definition bound to a table, with queries expressed in the host language rather than concatenated SQL. In C++, field references come from a macro, WCDB_FIELD, applied to a member of the mapped class. In Java and Kotlin, generated field objects such as DBSample.id expose methods like eq and gt. In Swift, the mapped type exposes a Properties namespace, so a predicate reads as Sample.Properties.id == 1. Objective-C uses the same idea with Sample.id.

The README gives one-line examples for insert, update, get and delete in each language. The C++ sample reads:

c++
database.insertObjects<Sample>(Sample(1, "text"), myTable);
auto objects = database.getAllObjects<Sample>(myTable, WCDB_FIELD(Sample::id) > 0);

WINQ is the layer that turns those expressions into SQL. The README says it frees developers from writing glue code to concatenate query strings, and lists anti-injection as a separate feature. Those two claims are related: when predicates are built from typed field objects instead of string concatenation, the framework controls how values reach the statement. The README does not spell out the parameter binding path, so treat the injection protection as a documented property of the query builder rather than something you can audit from the README alone.

Concurrency is handled by a connection pool. The README states that WCDB supports concurrent read-read and read-write access via connection pooling, and that SQLite's source and configuration were modified for mobile scenarios, with batch writes called out as an optimized case. No numbers accompany those statements.

Installing WCDB and running a first insert

The README does not contain install commands. It points to four wiki pages, one each for C++, Java/Kotlin, Swift and Objective-C, titled Building and Installing of WCDB followed by the language. Those pages are the source of truth for package names, Gradle or CocoaPods coordinates and platform requirements, and they are where you should start. What the repository layout does tell you is that the build pulls in vendored copies of sqlcipher, openssl and zstd as top-level directories, and that .gitmodules exists, so a clone needs its submodules initialized before a build can succeed.

bash
git clone https://github.com/Tencent/wcdb.git
cd wcdb
git submodule update --init --recursive

After that, the language-specific wiki page takes over. There are also podspec files at the repository root: WCDB.podspec, WCDB.cpp.podspec, WCDB.objc.podspec and WCDB.swift.podspec, plus a Package.swift for Swift Package Manager. Their existence signals which package managers the project supports, but the README does not document the exact dependency lines, so do not guess them.

For a first real use, the README's own example is the shortest path. In Java, the pattern is to insert an object, update one field by predicate, read objects back with a filter, and delete by predicate:

java
database.insertObject(new Sample(1, "text"), DBSample.allFields(), myTable);
database.updateValue("text2", DBSample.content, myTable, DBSample.id.eq(1));
List<Sample> objects = database.getAllObjects(DBSample.allFields(), myTable, DBSample.id.gt(0));
database.deleteObjects(myTable, DBSample.id.eq(1));

The equivalent Swift calls are insert, update, getObjects and delete, with the table passed as intoTable, fromTable and similar labels. What you should see after the insert is one row matching the Sample values, and after the update the content field changed to "text2" for id 1. The README shows these calls but not a runnable project, so the surrounding setup comes from the tutorials listed under Tutorials for WCDB C++, Java/Kotlin, Swift and Objc.

Encryption, repair and compression are the parts that matter

Three features in the README are worth more attention than the CRUD examples, because they are the ones that are painful to build yourself. Encryption is provided through SQLCipher, which the repository vendors as a submodule rather than linking an external build. Corruption recovery is described as a built-in repair kit, with no detail in the README about what it recovers or how it reports partial success. Data compression uses Zstd on specific fields of a table, configured once, after which the README says compression and decompression become transparent to developers and existing data is compressed automatically.

Data migration is the fourth. The README states that WCDB can migrate data from one database to another with simple configuration, and that developers do not need to care about the intermediate status and progress. That phrasing is the whole specification available here. If you need to show migration progress in a UI or resume an interrupted migration deliberately, the README gives you nothing to work with, and you would have to read the source or the tutorials.

Database model upgrade is bound to class definitions, so adding or removing a field is meant to follow from changing the class. That is a real convenience, but it also means schema evolution is coupled to your compiled classes. Teams that manage schema with hand-written migration scripts will find the model here inverted.

Where WCDB is the wrong choice

The most obvious limit is the one the README states outright: this is a mobile database framework. Its platform list includes Windows and Linux, so desktop and embedded targets are in scope, but nothing in the README positions it for server-side workloads, and the optimizations described are aimed at mobile terminals, including batch writes and mobile-oriented SQLite configuration changes. If you are building a backend service, a stock SQLite build or a server database is the more direct answer.

Second, the vendored forks are a commitment. The repository carries sqlcipher, openssl and zstd as top-level directories alongside src. That means a build compiles more than upstream SQLite, and upgrading any of those three components is a project-level decision rather than a package manager bump. Teams with strict dependency review processes should price that in.

Third, the README is a landing page, not documentation. Install steps, package coordinates and API details live in the wiki and the per-language tutorial pages. There is no API reference linked from the README for C++ or Objective-C, though the Android references are linked. If your team expects a single self-contained README, this will frustrate you. The CHANGELOG.md at the root is where release-level changes are recorded, and the most recent release listed is v2.1.16 from 2026-03-27, with v2.1.15 and v2.1.14 before it.

How WCDB differs from GRDB and plain SQLCipher

GRDB is the closest comparison for Swift developers and appears in the related searches around this project. Both give you an ORM over SQLite. The difference in approach is language scope. GRDB is a Swift library for Apple platforms. WCDB is one framework with a shared core and parallel interfaces in C++, Java, Kotlin, Swift and Objective-C, and the README states that in one project you can write database code in different languages with one WCDB, with global interfaces such as error monitoring working across all of them. If your app has a Swift UI layer and a C++ core that both touch the database, that shared-core design is the reason to pick WCDB over a single-language library.

SQLCipher is a different kind of comparison, because WCDB uses it rather than competing with it. Choosing SQLCipher directly gives you an encrypted SQLite with no ORM, no query builder and no repair kit. WCDB wraps it and adds those layers. The trade-off is that you inherit WCDB's release cadence and its vendored copy of SQLCipher instead of tracking Zetetic's releases yourself.

Maintenance, versioning and licence status

The repository is not archived, and the last push was on 2026-04-10. Releases are tagged on a rough multi-month cadence: v2.1.16 on 2026-03-27, v2.1.15 on 2025-11-11, v2.1.14 on 2025-09-02. That is a steady but not rapid rhythm, and it means a fix you need may wait for the next tag unless you build from master. The VERSION file at the root and the release badges in the README both point at 2.1.15, which lags the newest tag, so read CHANGELOG.md rather than trusting the badge.

On licensing, the repository reports NOASSERTION, which means GitHub could not map the LICENSE file to a known identifier. The README does not state a licence name either. That is a genuine gap for commercial adopters: the LICENSE file at the root is the document that matters, and it should be read before WCDB goes into a shipped product. This is not legal advice, and the practical step is to have whoever handles open source compliance read that file and the notices attached to the bundled sqlcipher, openssl and zstd directories, since those components carry their own terms.

Upgrade cost is dominated by two things: the submodules and the ORM binding. Moving to a new WCDB tag can mean moving the vendored SQLCipher and OpenSSL revisions, which is a compile-and-test cycle, not a version bump. On the code side, because the database model is bound to class definitions, a field change is a class change plus a migration path you have to reason about.

Editorial conclusion

WCDB fits teams already building native mobile or desktop apps in C++, Java, Kotlin, Swift or Objective-C who want SQLite plus encryption, repair and migration handled by one library, and who accept that setup instructions live in the wiki rather than the README. It is a poor fit for server-side or web workloads, for projects that want a pure SQLite dependency with no bundled forks, and for anyone unwilling to verify the LICENSE file, since the repository reports NOASSERTION. Before adopting, read the build page for your language, confirm the SQLCipher and OpenSSL submodules are in place, and check the CHANGELOG.md entry for the release you plan to pin.

Frequently asked questions

Where are the WCDB installation instructions?

The README does not include install commands. It links to four wiki pages named Building and Installing of WCDB C++, Java/Kotlin, Swift and Objc, and those pages carry the language-specific steps.

Does WCDB support database encryption?

Yes. The README states that WCDB supports database encryption via SQLCipher, which is vendored in the repository as a top-level directory alongside openssl and zstd.

Which programming languages can I use with WCDB?

The README lists five: C++, Java, Kotlin, Swift and Objective-C. The project states that interfaces in different languages share the same underlying logic, so database code written in different languages within one project will not conflict.

What is the WCDB licence?

The repository reports NOASSERTION, meaning GitHub could not match the LICENSE file to a known identifier, and the README does not name a licence. The LICENSE file at the repository root is the document to read.

Official sources

  1. Issues
  2. README
  3. Releases
  4. Tencent/wcdb on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/tencent-wcdb.svg)](https://hysenlabs.com/projects/tencent-wcdb)