explaingit

tencent/mmkv

📈 Trending18,582C++Audience · developerComplexity · 2/5ActiveSetup · easy

TLDR

Fast, lightweight key-value storage library for mobile and desktop apps with instant persistence and multi-process support.

Mindmap

mindmap
  root((MMKV))
    What it does
      Key-value storage
      Instant persistence
      Multi-process safe
    How it works
      Memory mapping
      Protocol Buffers
      Synchronized disk
    Platforms
      Android
      iOS and macOS
      Windows and POSIX
    Use cases
      Mobile app data
      User preferences
      Session caching
    Tech stack
      C++ core
      mmap files
      protobuf format

Things people build with this

USE CASE 1

Store user preferences and settings in mobile apps without writing custom database code.

USE CASE 2

Cache session data or temporary state that persists across app restarts.

USE CASE 3

Share configuration data safely between multiple processes on the same device.

Tech stack

C++mmapProtocol BuffersAndroidiOSmacOSWindows

Getting it running

Difficulty · easy Time to first run · 5min
License could not be detected automatically. Check the repository's LICENSE file before use.

In plain English

MMKV is a key-value storage library originally developed for use in the WeChat application and open-sourced by Tencent. Key-value storage is the simplest form of database: you save a piece of data under a label (the key) and retrieve it later using that same label. MMKV is designed to be fast, small in binary size, and easy to drop into mobile and desktop apps. It works on Android, iOS, macOS, Windows, POSIX-compatible systems, and HarmonyOS NEXT. The library uses two techniques to achieve its performance: mmap, which keeps a file on disk continuously synchronized with a region of memory so that writes are almost instant, and Protocol Buffers (protobuf), Google's compact binary format for encoding data. A key convenience feature is that all changes are saved immediately, there is no separate save, sync, or apply call needed. On Android, MMKV also supports multi-process access, meaning multiple separate processes running on the same device can safely read and write to the same storage simultaneously. Installation differs by platform. Android projects add it through Maven (a package repository). iOS and macOS projects use CocoaPods (another package manager). Windows projects integrate the source directly. The library adds roughly 50KB to Android app size per CPU architecture, less than 30KB on iOS, and about 10KB on Windows. Bindings also exist for Flutter, Kotlin, Golang, and other languages beyond the native C++ core.

Copy-paste prompts

Prompt 1
Show me how to set up MMKV in an Android project and save a user's login token so it persists after the app closes.
Prompt 2
How do I use MMKV in an iOS app to store and retrieve user preferences like theme and language settings?
Prompt 3
Write example code for using MMKV in Flutter to cache API responses and display them offline.
Prompt 4
Explain how MMKV's multi-process support works on Android and when I would need it instead of SharedPreferences.
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.