Lattice

Lattice is a decentralized syncing engine. It runs on localhost for offline durability, but securely syncs state across a distributed mesh network. It handles cryptographic identity under the hood. It currently ships with key-value and append-only log data structures, with the architecture designed for custom CRDTs in the future.

Overview

All data lives on disk locally. Each write produces a signed, append-only log entry. Nodes sync these logs with each other over QUIC (via Iroh), directly peer-to-peer. No server in between.

Quick Start

Prerequisites: Rust 1.75+, Protobuf compiler (protoc)

cargo build --release

Daemon mode:

# Start the daemon (web UI starts at http://localhost:8123)
lattice --daemon

# Use the CLI in another terminal
lattice
lattice> store create --root
lattice:a1b2> put hello world
lattice:a1b2> get hello
world

The web UI is enabled by default on port 8123 in daemon mode. Use --web <port> to change the port or --no-web to disable it.

Embedded mode (standalone, no daemon):

lattice --embedded

Project Layout

CratePurpose
lattice-modelCore types, cryptographic primitives, Weaver protocol traits.
lattice-protoProtobuf schemas defining wire formats.
lattice-storageCommon persistence, ACID transactions, and DAG verification.
lattice-systemstoreY-Adapter middleware isolating system metadata from app data.
lattice-logstoreAppend-only log state machine.
lattice-kvstoreDAG-CRDT key-value state machine.
lattice-kernelWeaver replication engine and DAG orchestration.
lattice-nodeFractal store routing, MetaStore, and peer authorization.
lattice-netP2P gossip, sync protocols, and Iroh endpoints.
lattice-apiIPC layer over UDS, exposing gRPC services.
lattice-runtimeBootstrapper for daemon and in-process modes.
lattice-bindingsUniFFI exports for Swift/Kotlin.
lattice-cliSingle binary (lattice): REPL, daemon mode (--daemon), embedded mode (--embedded).

Key Dependencies

Data Directory

<app-data>/lattice/
├── identity.key        # Ed25519 node keypair
├── meta.db             # Global inventory (rootstores table, node name)
├── lattice.sock        # Daemon UDS socket (when running)
└── stores/{uuid}/      # Per-store data
    ├── intentions/
    │   └── log.db      # Intention DAG (Weaver)
    └── state/
        └── state.db    # Materialized state (KV / system tables)

<app-data> is platform-dependent: ~/Library/Application Support on macOS, ~/.local/share on Linux.

Community

Join the Matrix room: #latticesync:matrix.org

License

Mozilla Public License 2.0 (MPL-2.0).