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:

# Terminal 1: start the daemon
latticed

# Terminal 2: use the CLI
lattice
lattice> store create --root
lattice:a1b2> put hello world
lattice:a1b2> get hello
world

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-daemonHeadless orchestrator binary (latticed).
lattice-cliInteractive REPL binary (lattice).

Key Dependencies

Data Directory

<app-data>/lattice/
├── identity.key        # Ed25519 node keypair
├── meta.db             # Global inventory (rootstores table, node name)
├── latticed.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.

License

Mozilla Public License 2.0 (MPL-2.0).