A decentralized pizza ordering application built on Freenet. Allows groups to collaboratively create and manage pizza orders with cryptographic verification and eventual consistency across peers.
- Create and manage group pizza orders
- Each user can add their own order items
- Order creators can mark items as paid
- Cryptographically signed operations (ed25519)
- CRDT-based state synchronization for eventual consistency
- Dioxus-based reactive web UI
If you have Nix installed with flakes enabled:
# Enter development shell
nix develop
# Or with direnv (automatic)
direnv allowThis provides all dependencies including Rust, Dioxus CLI, and WASM tools.
- Rust (latest stable)
- Dioxus CLI for running the UI
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install Dioxus CLI
cargo install dioxus-cli
# Add WASM target (for contract compilation)
rustup target add wasm32-unknown-unknown# From project root
cd ui
# Development server with hot reload
dx serve
# Or build for production
dx build --releaseThe UI will be available at http://localhost:8080
# Run all tests (contract + common)
cargo test
# Run tests with output
cargo test -- --nocapture
# Run specific test
cargo test test_merge_is_commutative
# Run tests for a specific crate
cargo test -p pizza-contract
cargo test -p pizza-common# Build the contract for WASM
cargo build -p pizza-contract --target wasm32-unknown-unknown --release
# The WASM file will be at:
# target/wasm32-unknown-unknown/release/pizza_contract.wasm# Check all crates for errors
cargo check
# Check specific crate
cargo check -p pizza-ui
cargo check -p pizza-contractcargo fmtcargo clippy# UI with hot reload
cd ui && dx serve
# Or use cargo-watch for library changes
cargo install cargo-watch
cargo watch -x checkThe contract implements Freenet's ContractInterface trait:
validate_state- Verify state integrity and signaturesupdate_state- Apply state updates (commutative merge)summarize_state- Generate compact state summaryget_state_delta- Compute differences for sync
Uses a CRDT-like pattern with:
- Version numbers for last-writer-wins conflict resolution
- Cryptographic signatures for authorization
- Delta-based sync for efficiency
// State merging is commutative:
// merge(A, B) == merge(B, A)
state_a.merge(&state_b, ¶ms)?;| Component | Description |
|---|---|
App |
Main layout with sidebar and content area |
Sidebar |
List of orders with "New Order" button |
OrderView |
Order details, items table, paid status |
NewOrderDialog |
Modal for creating new orders |
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/pizza-freenet.git cd pizza-freenet - Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes
- Ensure tests pass:
cargo test - Format and lint:
cargo fmt cargo clippy
- Commit with a descriptive message:
git commit -m "Add feature: description of changes" - Push and create a pull request
- Tests: Add tests for new functionality, especially for state merging logic
- Commutativity: Any state merge operation must be commutative - add property-based tests
- Signatures: All state-modifying operations must be cryptographically signed
- Documentation: Add doc comments for public APIs
When adding new features, ensure:
- Unit tests for individual functions
- Commutativity tests for any merge operations:
#[test] fn test_merge_is_commutative() { let result_ab = a.clone().merge(&b); let result_ba = b.clone().merge(&a); assert_eq!(result_ab, result_ba); }
- Delta round-trip tests for synchronization:
#[test] fn test_delta_round_trip() { let summary = state_a.summarize(); let delta = state_b.delta(&summary); let mut reconstructed = state_a.clone(); reconstructed.apply_delta(&delta); assert_eq!(reconstructed, state_b); }
- Real Freenet gateway integration (WebSocket)
- Delegate implementation for secure key storage
- Order sharing via invite links
- Order history and archiving
- Price currency support
- Mobile-responsive UI improvements
- Accessibility improvements
- Internationalization (i18n)
When reporting issues, please include:
- Description of the problem
- Steps to reproduce
- Expected vs actual behavior
- Rust version (
rustc --version) - OS and browser (for UI issues)
MIT License - see LICENSE file for details.
- Freenet Documentation
- Dioxus Documentation
- River Chat - Reference Freenet application