Skip to Content
ArchitectureData Layer

data layer architecture

A local-first data architecture that works offline and syncs when connected, with clear ownership rules for every byte.

Local Data Layer

Data lives on the device first. These technologies power the local storage and query layer.

rxdb
Local-first reactive database layer

Application-facing database providing schema validation, reactive queries (UI components automatically update when data changes), conflict resolution, and a replication protocol for syncing with the cloud. The storage layer is swappable via the RxStorage adapter pattern — application code is identical whether the engine is IndexedDB or SQLite.

Platform: both

sqlite
Mobile storage engine

Uses the SQLite engine that Apple, Google, and Huawei all ship natively in their operating systems. Zero extra app size and a battle-hardened implementation maintained by the OS vendor. SQLite is public domain — not MIT, not Apache — completely, unconditionally public domain. No corporation owns it. No government can threaten access to it.

Platform: native

indexeddb-dexie
Browser storage

IndexedDB is the browser's built-in structured storage API — a web standard governed by the W3C, available in every modern browser. Dexie is a lightweight IndexedDB wrapper that RxDB uses as its browser storage adapter, making IndexedDB's API significantly more ergonomic.

Platform: browser

pouchdb
Sync bridge

CouchDB's philosophy and protocol implemented entirely in JavaScript. Runs inside the browser or Capacitor app, stores data in IndexedDB or SQLite, and speaks CouchDB's exact sync protocol. PouchDB and CouchDB do not think of each other as server and client — they are peers exchanging sequence numbers and change sets.

Platform: both

Cloud Layer

Cloud services provide synchronization, authentication, and eventual consistency across devices.

supabase-postgresql
strict

Open source Firebase alternative built on PostgreSQL. Provides managed Postgres, real-time change subscriptions, row-level security, and REST/GraphQL API. Apache 2.0 licensed and fully self-hostable. Handles data requiring strict consistency — two conflicting versions of a wallet balance are never acceptable. The relational model, foreign keys, and ACID transactions provide the guarantees that money requires.

apache-couchdb
eventual

Apache 2.0 licensed, governed by the Apache Software Foundation. Designed around the principle that every node is equal — every CouchDB instance is a full peer that can accept writes and sync with any other instance. No single point of failure. Tracks changes through a changes feed with revision history. Conflict resolution preserves both versions rather than silently picking a winner.

Data Ownership Rules

Clear rules govern who owns what data across the ecosystem.

Data TypeOwnerStorageSync
personaluser-privateSupabase / PostgreSQLstrict
communitycommunity-sharedApache CouchDBeventual
platform-openpublic-openApache Dorisaggregate

Environment-Aware Storage

Storage selection adapts automatically based on the runtime environment.

import { Capacitor } from '@capacitor/core'; export function getMukokoStorage() { if (Capacitor.isNativePlatform()) { return getRxStorageSQLite({ /* config */ }); } return getRxStorageDexie(); }

Native platforms use SQLite for performance; web uses IndexedDB via Dexie for broad browser support.

Last updated on