smalljs$molSearch⌘ KDocsPlaygroundCompareEcosystemAboutEN
Giper BazaGetting StartedIntroductionMental modelGetting StartedFrom TypeScript to view.treeProject StructureToolingEssentialsInstallationViewsState & ReactivityRoutingRenderingTestingDeploymentTroubleshootingDataData FetchingData SchemasGiper BazaMoreShowcaseFrom React, Vue & SvelteCookbookAdvancedPluginsModule metadataOfflineGhost viewsAboutFAQTeamReleasesAPI$mol_button_major$mol_button_minor$mol_string$mol_number$mol_text$mol_paragraph$mol_list$mol_row$mol_link$mol_check$mol_switch$mol_select$mol_scroll$mol_page$mol_pick

Giper Baza

Giper Baza is a separate, optional project — not a built-in part of $mol. Its authors describe it as a decentralized, high-availability database with conflict-free real-time synchronization: a CRDT store that persists locally and replicates between clients without a central server, with digital signatures and end-to-end encryption. You never need it to build a $mol app; reach for it only when several clients or devices must share the same live data.Just want your app to keep working without a network? That is plain offline, and $mol handles it with a service worker — see Offline. Giper Baza is the next step up: syncing data between clients, not caching one client's assets.When you do model data with it, entities look like ordinary reactive properties, and replication just happens.This page introduces the shape of the API. Giper Baza is a large topic — treat this as a map, not the full territory.

Define an entity

An entity is a pure schema — a set of typed fields. Keep behaviour out of it; do the reading and writing in your views.1namespace $ {2 export class $my_task extends $giper_baza_entity.with( {3 Title: $giper_baza_atom_text,4 Done: $giper_baza_atom_bool,5 CreatedAt: $giper_baza_atom_time,6 } ) {}7}Each field is an atom — a synced cell with a typed value.

Read and write

Get the store, reach a list of entities, and map over them reactively:1 @ $mol_mem2 tasks() {3 return this.tasks_list().remote_list()4 }5 6 @ $mol_mem_key7 task_done( id: string, next?: boolean ) {8 const task = this.task( id )9 if( next !== undefined ) task.Done( null )!.val( next )10 return task.Done()?.val() ?? false11 }Reading Done()?.val() gives the current value; writing Done(null)!.val(next) sets it. Any view reading the atom re-renders when it — or a remote peer — changes it.

Create and remove

1 @ $mol_action2 task_add( title: string ) {3 const task = this.tasks_list().make( [ [ null, $giper_baza_rank_read ] ] )!4 task.Title( null )!.val( title )5 task.Done( null )!.val( false )6 }7 8 @ $mol_action9 task_remove( id: string ) {10 this.tasks_list().cut( this.task( id ).link() )11 }
Edit this page on GitHubWas this helpful?YesNoPreviousData SchemasNextShowcase
On this pageDefine an entityRead and writeCreate and removeSync is automaticWhere to next?
Type to search the documentation.