Skip to main content

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:
The development server will start at 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 reload
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run check - Run Svelte type checking
  • npm run lint - Lint frontend, types, and backend
  • npm 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:
Install dependencies using pip:
Or install with all optional dependencies:

Run the Backend

Start the FastAPI backend server:
By default, the backend runs at http://0.0.0.0:8080.

Custom Host and Port

Development Mode

For backend development with auto-reload:
Or use uvicorn directly:

Environment Configuration

Secret Key

Open WebUI requires a secret key for session management. When running via open-webui serve, a key is automatically generated and stored in .webui_secret_key. For manual configuration:

Common Environment Variables

Create a .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:
Set the database URL:

Migrations

Database migrations are handled automatically by Alembic and Peewee-migrate when the application starts.

Code Quality Tools

Linting

Frontend:
Backend:
Or use the Black formatter:

Type Checking

Testing

Frontend tests:

Running with Docker (Development)

For a complete development environment with Docker:
This builds and runs both frontend and backend services with volume mounts for live reloading.

Troubleshooting

Port Conflicts

If port 8080 is already in use, specify a different port:

CUDA Support

For CUDA-enabled environments:
Verify CUDA is working:

Database Issues

Delete the database file to start fresh:

Next Steps

Additional Resources