# braid_rs
A unified Rust implementation of the [Braid Protocol](https://braid.org/).
`braid_rs` consolidates several Braid-related components into a single, modular crate, providing a comprehensive toolkit for building decentralized, synchronized web applications.
## Features
- **Core Braid-HTTP**: Implementation of the Braid-HTTP protocol for state synchronization over HTTP.
- **Antimatter CRDT**: A high-performance Conflict-free Replicated Data Type (CRDT) based on the Antimatter algorithm.
- **Braid-Blob**: Content-addressed blob storage with Braid integration.
- **BraidFS**: A filesystem synchronization daemon that uses Braid to sync local directories with remote servers.
## Installation
Add this to your `Cargo.toml`:
```toml
[dependencies]
braid_rs = "0.1.0"
```
## Modules
The crate is organized into several modules, gated by features:
### `core` (default)
Contains the core Braid-HTTP client and server implementations.
- `client`: A flexible Braid-HTTP client for fetching and subscribing to resources.
- `server`: Axum-based server components for serving Braid resources.
### `antimatter` (default)
Implementation of the Antimatter CRDT. Provides `AntimatterCrdt` for managing distributed state.
### `blob` (default)
Content-addressed blob storage integration.
### `fs` (default)
Filesystem synchronization logic, used by the `braidfs` binary.
## Binaries
### `braidfs`
The `braidfs` binary allows you to synchronize local files with a Braid server.
Usage:
```bash
# Start the braidfs daemon
braidfs run
# Sync a local directory to a remote Braid URL
braidfs sync ./my-folder http://example.com/my-resource
```
## Examples
### Creating a Braid Client
```rust
use braid_rs::BraidClient;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = BraidClient::new();
let response = client.get("http://braid.org/resource").await?;
println!("Content: {:?}", response.body());
Ok(())
}
```
## License
Licensed under either of:
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
## Links
- [Braid Specification](https://braid.org/spec)
- [Antimatter Algorithm](https://braid.org/antimatter)
- [Braid-HTTP](https://braid.org/spec/http)