| Crates.io | river-core |
| lib.rs | river-core |
| version | 0.1.0 |
| created_at | 2025-07-14 13:58:55.105089+00 |
| updated_at | 2025-07-14 13:58:55.105089+00 |
| description | Core library for River - decentralized group chat on Freenet |
| homepage | https://github.com/freenet/river |
| repository | https://github.com/freenet/river |
| max_upload_size | |
| id | 1751763 |
| size | 205,049 |
River is a decentralized group chat system built on Freenet, designed to provide a secure and upgradeable alternative to traditional chat platforms. It features a web-based interface built with Dioxus and a modular contract architecture using the freenet-scaffold framework.

To build and run the River UI locally for testing:
Install dependencies:
# Install Rust using rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Add the wasm target
rustup target add wasm32-unknown-unknown
# Install ssl development library
# This example is for Ubuntu and may be different on your system
sudo apt-get install libssl-dev
# Install build tools
cargo install dioxus-cli
cargo install cargo-make
Build and run with example data:
# Clone the repository
git clone git@github.com:freenet/river.git
# Enter the repository
cd river
# Initialize freenet submodule
git submodule init
git submodule update
# Run development server with example data
cargo make dev-example
Open http://localhost:8080 in your browser
The UI will run with example data and without attempting to sync with Freenet, making it ideal for testing and development.
These features can be combined when building:
# Build with example data
cargo make build-ui-example
# Build without Freenet sync
cargo make build-ui-no-sync
# Build with both features
cargo make build-ui-example-no-sync
To join a River chat room on Freenet, you'll need:
River runs in your browser, and is built to work both on mobile phones and desktop computers.
The interface provides tools for:
River uses an invitation tree model for managing room membership:
The system is built using:
River uses a flexible system for controlling room membership, starting with invitations but designed to support multiple mechanisms. This helps prevent spam while allowing room owners to maintain healthy communities.
The initial implementation uses an invitation tree where:
We're developing additional membership options:
Room: freenet (Owner: owner)
│
├─── User: alice
│ │
│ ├─── User: bob
│ │ │
│ │ └─── User: charlie
│ │
│ ├─── User: dave
│ │
│ └─── User: eve
│
└─── User: frank
Consider the scenario where "alice" invites "bob", who subsequently invites "charlie". If "alice" decides to ban "charlie" from the room, she can directly enforce this action, exercising authority over users invited by her or those invited further down the chain.
Room: freenet (Owner: owner)
│
├─── User: alice
│ │
│ ├─── User: bob
│ │ │
│ │ └─── Banned User: charlie
│ │
│ ├─── User: dave
│ │
│ └─── User: eve
│
└─── User: frank
In this example:
River provides a modern web-based interface built with Dioxus, making it accessible from any device with a web browser.
The chat room contract is implemented using Freenet's composable state pattern. The core state structure is defined in common/src/room_state.rs:
pub struct ChatRoomStateV1 {
pub configuration: AuthorizedConfigurationV1, // Room settings and limits
pub bans: BansV1, // List of banned users
pub members: MembersV1, // Current room members
pub member_info: MemberInfoV1, // Member metadata like nicknames
pub recent_messages: MessagesV1, // Recent chat messages
pub upgrade: OptionalUpgradeV1, // Optional upgrade to new contract
}
Each component is implemented as a separate module with its own state management:
The contract uses CBOR serialization via ciborium for efficient storage and transmission. All state changes are signed using elliptic curve cryptography to ensure authenticity.
River is open-source software licensed under the MIT License. See LICENSE for details.