# RUSTLE - UCXL Browser

**RUSTLE** (Rust + Tauri UCXL Engine) is a desktop application for browsing and interacting with UCXL (Unified Context Exchange Language) content through a distributed hash table (DHT) network.

## Features

- **UCXL Protocol Support**: Full implementation of UCXL URI parsing and content handling
- **DHT Storage**: Distributed content storage using libp2p and BZZZ gateway
- **Temporal Navigation**: Version control and timeline browsing for UCXL content
- **BZZZ Gateway Integration**: Local subnet peer discovery and content replication
- **Cross-Language Standards**: Standardized error/response codes for Rust, Go, and Python
- **Modern UI**: React-based interface with professional styling

## Architecture

### Core Components

- **ucxl-core**: Rust library containing UCXL protocol implementation
- **BZZZ Gateway**: Peer-to-peer networking layer for content distribution
- **DHT Storage**: Distributed hash table for decentralized content storage
- **Temporal Engine**: Version control and timeline management
- **React UI**: Modern web-based user interface

### Technology Stack

- **Backend**: Rust with Tauri for native desktop integration
- **Frontend**: React with TypeScript for the user interface
- **Networking**: libp2p for peer-to-peer communication
- **Storage**: DHT-based distributed storage
- **Standards**: UCXL standardized error/response codes

## Getting Started

### Prerequisites

- Rust 1.70+ with Cargo
- Node.js 18+ with npm
- Git

### Development Setup

1. **Clone the repository:**
   ```bash
   git clone <repository-url>
   cd rustle
   ```

2. **Install dependencies:**
   ```bash
   # Install Rust dependencies
   cargo build
   
   # Install Node.js dependencies
   npm install
   ```

3. **Run in development mode:**
   ```bash
   cargo tauri dev
   ```

### Building for Production

```bash
cargo tauri build
```

## Project Structure

```
rustle/
├── ucxl-core/               # Core UCXL implementation
│   ├── src/
│   │   ├── lib.rs          # Main library exports
│   │   ├── envelope.rs     # UCXL envelope handling
│   │   ├── commands.rs     # UCXL command processing
│   │   ├── dht.rs          # DHT storage implementation
│   │   ├── bzzz.rs         # BZZZ gateway networking
│   │   ├── temporal.rs     # Temporal navigation engine
│   │   └── ucxl_codes.rs   # Standardized error/response codes
│   └── Cargo.toml
├── src-tauri/              # Tauri desktop app
│   ├── src/
│   │   ├── main.rs         # Application entry point
│   │   ├── lib.rs          # Tauri configuration
│   │   └── commands.rs     # IPC commands
│   └── Cargo.toml
├── src/                    # React frontend
│   ├── App.tsx             # Main application component
│   ├── App.css             # Application styles
│   └── main.tsx            # React entry point
├── ucxl_codes.go           # Go standard library
├── ucxl_codes.py           # Python standard library
└── UCXL_CODES_README.md    # Standards documentation
```

## UCXL Standards Compliance

RUSTLE implements the full UCXL specification including:

- **Standardized Error Codes**: `UCXL-400-INVALID_ADDRESS`, `UCXL-404-NOT_FOUND`, etc.
- **Standardized Response Codes**: `UCXL-200-OK`, `UCXL-201-CREATED`, etc.
- **Cross-Language Libraries**: Identical APIs for Rust, Go, and Python
- **Structured Payloads**: Machine-readable error and response formats

See [UCXL_CODES_README.md](./UCXL_CODES_README.md) for complete documentation.

## Development Commands

### Core Library
```bash
cd ucxl-core
cargo test              # Run tests
cargo build --release   # Build optimized library
```

### Desktop Application
```bash
cargo tauri dev         # Development mode with hot reload
cargo tauri build       # Production build
cargo tauri info        # System information
```

### Frontend
```bash
npm run dev             # Development server
npm run build           # Production build
npm run lint            # Code linting
```

## DHT Network

RUSTLE uses a distributed hash table (DHT) for decentralized content storage:

- **BZZZ Gateway**: Local subnet peer discovery and bootstrap
- **Content Replication**: Automatic content replication across peers
- **Self-Healing**: Network partition detection and recovery
- **Temporal Navigation**: Version-aware content retrieval

## Contributing

1. Fork the repository
2. Create a feature branch: `git checkout -b feature-name`
3. Make changes and test thoroughly
4. Follow Rust and React best practices
5. Update documentation as needed
6. Submit a pull request

## License

This project follows the same license as the UCXL specification.

## Architecture Documentation

For detailed technical documentation, see:
- `Development Plan ucxl Browser using Rust and Tauri.md` - Complete development plan
- `Context Browser.md` - Context and requirements
- `UCXL_CODES_README.md` - Standards compliance documentation