Ruggine is a modern, secure, and scalable real-time chat application built entirely in Rust. It features end-to-end encryption, WebSocket-based real-time messaging, and a beautiful cross-platform desktop GUI. Designed for both educational purposes and production deployment.
- Instant communication via WebSocket connections
- Private and group chats with unlimited participants
- Message persistence with SQLite/PostgreSQL backend
- Online presence tracking with real-time user status
- Message history with full-text search capabilities
- End-to-end encryption using AES-256-GCM
- Secure session management with token-based authentication
- TLS support for production deployments
- Password hashing with industry-standard algorithms
- Session timeout and automatic cleanup
- Redis integration for high-performance caching and pub/sub
- Async architecture built on Tokio for maximum concurrency
- Connection pooling and efficient resource management
- Horizontal scaling support with multiple server instances
- Native desktop application using Iced framework
- Clean, modern interface with dark/light theme support
- Responsive design that works on various screen sizes
- Real-time notifications for new messages
- Multi-window support for different conversations
- Modular architecture with clear separation of concerns
- Comprehensive documentation and code examples
- Built-in monitoring and performance metrics
- Docker support for easy deployment
- Quick Start
- Architecture
- Installation
- Configuration
- Usage
- Development
- Deployment
- API Documentation
- Contributing
- License
- Rust 1.75+ (stable toolchain)
- Redis 6.0+ for real-time messaging
- SQLite (included) or PostgreSQL for data persistence
git clone https://github.com/doroteaMonaco/Ruggine-App.git
cd Ruggine-App
cargo build --release
ENCRYPTION_MASTER_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
TLS_CERT_PATH=/etc/ssl/certs/ruggine.crt
TLS_KEY_PATH=/etc/ssl/private/ruggine.key
LOG_LEVEL=info# Install Redis locally
# Windows (with Chocolatey):
choco install redis-64
# macOS (with Homebrew):
brew install redis
# Linux (Ubuntu/Debian):
sudo apt install redis-server
# Start Redis
redis-server# Terminal 1: Start the server
cargo run --bin ruggine-server
# Terminal 2: Start the GUI client
cargo run --bin ruggine-guiThat's it! You now have a fully functional chat application running locally.
Ruggine follows a modern client-server architecture designed for scalability and maintainability:
βββββββββββββββββββ WebSocket βββββββββββββββββββ Redis βββββββββββββββ
β β Connection β β Pub/Sub β β
β Iced GUI ββββββββββββββββββΊβ Rust Server βββββββββββββββΊβ Redis β
β Client β β (Tokio async) β β Cache β
β β β β β β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββ
β
β SQLx
βΌ
βββββββββββββββββββ
β β
β SQLite/Postgres β
β Database β
β β
βββββββββββββββββββ
- π₯οΈ GUI Client: Built with Iced framework for cross-platform native performance
- β‘ Server: Async Rust server using Tokio for handling thousands of concurrent connections
- π WebSocket Layer: Real-time bidirectional communication between clients and server
- π Redis: High-performance caching and pub/sub for scaling across multiple instances
- πΎ Database: Persistent storage with support for both SQLite (development) and PostgreSQL (production)
- OS: Windows 10+, macOS 10.15+, or Linux (Ubuntu 18.04+)
- RAM: 4GB minimum, 8GB recommended
- Storage: 500MB for application + database storage
- Network: Internet connection for initial setup
- Install Rust (if not already installed):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env- Clone the repository:
git clone https://github.com/doroteaMonaco/Ruggine-App.git
cd Ruggine-App- Install dependencies:
# On Ubuntu/Debian
sudo apt update
sudo apt install build-essential pkg-config libssl-dev
# On macOS (with Homebrew)
brew install openssl pkg-config
# On Windows (with vcpkg)
vcpkg install openssl:x64-windows- Build the project:
cargo build --releaseRuggine uses environment variables for configuration. Create a .env file in the project root:
# Database Configuration
DATABASE_URL=sqlite:data/ruggine_modulare.db
# For PostgreSQL: DATABASE_URL=postgres://user:password@localhost/ruggine
# Redis Configuration
REDIS_URL=redis://127.0.0.1:6379
# Server Configuration
SERVER_HOST=127.0.0.1
HTTP_PORT=5000
WEBSOCKET_PORT=5001
# Security
ENABLE_ENCRYPTION=true
ENCRYPTION_MASTER_KEY=your-32-byte-hex-key-here
SESSION_TIMEOUT_HOURS=24
# Logging
LOG_LEVEL=info
RUST_LOG=ruggine=debug
# TLS (for production)
TLS_CERT_PATH=/path/to/cert.pem
TLS_KEY_PATH=/path/to/key.pemredis.conf: Redis server configurationCargo.toml: Rust dependencies and project metadatadocker-compose.yml: Container orchestration setup
The server provides both HTTP and WebSocket endpoints:
# Development mode
cargo run --bin ruggine-server
# Production mode with release optimizations
cargo run --release --bin ruggine-serverServer will start on:
- HTTP API:
http://localhost:5000 - WebSocket:
ws://localhost:5001
cargo run --bin ruggine-guiFeatures:
- Modern, responsive interface
- Real-time message updates
- Contact management
- Group chat creation
- File sharing capabilities
-
Register a new user:
- Launch the GUI client
- Click "Register"
- Enter username and password
- Click "Create Account"
-
Login:
- Enter your credentials
- Click "Login"
-
Start chatting:
- Select a contact or create a group
- Type your message
- Press Enter to send
src/
βββ bin/ # Executable binaries
β βββ ruggine-server.rs # Main server application
β βββ ruggine-gui.rs # Desktop GUI client
β βββ db_inspect.rs # Database inspection utility
βββ server/ # Server-side components
β βββ main.rs # Server entry point
β βββ websocket.rs # WebSocket handling
β βββ auth.rs # Authentication & sessions
β βββ database.rs # Database operations
β βββ messages.rs # Message processing
β βββ groups.rs # Group chat management
β βββ redis_cache.rs # Redis integration
βββ client/ # Client-side components
β βββ gui/ # Iced GUI components
β β βββ app.rs # Main application state
β β βββ views/ # UI views and layouts
β β βββ widgets/ # Custom UI widgets
β βββ services/ # Client services
β β βββ websocket_client.rs # WebSocket client
β β βββ chat_service.rs # Chat operations
β β βββ connection.rs # Connection management
β βββ models/ # Data models
βββ common/ # Shared components
β βββ models.rs # Common data structures
β βββ crypto.rs # Encryption utilities
βββ utils/ # Utility functions
βββ performance.rs # Performance monitoring
- Create a feature branch:
git checkout -b feature/your-feature-name-
Implement your changes following the existing code patterns
-
Update documentation if needed
-
Submit a pull request
We follow standard Rust conventions:
- Use
cargo fmtfor formatting - Use
cargo clippyfor linting - Follow the Rust API Guidelines
- Build Docker image:
docker build -t ruggine-chat .- Run with Docker Compose:
docker-compose up -dThis starts:
- Ruggine server
- Redis instance
- PostgreSQL database (if configured)
For production environments:
- Use PostgreSQL instead of SQLite
- Enable TLS with valid certificates
- Configure proper logging
- Set up monitoring and alerting
- Implement backup strategies
Example production configuration:
# docker-compose.prod.yml
version: '3.8'
services:
ruggine:
image: ruggine-chat:latest
environment:
- DATABASE_URL=postgres://user:pass@postgres:5432/ruggine
- REDIS_URL=redis://redis:6379
- ENABLE_TLS=true
- TLS_CERT_PATH=/certs/fullchain.pem
- TLS_KEY_PATH=/certs/privkey.pem
volumes:
- ./certs:/certs:ro
ports:
- "443:5000"
- "5001:5001"For high-traffic deployments:
- Use Redis cluster for horizontal scaling
- Deploy multiple server instances behind a load balancer
- Implement database read replicas
- Use CDN for static assets
{
"message_type": "auth",
"session_token": "your-session-token-here"
}{
"message_type": "send_message",
"chat_type": "private",
"to_user": "recipient_username",
"content": "Hello, world!",
"session_token": "your-session-token"
}{
"message_type": "send_message",
"chat_type": "group",
"group_id": "group_uuid",
"content": "Hello everyone!",
"session_token": "your-session-token"
}POST /register- Register new userPOST /login- User authenticationPOST /logout- End user sessionGET /users- List online usersPOST /groups- Create group chat
- End-to-end encryption using AES-256-GCM
- Secure session management with automatic timeout
- Input validation and SQL injection prevention
- Rate limiting to prevent abuse
- Audit logging for security events
- Connection pooling for database operations
- Redis caching for frequently accessed data
- WebSocket multiplexing for efficient real-time communication
- Async I/O throughout the application stack
- Zero-copy serialization where possible
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
- Follow the existing code style
- Write clear commit messages
- Add documentation for new features
- Ensure backward compatibility
- Update the changelog
- π Bug fixes and improvements
- β¨ New features and enhancements
- π Documentation improvements
- π§ Performance optimizations
- π Internationalization
This project follows the Rust Code of Conduct.
This project is licensed under the MIT License - see the LICENSE file for details.
- Repository: https://github.com/doroteaMonaco/Ruggine-App
- Documentation: /doc folder
- Issues: https://github.com/doroteaMonaco/Ruggine-App/issues
- Rust: https://www.rust-lang.org/
- Iced GUI: https://iced.rs/
- Built with β€οΈ using the amazing Rust ecosystem
- Special thanks to the Iced GUI framework team
- Inspired by modern chat applications and Rust best practices
- Created by Dorotea Monaco and Luigi Gonnella as part of a distributed systems project
Made with π¦ Rust | Real-time | Secure | Cross-platform
