Offline-first data
Offline is the baseline condition, not the exception. @gomani/data treats the local device as the source of truth and the network as opportunistic.
import { createStore, createFetchTransport } from '@gomani/data/client';
const store = createStore({
collections: { notes: {} },
transport: createFetchTransport('/_gomani/sync'),
});
// optimistic — registers instantly, regardless of connectivity
store.notes.put({ id: '1', text: 'Kwacha' });
The server half ships in the same framework:
import { createSyncHandler } from '@gomani/data';
export default createSyncHandler(serverStore); // cursor pull + idempotent push + conflict-free merge
Personal data in the local store is encrypted at rest by default (@gomani/secure), with keys derived from authentication — possession of the device alone does not yield the data.