Languages: English | Русский | 日本語
A peer-to-peer voice chat server built with Rust, featuring WebSocket communication, user authentication, and cloud configuration storage.
- WebSocket-based real-time communication - Connect to voice rooms via WebSocket
- User authentication - Register and login with secure password hashing (bcrypt)
- Room system - Create and join voice rooms dynamically
- Cloud configuration - Store and retrieve user settings
- SQLite database - Persistent storage for users and configurations
- Rust - Core language
- Axum - Web framework with WebSocket support
- Tokio - Async runtime
- bcrypt - Password hashing
- rusqlite - SQLite database bindings
- serde/serde_json - JSON serialization
- Rust (edition 2024 or compatible)
- Cargo package manager
# Clone the repository
git clone https://github.com/vvcall-dev/server.git
cd server
# Build the project
cargo build --release
# Run the server
cargo runThe server will start on port 3030 by default.
Set the DATABASE_URL environment variable to specify the database path:
export DATABASE_URL=/path/to/vvcall.dbIf not set, it defaults to vvcall.db in the current directory.
POST /api/register
Content-Type: application/json
{
"username": "user123",
"password": "securepassword"
}POST /api/login
Content-Type: application/json
{
"username": "user123",
"password": "securepassword"
}Response includes a session token and stored configuration.
POST /api/config
Content-Type: application/json
{
"token": "session-token",
"config_json": "{\"volume\": 80, \"mic_gain\": 50}"
}WS /ws/:room
Connect to a voice room by replacing :room with your desired room name. Messages sent to the room are broadcast to all connected clients.
The server creates a users table with the following structure:
CREATE TABLE users (
id INTEGER PRIMARY KEY,
username TEXT UNIQUE NOT NULL,
password_hash TEXT NOT NULL,
token TEXT,
config_json TEXT
);Build and run using Docker Compose:
docker-compose up --buildSee the LICENSE file for details.
p2p-server/
├── src/
│ └── main.rs # Main application code
├── Cargo.toml # Rust dependencies
├── Dockerfile # Docker configuration
├── docker-compose.yml
└── README.md # This file