Prerequisites
Before setting up Open WebUI for local development, ensure you have the following installed:- Node.js version 18.13.0 or higher (up to 22.x.x)
- npm version 6.0.0 or higher
- Python version 3.11 or 3.12
- Git
Clone the Repository
First, clone the Open WebUI repository:Frontend Setup (SvelteKit)
The frontend is built with SvelteKit and uses Vite as the build tool.Install Dependencies
Development Server
Start the frontend development server:http://localhost:5173 (Vite default) with hot-reload enabled.
Alternative Port
To run on port 5050:Available Scripts
npm run dev- Start development server with hot reloadnpm run build- Build for productionnpm run preview- Preview production buildnpm run check- Run Svelte type checkingnpm run lint- Lint frontend, types, and backendnpm run format- Format code with Prettier
Backend Setup (FastAPI)
The backend is built with FastAPI and Python.Install Python Dependencies
It’s recommended to use a virtual environment:Run the Backend
Start the FastAPI backend server:http://0.0.0.0:8080.
Custom Host and Port
Development Mode
For backend development with auto-reload:Environment Configuration
Secret Key
Open WebUI requires a secret key for session management. When running viaopen-webui serve, a key is automatically generated and stored in .webui_secret_key.
For manual configuration:
Common Environment Variables
.env file in the project root for persistent configuration.
Database Setup
Open WebUI uses SQLite by default. The database file (webui.db) is created automatically on first run in the backend/data directory.
PostgreSQL (Optional)
For PostgreSQL support:Migrations
Database migrations are handled automatically by Alembic and Peewee-migrate when the application starts.Code Quality Tools
Linting
Frontend:Type Checking
Testing
Frontend tests:Running with Docker (Development)
For a complete development environment with Docker:Troubleshooting
Port Conflicts
If port 8080 is already in use, specify a different port:CUDA Support
For CUDA-enabled environments:Database Issues
Delete the database file to start fresh:Next Steps
- Review the Architecture to understand the system design
- Read the Contributing Guide before submitting changes
- Explore Plugin Development to extend functionality