rhailib/src/rhai_engine_ui/docs/ARCHITECTURE.md
2025-06-27 12:09:50 +03:00

57 lines
1.9 KiB
Markdown

# Architecture of the `rhai-engine-ui` Crate
The `rhai-engine-ui` crate provides a web-based user interface for interacting with the rhailib ecosystem, offering both client-side and server-side components for comprehensive Rhai script management and execution.
## Core Architecture
```mermaid
graph TD
A[Web UI] --> B[Client-Side Components]
A --> C[Server-Side Components]
A --> D[Integration Layer]
B --> B1[Yew Frontend]
B --> B2[WebAssembly Runtime]
B --> B3[Browser Interface]
C --> C1[Axum Web Server]
C --> C2[Redis Integration]
C --> C3[API Endpoints]
D --> D1[Task Submission]
D --> D2[Real-time Updates]
D --> D3[Result Display]
```
## Key Features
### Frontend (WebAssembly)
- **Yew Framework**: Modern Rust-based web frontend
- **Real-time Interface**: Live updates and interactive script execution
- **Browser Integration**: Native web technologies with Rust performance
### Backend (Optional Server)
- **Axum Web Server**: High-performance async web server
- **Redis Integration**: Direct connection to rhailib task queues
- **API Layer**: RESTful endpoints for task management
### Dual Architecture
- **Client-Only Mode**: Pure WebAssembly frontend for development
- **Full-Stack Mode**: Complete web application with server backend
- **Feature Flags**: Configurable deployment options
## Dependencies
### Frontend Dependencies
- **Yew**: Component-based web framework
- **WebAssembly**: Browser runtime for Rust code
- **Web APIs**: Browser integration and DOM manipulation
### Backend Dependencies (Optional)
- **Axum**: Modern web framework
- **Redis**: Task queue integration
- **Tower**: Middleware and service abstractions
## Deployment Options
The UI can be deployed as a static WebAssembly application for development use or as a full-stack web application with server-side Redis integration for production environments.