Skip to content

lattice / orientation

Package Structure

How lattice is organized into focused packages.

lattice is organized as a family of focused packages for CRDTs and their shared infrastructure. You can depend on the lattice_crdt umbrella for the core toolkit, or pick individual packages for a smaller dependency graph.

lattice packages, versions, documentation, and contents
PackageVersionDocsWhat it provides
lattice_crdton HexAPI docsUmbrella for core, counters, registers, sets, maps, sequence, and text
lattice_coreon HexAPI docsReplicaId, VersionVector, DotContext — shared causal infrastructure
lattice_counterson HexAPI docsGCounter, PNCounter
lattice_registerson HexAPI docsLWWRegister, MVRegister
lattice_setson HexAPI docsGSet, TwoPSet, ORSet
lattice_mapson HexAPI docsLWWMap, ORMap, Crdt dispatch
lattice_sequenceon HexAPI docsGeneric ordered-list CRDT with move support
lattice_fugueUnreleasedNot published yetNon-interleaving sequence CRDT implementing Fugue
lattice_text_coreon HexAPI docsShared grapheme and range helpers for text CRDTs
lattice_texton HexAPI docsPlain-text CRDT backed by lattice_sequence
lattice_text_fugueUnreleasedNot published yetNon-interleaving text CRDT backed by lattice_fugue
lattice_presenceon HexAPI docsDistributed presence CRDT with topic/key/pid/meta tracking
graph LR
    lattice_counters --> lattice_core
    lattice_fugue --> lattice_core
    lattice_registers --> lattice_core
    lattice_sequence --> lattice_core
    lattice_sets --> lattice_core
    lattice_maps --> lattice_core
    lattice_maps --> lattice_counters
    lattice_maps --> lattice_registers
    lattice_maps --> lattice_sets
    lattice_text --> lattice_core
    lattice_text --> lattice_sequence
    lattice_text --> lattice_text_core
    lattice_crdt --> lattice_core
    lattice_crdt --> lattice_counters
    lattice_crdt --> lattice_registers
    lattice_crdt --> lattice_sequence
    lattice_crdt --> lattice_sets
    lattice_crdt --> lattice_maps
    lattice_crdt --> lattice_text
    lattice_text_fugue --> lattice_core
    lattice_text_fugue --> lattice_fugue
    lattice_text_fugue --> lattice_text_core
    lattice_presence

The only packages with no lattice package dependencies are lattice_core, lattice_text_core, and lattice_presence. lattice_text_core depends only on gleam_stdlib; lattice_core and lattice_presence also depend on gleam_json.

In Gleam, imports come from the package name. Even when you install the umbrella lattice_crdt, you import from the sub-package names:

import lattice_core/replica_id
import lattice_counters/g_counter
import lattice_sets/or_set
import lattice_maps/or_map
import lattice_sequence/sequence
import lattice_fugue/sequence
import lattice_text/text
import lattice_text_core/grapheme
import lattice_text_fugue/text
import lattice_presence/presence_state

Start with lattice_crdt if you are getting started, prototyping, or using CRDTs from multiple categories. It includes the causal core, counters, registers, sets, maps, the YATA-style sequence, and its text wrapper.

Pick individual packages when binary size or dependency count matters, or when you only need one category of CRDT. For example, if you only need counters:

Terminal window
gleam add lattice_counters

Add lattice_presence separately when you need distributed presence. It has no lattice package dependencies and is not included in the lattice_crdt umbrella.

lattice_fugue and lattice_text_fugue are not published to Hex yet. To evaluate either package, clone the lattice repository and declare the package as a local path dependency in your project's gleam.toml:

[dependencies]
lattice_fugue = { path = "../lattice/packages/lattice_fugue" }
lattice_text_fugue = { path = "../lattice/packages/lattice_text_fugue" }

Keep only the dependency or dependencies you need. Paths are relative to your project's gleam.toml, so adjust them for the location of your lattice clone. Do not use gleam add for these unreleased packages.

See Installation for full details.