Cette page est affichée en anglais. Une traduction française est en cours.
SkillsApr 28, 2026·3 min de lecture

WCDB — WeChat Cross-Platform Database Framework

A high-performance, cross-platform database framework developed by WeChat, built on SQLite with ORM, encryption, repair, and migration capabilities.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
WCDB
Commande d'installation directe
npx -y tokrepo@latest install 69160781-429a-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

WCDB is an efficient, complete, and easy-to-use mobile database framework created by the WeChat team at Tencent. It wraps SQLite with an ORM layer, built-in encryption via SQLCipher, automatic corruption repair, and schema migration tools. WCDB powers the database layer inside WeChat, handling billions of records across its user base.

What WCDB Does

  • Provides a language-integrated ORM for Swift, Objective-C, Java, and Kotlin
  • Encrypts databases transparently via an integrated SQLCipher layer
  • Repairs corrupted database files automatically with its built-in recovery tool
  • Supports schema migration without manual ALTER TABLE statements
  • Offers full-text search using the FTS5 module with a simplified API

Architecture Overview

WCDB layers an ORM, connection pooling, and a CRUD interface on top of a customized SQLite build. The framework compiles SQLCipher into the same binary for seamless encryption. A write-ahead logging (WAL) mode and connection pool allow concurrent read/write access. The repair module can reconstruct a valid database from a corrupted file by reading raw B-tree pages.

Self-Hosting & Configuration

  • Add WCDB via CocoaPods, Swift Package Manager, or Gradle for Android
  • Encryption is enabled by passing a cipher key when opening the database
  • Schema migrations are declared in code and applied automatically on open
  • Enable WAL mode for better concurrent read/write performance (on by default)
  • Configure the repair module to run automatically when corruption is detected

Key Features

  • Integrated SQLCipher encryption with no separate dependency
  • Automatic database repair recovers data from corrupted files
  • ORM maps class properties to columns with compile-time type safety
  • Connection pool with reader-writer separation for concurrent access
  • Full-text search with Chinese tokenizer support

Comparison with Similar Tools

  • Raw SQLite — requires manual SQL strings; WCDB provides ORM and encryption out of the box
  • Realm — custom storage engine; WCDB stays on SQLite for broad compatibility
  • Room (Android) — annotation-based ORM without encryption or repair; WCDB includes both
  • FMDB — thin Objective-C wrapper; WCDB adds ORM, encryption, migration, and repair

FAQ

Q: Is WCDB only for WeChat? A: No. It is a general-purpose open-source framework usable in any iOS or Android application.

Q: Does WCDB support Kotlin Multiplatform? A: WCDB has native SDKs for iOS (Swift/ObjC) and Android (Java/Kotlin). It is not a Kotlin Multiplatform library.

Q: How does the repair feature work? A: WCDB reads raw SQLite B-tree pages and reconstructs a valid database, salvaging as much data as possible from the corrupt file.

Q: Can I use WCDB without encryption? A: Yes. Encryption is optional; omit the cipher key to use a plain SQLite database.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires