Skip to content
This repository was archived by the owner on Nov 22, 2025. It is now read-only.

xxnuo/open-webui-rust

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open WebUI with Rust Backend

High‑Performance Rust Implementation of Open WebUI

This is the legacy version repository; the latest version has been merged into the main repository: xxnuo/open-coreui

Overview

The Rust backend is a drop-in replacement for the Python backend, offering:

  • 10-50x faster response times for API endpoints
  • 70% lower memory usage under load
  • Native concurrency with Tokio's async runtime
  • Type safety preventing entire classes of runtime errors
  • Zero-copy streaming for chat completions
  • Production-ready with comprehensive error handling

Rust Backend Environment Variables

Create .env file in rust-backend/ directory:

# Server Configuration
HOST=0.0.0.0
PORT=8168
ENV=development
RUST_LOG=info

# Security (IMPORTANT: Set a fixed key to persist auth tokens across restarts)
WEBUI_SECRET_KEY=your-secret-key-min-32-chars
JWT_EXPIRES_IN=168h

# Database (Required) - Match docker-compose.dev.yaml settings
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/openwebui
DATABASE_POOL_SIZE=10
DATABASE_POOL_MAX_OVERFLOW=10
DATABASE_POOL_TIMEOUT=30
DATABASE_POOL_RECYCLE=3600

# Redis (Recommended) - Match docker-compose.dev.yaml settings
ENABLE_REDIS=false
REDIS_URL=redis://localhost:6379

# Authentication
ENABLE_SIGNUP=true
ENABLE_LOGIN_FORM=true
ENABLE_API_KEY=true
DEFAULT_USER_ROLE=pending

# OpenAI Configuration (if using OpenAI models)
ENABLE_OPENAI_API=true
OPENAI_API_KEY=sk-your-key
OPENAI_API_BASE_URL=https://api.openai.com/v1

# CORS
CORS_ALLOW_ORIGIN=*

# WebSocket
ENABLE_WEBSOCKET_SUPPORT=true
WEBSOCKET_MANAGER=local

# Features
ENABLE_IMAGE_GENERATION=false
ENABLE_CODE_EXECUTION=false
ENABLE_WEB_SEARCH=false

# Audio (Optional)
TTS_ENGINE=openai
STT_ENGINE=openai

# RAG/Retrieval (Optional) - ChromaDB integration
CHUNK_SIZE=1500
CHUNK_OVERLAP=100
RAG_TOP_K=5

# Storage
UPLOAD_DIR=/app/data/uploads

# Logging
GLOBAL_LOG_LEVEL=INFO

Systemd Service (Linux)

[Unit]
Description=Open WebUI Rust Backend
After=network.target postgresql.service redis.service

[Service]
Type=simple
User=webui
WorkingDirectory=/opt/open-webui-rust
EnvironmentFile=/opt/open-webui-rust/.env
ExecStart=/opt/open-webui-rust/target/release/open-webui-rust
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

API Compatibility

The Rust backend maintains 100% API compatibility with the Python backend for core endpoints:

Authentication

  • POST /api/v1/auths/signup - User registration
  • POST /api/v1/auths/signin - User login
  • POST /api/v1/auths/signout - User logout
  • POST /api/v1/auths/api_key - Generate API key

Chat Completions

  • POST /api/chat/completions - OpenAI-compatible chat
  • POST /api/v1/chat/completions - Alternative endpoint
  • POST /openai/v1/chat/completions - Full OpenAI compatibility
  • WS /api/ws/chat - WebSocket streaming

Models

  • GET /api/models - List available models
  • GET /api/models/base - List base models
  • POST /api/v1/models - Create model
  • GET /api/v1/models/:id - Get model details

Users

  • GET /api/v1/users - List users (admin)
  • GET /api/v1/users/:id - Get user profile
  • PUT /api/v1/users/:id - Update user
  • DELETE /api/v1/users/:id - Delete user

Files & Knowledge

  • POST /api/v1/files - Upload file
  • GET /api/v1/files/:id - Download file
  • POST /api/v1/knowledge - Create knowledge base
  • GET /api/v1/retrieval/query - Query knowledge

Health & Status

  • GET /health - Basic health check
  • GET /health/db - Database connectivity check
  • GET /api/config - Frontend configuration
  • GET /api/version - Backend version

Performance

Quick Summary

Metric Python (FastAPI) Rust (Actix-Web) Improvement
Login (p50) 45ms 3ms 15x faster
Chat Completion (p50) 890ms 35ms* 25x faster
Model List (p50) 23ms 1.2ms 19x faster
Memory (1000 req) 450 MB 85 MB 5.3x lower
Throughput 850 req/s 12,400 req/s 14.6x higher

*Note: Chat completion speed primarily depends on LLM provider. Rust excels at streaming and handling overhead.

About

This is the legacy version repository; the latest version has been merged into the main repository: https://github.com/xxnuo/open-coreui

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Svelte 37.6%
  • Rust 30.6%
  • TypeScript 30.3%
  • JavaScript 0.6%
  • CSS 0.6%
  • HTML 0.1%
  • Other 0.2%