{"_id":"@bsky.app/react-native-mmkv","_rev":"8-7a6f468f1c63deb29bac60dc4bbe087a","name":"@bsky.app/react-native-mmkv","dist-tags":{"latest":"2.12.5"},"versions":{"2.12.4":{"name":"@bsky.app/react-native-mmkv","version":"2.12.4","keywords":["react-native","ios","android"],"author":{"url":"https://github.com/mrousavy","name":"Marc Rousavy","email":"marcrousavy@hotmail.com"},"license":"(MIT AND BSD-3-Clause)","_id":"@bsky.app/react-native-mmkv@2.12.4","maintainers":[{"name":"estrattonbailey","email":"npm@esb.lol"},{"name":"mozzius","email":"mozzius@protonmail.com"}],"homepage":"https://github.com/bluesky-social/react-native-mmkv#readme","bugs":{"url":"https://github.com/bluesky-social/react-native-mmkv/issues"},"dist":{"shasum":"b75ca0ed6ab8e12b08d958f85f3d0ff67fb91b55","tarball":"https://registry.npmjs.org/@bsky.app/react-native-mmkv/-/react-native-mmkv-2.12.4.tgz","fileCount":156,"integrity":"sha512-4VJrVyVqLIvr6B8nzXeWHtSffW9/pAzLT4zwgE+b2ULfoIokW0jPd2+ioKNqotBhx6i4KsryGJcUArX+RxKpcg==","signatures":[{"sig":"MEYCIQDYxOxWz4/Tfy35bR1wi/HzIs6yiMPNgMwWCU5iX18qyQIhANzgfuQtGVx/hBFAl0gqIXwqD5lJf1ghMDONor1k2cp/","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3278552},"jest":{"preset":"react-native","modulePathIgnorePatterns":["<rootDir>/example/node_modules","<rootDir>/lib/"]},"main":"lib/commonjs/index","types":"lib/typescript/index.d.ts","module":"lib/module/index","source":"src/index","gitHead":"6b1ab151004a774c269062f6338f45801b31711c","scripts":{"lint":"eslint \"**/*.{js,ts,tsx}\"","pods":"cd example && yarn pods","test":"jest","example":"yarn --cwd example","lint-ci":"yarn lint -f ./node_modules/@firmnav/eslint-github-actions-formatter/dist/formatter.js","prepack":"bob build","prepare":"git submodule update --init --recursive && bob build","release":"release-it","lint-cpp":"scripts/clang-format.sh","bootstrap":"git submodule update --init --recursive && yarn && cd example && yarn bootstrap","typescript":"tsc --noEmit","update-submodule":"git submodule update --remote --merge"},"_npmUser":{"name":"mozzius","email":"mozzius@protonmail.com"},"prettier":{"useTabs":false,"tabWidth":2,"quoteProps":"consistent","singleQuote":true,"trailingComma":"es5"},"release-it":{"git":{"tagName":"v${version}","commitMessage":"chore: release ${version}"},"npm":{"publish":true},"github":{"release":true},"plugins":{"@release-it/conventional-changelog":{"preset":{"name":"conventionalcommits","types":[{"type":"feat","section":"✨ Features"},{"type":"fix","section":"🐛 Bug Fixes"},{"type":"perf","section":"💨 Performance Improvements"},{"type":"chore(deps)","section":"🛠️ Dependency Upgrades"},{"type":"docs","section":"📚 Documentation"}]}}}},"repository":{"url":"git+https://github.com/bluesky-social/react-native-mmkv.git","type":"git"},"_npmVersion":"10.8.2","description":"The fastest key/value storage for React Native. ~30x faster than AsyncStorage! Works on Android, iOS and Web.","directories":{},"_nodeVersion":"20.19.4","eslintConfig":{"root":true,"rules":{"prettier/prettier":["error",{"useTabs":false,"tabWidth":2,"quoteProps":"consistent","singleQuote":true,"trailingComma":"es5"}]},"extends":["@react-native-community","prettier"],"plugins":["jest"]},"eslintIgnore":["node_modules/","lib/"],"react-native":"lib/module/index","codegenConfig":{"name":"reactnativemmkv","type":"modules","jsSrcsDir":"./lib/module"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"packageManager":"yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e","devDependencies":{"jest":"^29.7.0","react":"^18.2.0","eslint":"^8.56.0","prettier":"^3.2.5","release-it":"^15.10.1","typescript":"^5.3.3","@types/jest":"^29.5.12","@types/react":"^18.2.55","react-native":"^0.71.6","eslint-plugin-jest":"^27.8.0","react-test-renderer":"^18.2.0","eslint-plugin-ft-flow":"^3.0.4","@tsconfig/react-native":"^3.0.3","react-native-builder-bob":"^0.20.4","@typescript-eslint/parser":"^7.0.1","@types/react-test-renderer":"^18.0.7","@testing-library/react-native":"^12.4.3","metro-react-native-babel-preset":"^0.77.0","@typescript-eslint/eslint-plugin":"^7.0.1","@release-it/conventional-changelog":"^8.0.1","@react-native-community/eslint-config":"^3.2.0","@react-native-community/eslint-plugin":"^1.3.0","@jamesacarr/eslint-formatter-github-actions":"^0.2.0"},"peerDependencies":{"react":"*","react-native":">=0.71.0"},"_npmOperationalInternal":{"tmp":"tmp/react-native-mmkv_2.12.4_1759831843410_0.10707686393193883","host":"s3://npm-registry-packages-npm-production"},"react-native-builder-bob":{"output":"lib","source":"src","targets":["commonjs","module",["typescript",{"project":"tsconfig.json"}]]}},"2.12.5":{"name":"@bsky.app/react-native-mmkv","version":"2.12.5","keywords":["react-native","ios","android"],"author":{"url":"https://github.com/mrousavy","name":"Marc Rousavy","email":"marcrousavy@hotmail.com"},"license":"(MIT AND BSD-3-Clause)","_id":"@bsky.app/react-native-mmkv@2.12.5","maintainers":[{"name":"estrattonbailey","email":"npm@esb.lol"},{"name":"mozzius","email":"mozzius@protonmail.com"}],"homepage":"https://github.com/bluesky-social/react-native-mmkv#readme","bugs":{"url":"https://github.com/bluesky-social/react-native-mmkv/issues"},"dist":{"shasum":"eb17d31a6158c74393f617a1763ac223ff3f83a6","tarball":"https://registry.npmjs.org/@bsky.app/react-native-mmkv/-/react-native-mmkv-2.12.5.tgz","fileCount":156,"integrity":"sha512-3vUz1nQY1DiKIPAWRkpp5ZGxH5f2G6Ui0UuQuEYjYv81xx1qFcSzS9KQ2sHcOKYdkOM9amWV2Q8TQCxt1lrAHg==","signatures":[{"sig":"MEYCIQDlQPdSZbgrG2BYMlNtvFHalp9uOVl9lrL66oAeMrVbRAIhAO8KeHp9CMhPxtjw07tCgFSWxnbNF5m3fUp2FXn10OYz","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3278770},"jest":{"preset":"react-native","modulePathIgnorePatterns":["<rootDir>/example/node_modules","<rootDir>/lib/"]},"main":"lib/commonjs/index","types":"lib/typescript/index.d.ts","module":"lib/module/index","source":"src/index","gitHead":"7e9feb873bcd37ad075368ed05da47a49e4c6490","scripts":{"lint":"eslint \"**/*.{js,ts,tsx}\"","pods":"cd example && yarn pods","test":"jest","example":"yarn --cwd example","lint-ci":"yarn lint -f ./node_modules/@firmnav/eslint-github-actions-formatter/dist/formatter.js","prepack":"bob build","prepare":"git submodule update --init --recursive && bob build","release":"release-it","lint-cpp":"scripts/clang-format.sh","bootstrap":"git submodule update --init --recursive && yarn && cd example && yarn bootstrap","typescript":"tsc --noEmit","update-submodule":"git submodule update --remote --merge"},"_npmUser":{"name":"mozzius","email":"mozzius@protonmail.com"},"prettier":{"useTabs":false,"tabWidth":2,"quoteProps":"consistent","singleQuote":true,"trailingComma":"es5"},"release-it":{"git":{"tagName":"v${version}","commitMessage":"chore: release ${version}"},"npm":{"publish":true},"github":{"release":true},"plugins":{"@release-it/conventional-changelog":{"preset":{"name":"conventionalcommits","types":[{"type":"feat","section":"✨ Features"},{"type":"fix","section":"🐛 Bug Fixes"},{"type":"perf","section":"💨 Performance Improvements"},{"type":"chore(deps)","section":"🛠️ Dependency Upgrades"},{"type":"docs","section":"📚 Documentation"}]}}}},"repository":{"url":"git+https://github.com/bluesky-social/react-native-mmkv.git","type":"git"},"_npmVersion":"10.8.2","description":"The fastest key/value storage for React Native. ~30x faster than AsyncStorage! Works on Android, iOS and Web.","directories":{},"_nodeVersion":"20.19.4","eslintConfig":{"root":true,"rules":{"prettier/prettier":["error",{"useTabs":false,"tabWidth":2,"quoteProps":"consistent","singleQuote":true,"trailingComma":"es5"}]},"extends":["@react-native-community","prettier"],"plugins":["jest"]},"eslintIgnore":["node_modules/","lib/"],"react-native":"lib/module/index","codegenConfig":{"name":"reactnativemmkv","type":"modules","jsSrcsDir":"./lib/module"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","react":"^18.2.0","eslint":"^8.56.0","prettier":"^3.2.5","release-it":"^15.10.1","typescript":"^5.3.3","@types/jest":"^29.5.12","@types/react":"^18.2.55","react-native":"^0.71.6","eslint-plugin-jest":"^27.8.0","react-test-renderer":"^18.2.0","eslint-plugin-ft-flow":"^3.0.4","@tsconfig/react-native":"^3.0.3","react-native-builder-bob":"^0.20.4","@typescript-eslint/parser":"^7.0.1","@types/react-test-renderer":"^18.0.7","@testing-library/react-native":"^12.4.3","metro-react-native-babel-preset":"^0.77.0","@typescript-eslint/eslint-plugin":"^7.0.1","@release-it/conventional-changelog":"^8.0.1","@react-native-community/eslint-config":"^3.2.0","@react-native-community/eslint-plugin":"^1.3.0","@jamesacarr/eslint-formatter-github-actions":"^0.2.0"},"peerDependencies":{"react":"*","react-native":">=0.71.0"},"_npmOperationalInternal":{"tmp":"tmp/react-native-mmkv_2.12.5_1759832428344_0.6257863467540086","host":"s3://npm-registry-packages-npm-production"},"react-native-builder-bob":{"output":"lib","source":"src","targets":["commonjs","module",["typescript",{"project":"tsconfig.json"}]]}}},"time":{"created":"2025-10-07T10:10:43.318Z","modified":"2026-03-04T17:04:50.725Z","2.12.4":"2025-10-07T10:10:43.663Z","2.12.5":"2025-10-07T10:20:28.576Z"},"bugs":{"url":"https://github.com/bluesky-social/react-native-mmkv/issues"},"author":{"url":"https://github.com/mrousavy","name":"Marc Rousavy","email":"marcrousavy@hotmail.com"},"license":"(MIT AND BSD-3-Clause)","homepage":"https://github.com/bluesky-social/react-native-mmkv#readme","keywords":["react-native","ios","android"],"repository":{"url":"git+https://github.com/bluesky-social/react-native-mmkv.git","type":"git"},"description":"The fastest key/value storage for React Native. ~30x faster than AsyncStorage! Works on Android, iOS and Web.","maintainers":[{"email":"ds@blueskyweb.xyz","name":"ds-boyce"},{"email":"spencerfpope@gmail.com","name":"vineyardbovines"},{"email":"npm@esb.lol","name":"estrattonbailey"},{"email":"mozzius@protonmail.com","name":"mozzius"}],"readme":"# This is a fork of `mrousavy/react-native-mmkv`\n\nThis fork adds 16kb page size support to the unmaintained 2.x version of `react-native-mmkv`, as we're currently stuck on the Old Architecture.\n\nChanges:\n\n- Updated MMKV to the latest 1.3 LTS version, which adds 16kb page size support\n- Added a flag to compile `reactnativemmkv.so` with 16kb page size support\n\nOriginal Readme below:\n\n---\n\n<a href=\"https://margelo.io\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"./img/banner-dark.png\" />\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"./img/banner-light.png\" />\n    <img alt=\"VisionCamera\" src=\"./img/banner-light.png\" />\n  </picture>\n</a>\n\n<div align=\"center\">\n  <h1 align=\"center\">MMKV</h1>\n  <h3 align=\"center\">The fastest key/value storage for React Native.</h3>\n</div>\n\n<div align=\"center\">\n  <a align=\"center\" href=\"https://github.com/mrousavy?tab=followers\">\n    <img src=\"https://img.shields.io/github/followers/mrousavy?label=Follow%20%40mrousavy&style=social\" />\n  </a>\n  <br/>\n  <a align=\"center\" href=\"https://twitter.com/mrousavy\">\n    <img src=\"https://img.shields.io/twitter/follow/mrousavy?label=Follow%20%40mrousavy&style=social\" />\n  </a>\n  <br />\n  <a href=\"https://github.com/sponsors/mrousavy\">\n    <img align=\"right\" width=\"160\" alt=\"This library helped you? Consider sponsoring!\" src=\".github/funding-octocat.svg\">\n  </a>\n</div>\n<br/>\n\n\n* **MMKV** is an efficient, small mobile key-value storage framework developed by WeChat. See [Tencent/MMKV](https://github.com/Tencent/MMKV) for more information\n* **react-native-mmkv** is a library that allows you to easily use **MMKV** inside your React Native applications. It provides fast and direct bindings to the native C++ library which are accessible through a simple JS API.\n\n## Features\n\n* **Get** and **set** strings, booleans and numbers\n* **Fully synchronous** calls, no async/await, no Promises, no Bridge.\n* **Encryption** support (secure storage)\n* **Multiple instances** support (separate user-data with global data)\n* **Customize storage location**\n* **High performance** because everything is **written in C++**\n* **~30x faster than AsyncStorage**\n* Uses [**JSI**](https://github.com/react-native-community/discussions-and-proposals/issues/91) instead of the \"old\" Bridge\n* **iOS**, **Android** and **Web** support\n* Easy to use **React Hooks** API\n\n## Sponsors\n\n<div align=\"right\">\n  <a href=\"https://getstream.io/chat/react-native-chat/tutorial/?utm_source=Github&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Github_Jan2022_ReactNative&utm_term=react-native-mmkv\">\n    <img align=\"right\" src=\"https://theme.zdassets.com/theme_assets/9442057/efc3820e436f9150bc8cf34267fff4df052a1f9c.png\" height=\"40\" />\n  </a>\n</div>\n\nreact-native-mmkv is sponsored by **getstream.io**. <br/>\n[Try the React Native Chat tutorial 💬](https://getstream.io/chat/react-native-chat/tutorial/?utm_source=Github&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Github_Jan2022_ReactNative&utm_term=react-native-mmkv)\n\n## Benchmark\n\n[StorageBenchmark](https://github.com/mrousavy/StorageBenchmark) compares popular storage libraries against each other by reading a value from storage for 1000 times:\n\n<div align=\"center\">\n  <a href=\"https://github.com/mrousavy/StorageBenchmark\">\n    <img src=\"./img/benchmark_1000_get.png\" />\n  </a>\n  <p>\n    <b>MMKV vs other storage libraries</b>: Reading a value from Storage 1000 times. <br/>\n    Measured in milliseconds on an iPhone 11 Pro, lower is better. <br/>\n  </p>\n</div>\n\n## Installation\n\n### React Native\n\n```sh\nyarn add react-native-mmkv\ncd ios && pod install\n```\n\n### Expo\n\n```sh\nnpx expo install react-native-mmkv\nnpx expo prebuild\n```\n\n## Usage\n\n### Create a new instance\n\nTo create a new instance of the MMKV storage, use the `MMKV` constructor. It is recommended that you re-use this instance throughout your entire app instead of creating a new instance each time, so `export` the `storage` object.\n\n#### Default\n\n```js\nimport { MMKV } from 'react-native-mmkv'\n\nexport const storage = new MMKV()\n```\n\nThis creates a new storage instance using the default MMKV storage ID (`mmkv.default`).\n\n#### App Groups\n\nIf you want to share MMKV data between your app and other apps or app extensions in the same group, open `Info.plist` and create an `AppGroup` key with your app group's value. MMKV will then automatically store data inside the app group which can be read and written to from other apps or app extensions in the same group by making use of MMKV's multi processing mode.\nSee [Configuring App Groups](https://developer.apple.com/documentation/xcode/configuring-app-groups).\n\n#### Customize\n\n```js\nimport { MMKV } from 'react-native-mmkv'\n\nexport const storage = new MMKV({\n  id: `user-${userId}-storage`,\n  path: `${USER_DIRECTORY}/storage`,\n  encryptionKey: 'hunter2'\n})\n```\n\nThis creates a new storage instance using a custom MMKV storage ID. By using a custom storage ID, your storage is separated from the default MMKV storage of your app.\n\nThe following values can be configured:\n\n* `id`: The MMKV instance's ID. If you want to use multiple instances, use different IDs. For example, you can separate the global app's storage and a logged-in user's storage. (required if `path` or `encryptionKey` fields are specified, otherwise defaults to: `'mmkv.default'`)\n* `path`: The MMKV instance's root path. By default, MMKV stores file inside `$(Documents)/mmkv/`. You can customize MMKV's root directory on MMKV initialization (documentation: [iOS](https://github.com/Tencent/MMKV/wiki/iOS_advance#customize-location) / [Android](https://github.com/Tencent/MMKV/wiki/android_advance#customize-location))\n* `encryptionKey`: The MMKV instance's encryption/decryption key. By default, MMKV stores all key-values in plain text on file, relying on iOS's/Android's sandbox to make sure the file is encrypted. Should you worry about information leaking, you can choose to encrypt MMKV. (documentation: [iOS](https://github.com/Tencent/MMKV/wiki/iOS_advance#encryption) / [Android](https://github.com/Tencent/MMKV/wiki/android_advance#encryption))\n\n### Set\n\n```js\nstorage.set('user.name', 'Marc')\nstorage.set('user.age', 21)\nstorage.set('is-mmkv-fast-asf', true)\n```\n\n### Get\n\n```js\nconst username = storage.getString('user.name') // 'Marc'\nconst age = storage.getNumber('user.age') // 21\nconst isMmkvFastAsf = storage.getBoolean('is-mmkv-fast-asf') // true\n```\n\n### Keys\n\n```js\n// checking if a specific key exists\nconst hasUsername = storage.contains('user.name')\n\n// getting all keys\nconst keys = storage.getAllKeys() // ['user.name', 'user.age', 'is-mmkv-fast-asf']\n\n// delete a specific key + value\nstorage.delete('user.name')\n\n// delete all keys\nstorage.clearAll()\n```\n\n### Objects\n\n```js\nconst user = {\n  username: 'Marc',\n  age: 21\n}\n\n// Serialize the object into a JSON string\nstorage.set('user', JSON.stringify(user))\n\n// Deserialize the JSON string into an object\nconst jsonUser = storage.getString('user') // { 'username': 'Marc', 'age': 21 }\nconst userObject = JSON.parse(jsonUser)\n```\n\n### Encryption\n\n```js\n// encrypt all data with a private key\nstorage.recrypt('hunter2')\n\n// remove encryption\nstorage.recrypt(undefined)\n```\n\n### Buffers\n\n```js\nstorage.set('someToken', new Uint8Array([1, 100, 255]))\nconst buffer = storage.getBuffer('someToken')\nconsole.log(buffer) // [1, 100, 255]\n```\n\n## Testing with Jest\n\nA mocked MMKV instance is automatically used when testing with Jest, so you will be able to use `new MMKV()` as per normal in your tests. Refer to [example/test/MMKV.test.ts](example/test/MMKV.test.ts) for an example.\n\n## Documentation\n\n* [Hooks](./docs/HOOKS.md)\n* [Value-change Listeners](./docs/LISTENERS.md)\n* [Migrate from AsyncStorage](./docs/MIGRATE_FROM_ASYNC_STORAGE.md)\n* [Using MMKV with redux-persist](./docs/WRAPPER_REDUX.md)\n* [Using MMKV with recoil](./docs/WRAPPER_RECOIL.md)\n* [Using MMKV with mobx-persist-storage](./docs/WRAPPER_MOBX.md)\n* [Using MMKV with mobx-persist](./docs/WRAPPER_MOBXPERSIST.md)\n* [Using MMKV with zustand persist-middleware](./docs/WRAPPER_ZUSTAND_PERSIST_MIDDLEWARE.md)\n* [Using MMKV with jotai](./docs/WRAPPER_JOTAI.md)\n* [Using MMKV with react-query](./docs/WRAPPER_REACT_QUERY.md)\n* [How is this library different from **react-native-mmkv-storage**?](https://github.com/mrousavy/react-native-mmkv/issues/100#issuecomment-886477361)\n\n## LocalStorage and In-Memory Storage (Web)\n\nIf a user chooses to disable LocalStorage in their browser, the library will automatically provide a limited in-memory storage as an alternative. However, this in-memory storage won't persist data, and users may experience data loss if they refresh the page or close their browser. To optimize user experience, consider implementing a suitable solution within your app to address this scenario.\n\n## Limitations\n\nAs the library uses JSI for synchronous native methods access, remote debugging (e.g. with Chrome) is no longer possible. Instead, you should use [Flipper](https://fbflipper.com).\n\n### Flipper\n\nUse [flipper-plugin-react-native-mmkv](https://github.com/muchobien/flipper-plugin-react-native-mmkv) to debug your MMKV storage using Flipper. You can also simply `console.log` an MMKV instance.\n\n### Reactotron\n\nUse [reactotron-react-native-mmkv](https://www.npmjs.com/package/reactotron-react-native-mmkv) to automatically log writes to your MMKV storage using Reactotron. [See the docs for how to setup this plugin with Reactotron.](https://www.npmjs.com/package/reactotron-react-native-mmkv)\n\n## Community Discord\n\n[**Join the Margelo Community Discord**](https://discord.gg/6CSHz2qAvA) to chat about react-native-mmkv or other Margelo libraries.\n\n## Adopting at scale\n\nreact-native-mmkv is provided _as is_, I work on it in my free time.\n\nIf you're integrating react-native-mmkv in a production app, consider [funding this project](https://github.com/sponsors/mrousavy) and <a href=\"mailto:me@mrousavy.com?subject=Adopting react-native-mmkv at scale\">contact me</a> to receive premium enterprise support, help with issues, prioritize bugfixes, request features, help at integrating react-native-mmkv, and more.\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}