expo
An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
- 54k
- TypeScript
- MIT
- 7 h ago
Rust-powered ultra-fast persistent key-value storage for React Native and Expo, via Nitro Modules.
Repo rust-dd/react-native-scc, read from GitHub 19 min ago. rust-dd has not joined Take My Repo.
rust-dd/react-native-scc is a public repo on GitHub by rust-dd. Rust-powered ultra-fast persistent key-value storage for React Native and Expo, via Nitro Modules. It declares the MIT license on GitHub. It is written mainly in Rust, has 4 stars and last changed on 2026-11-20. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-21.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
Ultra-low-latency, persistent key-value storage for React Native and Expo. The core is written in Rust on top of scc (a scalable concurrent hash map), and it reaches JavaScript through Nitro Modules, so a call from JS to Rust costs nanoseconds, not microseconds.
This project is also a statement of intent: bringing Rust closer to React Native. A Rust core behind Nitro Modules ships as an ordinary npm package — no toolchain for consumers, no compromise on performance — and this library is the proof that the pattern can go head-to-head with established C++ storage libraries.
The design goal is simple: every read is a RAM lookup, every write is durable, and the disk never sits on your hot path. Writes update the in-memory map synchronously and stream to a write-ahead log on a background thread; a hard kill can cost you the last few milliseconds of writes, but committed data is never corrupted.
*Async variants on Nitro's thread pool for anything that must not block the JS threadsetMany/getMany cross the bridge once for a whole record setmaxEntries capuseKVString, useKVNumber, useKVBoolean, useKVBuffer, useKVJSONatomWithKV, redux-persist engine as subpath exportsfilesDir)id gets its own file pair, WAL thread, and durability settingsJS-visible synchronous API cost vs react-native-mmkv 4.3.2 on an iPhone 15 Pro Max (iOS 27.0.1), Release build, measured with the example app's methodology v6 benchmark: random keys over 482- and 20k-key stores, values that differ from the stored one, randomized interleaved trials, results cross-checked between both libraries, and 95% bootstrap confidence intervals. Values are the median of three fresh app launches with ten trials each; every row favors SCC with its interval clear of 1× on all three launches.
| Case (ns per op, lower is better) | SCC | MMKV | SCC faster |
|---|---|---|---|
getString, 16 B |
155 | 327 | 2.11× |
getString, 256 B |
180 | 380 | 2.14× |
getString, 4 KiB |
442 | 696 | 1.55× |
getNumber |
132 | 296 | 2.23× |
getBoolean |
136 | 289 | 2.13× |
getString, missing key |
127 | 281 | 2.22× |
contains |
123 | 272 | 2.20× |
getString, 16 B, 20k-key store |
157 | 358 | 2.26× |
set string, 16 B |
248 | 427 | 1.76× |
set string, 256 B |
263 | 545 | 2.02× |
set string, 4 KiB |
704 | 3990 | 5.66× |
set number |
198 | 388 | 1.96× |
set boolean |
206 | 365 | 1.77× |
setJSON, ~1 KiB object |
6550 | 7830 | 1.20× |
getJSON, ~1 KiB object |
5260 | 5410 | 1.03× |
getMany, 100 × 16 B, per key ¹ |
150 | 283 | 1.88× |
setMany, 100 × 16 B, per key ¹ |
170 | 354 | 2.08× |
set string, 16 B, one change listener |
269 | 536 | 1.97× |
set string, 16 B, 50 key listeners ² |
282 | 3940 | 13.90× |
A single call after an idle frame (p50): set 9.7 µs vs 16.1 µs, getString 6.0 µs vs 12.3 µs.
¹ One SCC batch call vs 100 MMKV scalar calls, since MMKV has no batch API; this compares throughput, not atomicity.
² 50 hook-style subscriptions: SCC addOnKeyChangedListener, MMKV one filtered addOnValueChangedListener per key, the way its hooks subscribe. Listener rows time the write call; delivery to JS follows asynchronously and is not timed.
Write rows measure API return, not durability: MMKV writes into an mmap, so a value survives a process kill once set returns, while SCC appends to its WAL on a background thread within ~8 ms; flush() is the barrier (1000 × 256 B writes plus flush() took 4.0 ms on this device). Reproduce with npm run bench:ios -- --device <udid> --team <apple-team-id> from example/; every run saves its raw samples.
npm install react-native-scc-storage react-native-nitro-modules
The config plugin declares Expo SDK 57 or newer as an optional peer.
{ "plugins": ["react-native-scc-storage"] }
npx expo prebuild
npx expo run:ios
npx expo run:android
Expo Go is not supported (native code) — use a dev build.
cd ios && pod install
Prebuilt Rust static libraries ship with the package. If they are missing (e.g. a source checkout), the build scripts compile them automatically — that path requires a Rust toolchain with the iOS/Android targets installed.
import { createKV } from 'react-native-scc-storage'
const kv = createKV() // persistent, id 'default'
// sync — the hot path
kv.set('user.name', 'Ada')
kv.set('user.score', 42.5)
kv.set('user.premium', true)
kv.setJSON('user.prefs', { theme: 'dark' })
kv.getString('user.name') // 'Ada'
kv.getNumber('user.score') // 42.5
kv.getJSON<{ theme: string }>('user.prefs') // { theme: 'dark' }
// async — same store, Nitro thread pool
await kv.setAsync('big.blob', someArrayBuffer)
const blob = await kv.getBufferAsync('big.blob')
await kv.flushAsync() // durability barrier
// batch — one bridge crossing
kv.setMany({ a: '1', b: '2', c: '3' })
kv.getMany(['a', 'b', 'missing']) // ['1', '2', undefined]
Every id is an independent store with its own files (<id>.snap + <id>.wal), its own background writer, and its own settings. Opening the same id twice returns the same underlying store. The id becomes a file name, so it must be non-empty and contain no / or \.
An open store holds an exclusive lock on <id>.lock. Opening the same files from a second process (an Android android:process, or an iOS app extension sharing an App Group path) fails with an error instead of running two writers over one log.
const settings = createKV({ id: 'settings' })
const vault = createKV({ id: 'vault', durability: 'strict' }) // fsync every commit
const cache = createKV({ id: 'cache' }) // relaxed (default): ~1s fsync
const ui = createKV({ id: 'ui', persistence: 'none' }) // pure in-memory, no files
Options: id, path (override the storage directory), persistence: 'wal' | 'none', durability: 'relaxed' | 'strict', recreate (wipe on open), encryptionKey (see below), maxEntries, and ttlSweepIntervalMs.
const vault = createKV({ id: 'vault', encryptionKey: keyFromKeychain })
Everything the instance writes to disk — snapshot and write-ahead log alike — is encrypted with ChaCha20-Poly1305; the 256-bit cipher key is derived from encryptionKey with a single SHA-256, with no salt and no work factor. Use a high-entropy random secret, such as 32 random bytes generated once and kept hex-encoded in the keystore, never a password a person chose: a weak passphrase can be brute-forced from the files. An empty encryptionKey throws. Opening an encrypted store with a wrong key (or without one) fails without touching the files, and opening a plaintext store with a key fails too, so a configuration mistake can never silently corrupt or rewrite data. Store the passphrase in the platform keystore (Keychain / Android Keystore) — the library deliberately does not manage key storage for you.
kv.set('session.token', token, { ttlMs: 15 * 60 * 1000 })
kv.setJSON('cache.profile', profile, { ttlMs: 60_000 })
Expired keys read as missing immediately (get, contains, getAllKeys and delete all agree), and a background sweeper physically reclaims them — also from disk — on the instance's WAL thread (sweep interval: 30 s, ttlSweepIntervalMs to change it). In-memory stores start the same sweeper on their first TTL write. TTL persists across restarts: a key set with a 1-hour TTL is still gone after a kill + relaunch past its deadline.
Listeners and hooks learn about an expiry only when the sweep removes the key, so a useKVString('session.token') keeps showing the old value for up to one sweep interval. Read the key when the value matters, or lower ttlSweepIntervalMs.
const cache = createKV({
id: 'cache',
maxEntries: 10_000,
ttlSweepIntervalMs: 5_000,
})
When the store outgrows maxEntries, the sweeper evicts expired keys first, then arbitrary live keys until it fits. Eviction order is unspecified (not LRU) — use it as a safety cap, not a cache policy.
const next = kv.transaction((tx) => {
const current = tx.getNumber('counter') ?? 0
tx.set('counter', current + 1)
tx.setJSON('counter.meta', { updatedAt: Date.now() })
return current + 1
})
Transactions are synchronous and crash-atomic for recovery: the callback stages writes in JS and sees its own staged values, then commits them as one WAL record, so replay after a crash applies either all staged writes or none. Concurrent readers do not get multi-key isolation while the in-memory commit is being applied. Async callbacks are rejected so the library never holds transactional state across an await.
const user = kv.namespace('user:123')
user.set('name', 'Ada') // stores user:123:name
user.setJSON('prefs', { theme: 'dark' })
user.getAllKeys() // ['name', 'prefs']
user.clearAll() // deletes only user:123:* keys
kv.getKeysByPrefix('user:123:') // full keys
kv.deleteByPrefix('cache:')
Namespaces are lightweight JS views over the same underlying store. They do not create extra files or WAL threads, they share the root's native change listener, and namespace() returns the same view object for the same prefix, so creating one during render is safe. getKeysByPrefix on a view returns keys relative to that view. Closing the root closes its views.
import { useKVNumber } from 'react-native-scc-storage'
function Counter() {
const [count, setCount] = useKVNumber('counter')
return <Button title={`${count ?? 0}`} onPress={() => setCount((count ?? 0) + 1)} />
}
Each hook returns [value, setValue]; calling setValue(undefined) deletes the key. Hooks re-render on any write to the key, including writes made through other KV objects opened with the same id.
Hooks and adapters called without a kv use the default store (getDefaultKV(), id 'default'). To give it other options, such as an encryption key, call configureDefaultKV once before anything touches it, for example at the top of index.js:
configureDefaultKV({ encryptionKey: key, durability: 'strict' })
If the default store is closed through any handle, hooks and adapters move on to a freshly opened one.
const theme = useKVSelector<{ theme?: string }, string | undefined>(
'settings',
(settings) => settings?.theme
)
The listener fires for every mutation of the underlying store, from any handle. key is null after clearAll ("everything changed"). Delivery is asynchronous on the JS thread: changes queue natively and cross into JS as one batch per burst, in write order.
const sub = kv.addOnValueChangedListener((key) => {
console.log(key === null ? 'store cleared' : `changed: ${key}`)
})
sub.remove()
addOnKeyChangedListener fires only for one key (and for clearAll), once per write. Key listeners are indexed, so a write only reaches the listeners of its own key. Hooks, observeJSON, and the jotai adapter subscribe this way too, but since they re-read the value they are called once per key per delivered batch, so a burst of 100 writes costs one re-render or one JSON.parse:
const sub = kv.addOnKeyChangedListener('settings', () => console.log('settings changed'))
Selectors sit on top of a key listener and only fire when the selected value changes:
const sub = kv.observeJSON(
'settings',
(settings: { theme?: string } | undefined) => settings?.theme,
(theme) => console.log('theme changed', theme)
)
One package, three subpath exports. zustand and jotai are optional peer dependencies — install only what you use.
import { create } from 'zustand'
import { persist, createJSONStorage } from 'zustand/middleware'
import { sccStateStorage } from 'react-native-scc-storage/zustand'
const useStore = create(
persist((set) => ({ bears: 0 }), {
name: 'bears',
storage: createJSONStorage(() => sccStateStorage()),
})
)
The storage is synchronous, so zustand hydrates without an async gap — no loading flicker, no onRehydrateStorage dance.
import { atomWithKV } from 'react-native-scc-storage/jotai'
const counterAtom = atomWithKV('counter', 0)
Reads synchronously on init (getOnInit) and reacts to writes made outside jotai — including other KV handles — via the native change listener. Setting the atom to undefined deletes the key, like the hooks do.
import { createSccStorage } from 'react-native-scc-storage/redux'
const persistedReducer = persistReducer(
{ key: 'root', storage: createSccStorage() },
rootReducer
)
| sync | async | returns |
|---|---|---|
set(key, value) |
setAsync |
void — value: string | number | boolean | ArrayBuffer |
setJSON(key, value) |
setJSONAsync |
void |
setMany(entries) |
setManyAsync |
void — Record<string, string> |
transaction(callback) |
— | callback return value |
namespace(prefix) |
— | scoped KV view |
getKeysByPrefix(prefix) |
— | string[] |
deleteByPrefix(prefix) |
— | number |
addOnValueChangedListener(listener) |
— | KVSubscription |
addOnKeyChangedListener(key, listener) |
— | KVSubscription |
observeJSON(key, selector, listener) |
— | KVSubscription |
getString(key) |
getStringAsync |
string | undefined |
getNumber(key) |
getNumberAsync |
number | undefined |
getBoolean(key) |
getBooleanAsync |
boolean | undefined |
getBuffer(key) |
getBufferAsync |
ArrayBuffer | undefined |
getJSON<T>(key) |
getJSONAsync |
T | undefined |
getMany(keys) |
getManyAsync |
(string | undefined)[] |
contains(key) |
containsAsync |
boolean |
delete(key) |
deleteAsync |
boolean |
getAllKeys() |
getAllKeysAsync |
string[] |
clearAll() |
clearAllAsync |
number sync, void async |
flush() |
flushAsync |
void — blocks until fsynced |
size |
— | number |
close() |
— | void |
Reading a key that holds a different type returns undefined (matching react-native-mmkv). Numbers are IEEE-754 doubles, i.e. exactly JS number semantics. Keys and strings are stored as UTF-8, so a lone surrogate becomes U+FFFD: 'a\uD83D' and 'a\uD83C' name the same key.
Writes update the in-memory map and append their record to an in-process log under a single lock; a dedicated background thread checksums the records and writes them to the write-ahead log in group commits (at most every 8 ms, sooner past 128 KiB). The writer keeps polling for 250 ms after its last input, so writes inside a burst never pay a thread wake-up. With durability: 'relaxed' (default) the log is fsynced about once per second; with 'strict' every group commit is fsynced. flush() / flushAsync() is the explicit barrier: it returns only after everything written so far is on disk. If a background write failed (for example, the disk is full), the next write, flush(), or close() throws, and the store still closes.
On restart the store recovers from snapshot + WAL replay. Every record carries a CRC32; a torn tail from a hard kill is truncated and recovery continues — committed data is never lost or corrupted. When the WAL outgrows max(4 MiB, 2 × snapshot size), the background writer compacts it into an atomically replaced snapshot, keeping recovery files bounded without moving disk I/O onto the JS thread. Transactions wait for a compaction only while the map is captured in memory, never across its fsyncs.
TypeScript (KV class, hooks, adapters)
└─ Nitro Modules (JSI, sync calls, zero-copy where possible)
└─ C++ HybridObjects (hot get/set/contains/delete: raw JSI host functions)
└─ C FFI (cbindgen, panic-safe boundary)
└─ Rust core: scc::HashMap (per-bucket locks) + WAL writer thread
The Rust core is an independent crate (crates/kv-core) with its own test suite: crash-recovery tests that truncate the WAL at every byte offset, multi-threaded stress tests racing writers against compaction, and criterion benchmarks. The C ABI layer (crates/kv-ffi) wraps every entry point in catch_unwind, so a Rust panic can never unwind across the language boundary.
npm install
npm run specs # tsc + nitrogen codegen
npm test # jest (KV + hooks + adapters against a mock native layer)
cargo test --workspace # Rust core + FFI suites
cargo bench -p kv-core # criterion benchmarks
npm run check:cpp # compile-check cpp/ against the Nitro headers
npm run rust:build # cross-compile static libs for iOS + Android
Each native build writes a hash of the Rust sources next to its output. Postinstall, the Expo plugin, pod install, the Xcode script phase and the Gradle build all run the build scripts with --if-needed, so a checkout rebuilds the libraries after a Rust change instead of linking stale ones, while an npm install with matching prebuilt libraries never needs Rust.
The example app under example/ runs a full on-device self-test (sync/async round-trips, persistence across launches, cross-handle change events) and the MMKV comparison benchmark with live charts.
MIT
rust-dd/react-native-scc is a public repo on GitHub by rust-dd. Rust-powered ultra-fast persistent key-value storage for React Native and Expo, via Nitro Modules.
It declares the MIT license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-20. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
For developers, who are building real-time data-driven applications, Redis is the preferred, fastest, and most feature-rich cache, data structure server, and document and vector query engine.

🔥 Insanely fast native C++, Swift or Kotlin modules with a statically compiled binding layer to JSI
A framework for building native applications using React
Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more! 9 years of continuous development and counting.
A flexible distributed key-value database that is optimized for caching and other realtime workloads.
High-performance quantitative finance in Rust and Python — 130+ stochastic processes, option pricing, calibration, fixed income, risk & copulas, with SIMD/GPU acceleration.
Multi-transport Rust web framework: HTTP/1.1, HTTP/2, HTTP/3, WebSocket, SSE, gRPC, TCP/UDP and Unix sockets behind one router, on Tokio or Compio.

A Tauri application for efficient and secure database management.
Starter template using Rust with Axum, Async-GraphQL, PostgreSQL, and Redis for building high-performance web APIs.

A Rust library that provides full support for DHT11, DHT22, and DHT20 (AHT20) temperature and humidity sensors.
This repository is dedicated to solving the Advent of Code 2024 puzzles using the Rust programming language