An offline-first, decentralized desktop communication app using BLE mesh, CRDT sync, and zero-trust architecture.
┌─────────────────────────────────────────────┐
│ LinkLocal Mesh Network │
│ (Peer-to-Peer, Offline-First, P2P) │
└─────────────────────────────────────────────┘
↓ ↓ ↓
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Device 1│ │ Device 2│ │ Device 3│
│ (BLE) │ │ (BLE) │ │ (BLE) │
└─────────┘ └─────────┘ └─────────┘
Chat Chat Chat
Files Files Files
Sync Sync Sync
✅ Offline-First: Works without internet—no cloud dependency
✅ Peer-to-Peer: No central server, true decentralization
✅ Conflict-Free: CRDT-based eventual consistency (Yrs)
✅ Secure: Ed25519 cryptography, zero-trust model
✅ Efficient: BLE mesh, CBOR serialization, ~100 bytes/packet
✅ Production-Ready: Modular Rust, async/await, fully tested
# Clone
git clone <repo> link_local && cd link_local
# Test build
cargo check --workspace
# Build CLI tool
cargo build -p linklocal-cli --release
# Run tests
cargo test --workspace# Initialize a node
cargo run -p linklocal-cli -- init --node-id my-laptop
# Send a test message
cargo run -p linklocal-cli -- send --message "Hello, mesh!"
# Generate cryptographic identity
cargo run -p linklocal-cli -- identity
# Run all tests
cargo run -p linklocal-cli -- test
# Test mesh routing
cargo run -p linklocal-cli -- routing
# Create a sync document
cargo run -p linklocal-cli -- sync --name "My Shared Doc"LinkLocal uses a layered architecture:
| Layer | Crate | Purpose |
|---|---|---|
| App | apps/desktop, apps/cli |
User interfaces |
| Sync | core/sync |
CRDT (Yrs) for conflict-free data |
| Identity | core/identity |
Ed25519 keypair management |
| Routing | core/routing |
Packet dedup + forwarding |
| Mesh | core/mesh |
BLE/transport abstraction |
| Protocol | core/protocol |
CBOR packet encoding |
| Utils | libs/utils |
Logging + common utilities |
Send Message
↓
[Protocol] CBOR encode
↓
[Identity] Sign with Ed25519
↓
[Routing] Check dedup + TTL
↓
[Mesh] Broadcast via BLE
↓
(Remote node repeats)
↓
[Sync] Apply CRDT update
↓
Store locally + Display to user
- Async/Await: Non-blocking I/O with Tokio
- Trait-Based: Pluggable transport (BLE ↔ Mock)
- CRDT: Conflict-free data structures (Yrs)
- Error Handling: Ergonomic with
thiserror
linklocal/
├── Cargo.toml # Workspace config
├── ARCHITECTURE.md # System design (detailed)
├── SETUP.md # Development guide
├── README.md # This file
│
├── core/ # Core libraries
│ ├── protocol/ # Packet: {id, source, ttl, payload, ts}
│ ├── mesh/ # MeshAdapter trait + MockAdapter
│ ├── routing/ # RoutingEngine + DedupCache
│ ├── identity/ # Ed25519 keypair + sign/verify
│ └── sync/ # SyncManager + SharedDocument
│
├── apps/ # Applications
│ ├── cli/ # Debug tool (init, send, test, routing, sync)
│ └── desktop/ # Tauri + React app (skeleton)
│
└── libs/utils/ # Shared utilities
└── logger.rs # Logging setup
| Component | Technology | Why |
|---|---|---|
| Language | Rust | Performance, memory safety, concurrency |
| Async | Tokio | Non-blocking I/O, efficient scheduling |
| Serialization | CBOR | Compact (BLE friendly), fast |
| CRDT | Yrs (Yjs) | Proven conflict-free replication |
| Crypto | Ed25519-dalek | Modern, IETF standard, fast |
| Storage | SQLite (future) | Embedded, ACID transactions |
| Desktop UI | Tauri + React | Secure, lightweight, cross-platform |
use linklocal_protocol::{Packet, encode_packet};
// Create packet
let packet = Packet::new(
"my-node".to_string(),
b"Hello, mesh!".to_vec(),
);
// Encode to CBOR
let encoded = encode_packet(&packet)?;
println!("Sending {} bytes", encoded.len()); // ~70 bytesuse linklocal_routing::RoutingEngine;
let engine = RoutingEngine::new(1000); // cache size
let packet = Packet::new("node-1".into(), vec![1, 2, 3]);
if engine.should_forward(&packet) {
// TTL > 0 and not seen before
mesh.broadcast(encode_packet(&packet)?).await;
}use linklocal_identity::generate_keypair;
let identity = generate_keypair();
let message = b"important data";
let signature = identity.sign(message);
let valid = identity.verify(message, &signature); // true
println!("Node ID: {}", identity.short_id());
// Output: Node ID: 3a7f2e1cuse linklocal_sync::SyncManager;
let manager = SyncManager::new("my-node".into());
let state = manager.get_state(); // Binary state
// Send state to other nodes
mesh.broadcast(state).await;
// Apply updates from network
manager.apply_update(&remote_update)?;Each crate includes comprehensive unit tests:
# All tests
cargo test --workspace
# Specific crate
cargo test -p linklocal-protocol
cargo test -p linklocal-routing
cargo test -p linklocal-identity
cargo test -p linklocal-sync
# With output
cargo test --workspace -- --nocapture --test-threads=1Test coverage includes:
- ✅ Packet serialization roundtrips
- ✅ TTL management
- ✅ Deduplication logic
- ✅ Ed25519 sign/verify
- ✅ CRDT document updates
- ✅ Mock adapter behavior
# Debug
cargo build
# Release (optimized)
cargo build --release
# Specific crate
cargo build -p linklocal-cli --release# Format
cargo fmt --all
# Lint
cargo clippy --workspace
# Security audit
cargo audit# Generate and open API docs
cargo doc --workspace --open
# View architecture
cat ARCHITECTURE.md
# View setup guide
cat SETUP.md- ✅ Core protocol + packet encoding
- ✅ Routing + deduplication
- ✅ Identity + cryptography
- ✅ CRDT sync integration
- ✅ CLI debug tool
- 🔄 Unit tests
- Real BLE adapter (nRF24/nRF52)
- SQLite persistence
- Tauri IPC handlers
- React UI (chat, file share)
- NAT traversal
- Compression
- Rate limiting
- Access control
- E2E encryption
Q: cargo not found?
A: Install Rust: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Q: Build fails on Linux?
A: Install deps: sudo apt-get install build-essential pkg-config libssl-dev
Q: Tests fail?
A: Run with output: cargo test --workspace -- --nocapture
See SETUP.md for more troubleshooting.
- Fork the repo
- Create a feature branch:
git checkout -b feature/my-feature - Write tests for your code
- Run
cargo fmtandcargo clippy - Submit a pull request
Be respectful, inclusive, collaborative. See LICENSE.
MIT License © LinkLocal Team 2024
- CRDT: Yjs Docs | CRDT Overview
- BLE Mesh: Bluetooth 5.0 Specification
- Cryptography: Ed25519 (RFC 8032)
- Serialization: CBOR (RFC 8949)
- Rust: The Rust Book
- Tauri: Tauri Docs
- Issues: Report bugs or request features via GitHub Issues
- Discussions: Join us for technical discussions
- Docs: Read ARCHITECTURE.md for deep dives
Made with ❤️ for decentralized communication
🚀 Ready to build? See SETUP.md