Skip to content
STACK IT FAST

Open WebUI

Curated OSSAI-agentSelf-Hosted AI Interface & Agent Hub2-5 people

Audited from github.com/open-webui/open-webui

Open WebUI is a self-hosted, offline-capable AI interface with a SvelteKit frontend and a Python FastAPI backend that connects to Ollama, OpenAI-compatible APIs, and Anthropic and Google models.

Language
Python
Database
SQLite
Hosting
Docker
Running for
2 years
Team
2-5 people

Why this architecture

A SvelteKit-plus-FastAPI split lets one Docker image serve the UI and API together, while SQLAlchemy over SQLite or PostgreSQL and a swappable vector-store layer let self-hosters scale from a laptop to a multi-worker Redis-backed deployment without changing code.

Tech stack by layer

16 technologies · audited Sep 17, 2026
Frontend & UI
  • SvelteKitBuilds the chat UI, admin dashboards, and PWA shell; adapter-node and adapter-static both ship in devDependencies.
  • SvelteComponent framework for the whole client; largest non-Python language in the repo by bytes.
  • ViteDev server and production bundler invoked by npm run dev/build before the SvelteKit adapter runs.
  • Tailwind CSSUtility CSS for the app, configured with the container-queries and typography plugins.
  • Socket.IOsocket.io-client drives live chat streaming and presence in the browser.
Backend & APIs
  • PythonLargest language in the repo; hosts the FastAPI app under backend/open_webui.
  • FastAPIServes the REST and WebSocket API consumed by the SvelteKit frontend.
  • python-socketioImplements the realtime channel/notes/collaboration transport on the backend side of Socket.IO.
  • LangChainSplits and chunks documents for the local RAG pipeline (langchain-community, langchain-text-splitters).
  • APSchedulerRuns scheduled prompts and calendar automations described in the README.
Data & Persistence
  • SQLAlchemyAsync ORM layer with Alembic migrations backing both supported databases.
  • SQLiteDefault embedded database via aiosqlite; no external server required out of the box.
  • PostgreSQLOptional production database via psycopg; pgvector extra enables it as a vector store too.
  • RedisBacks sessions (starsessions[redis]) and horizontal-scale WebSocket state per the README.
  • ChromaDefault vector database for RAG; Qdrant, Milvus, Pinecone, OpenSearch, Elasticsearch and pgvector are optional extras.
Infrastructure & Deploy
  • DockerMulti-stage build compiles the SvelteKit frontend then copies it into a Python 3.11 runtime image published to ghcr.io.
  • GitHub ActionsSeparate backend.yaml, frontend.yaml, docker.yaml and release-pypi.yml workflows build, test and publish images and the PyPI package.
  • OllamaBundled as a companion service in docker-compose.yaml, with dedicated Dockerfile build args (USE_OLLAMA) to bake it into the image.
Tooling, Testing & Ops
  • Model Context ProtocolThe mcp Python SDK lets Open WebUI act as an MCP client for external tool servers.
  • OpenAI APIopenai, anthropic and google-genai SDKs are pinned dependencies for provider-agnostic model access.

Open WebUI architecture diagram

Open SVG
Open WebUI architecture diagramChat UI → Backend (REST); Chat UI → Realtime (Socket.IO); Backend → App database (SQLAlchemy); Backend → RAG pipeline (documents); RAG pipeline → Vector store (embeddings); Realtime → Redis (scale-out); Backend → Scheduler (schedules); Backend → Ollama (inference); Backend → Model APIs (inference)CLIENTSSERVICESWORKERS & JOBSDATA & STORAGEEXTERNALChat UISvelteKit · SvelteBackendFastAPI · UvicornRealtimepython-socketioSchedulerAPSchedulerRAG pipelineLangChain splittersApp databaseSQLite / PostgreSQLVector storeChroma (default)Redissessions · WS stateOllamalocal modelsModel APIsOpenAI-compatibleRESTSocket.IOdocumentsembeddingsschedulesSQLAlchemyscale-outinferenceinference
How the main components of Open WebUI connect, drawn from the audited repository.
Diagram as text
  • Chat UI (SvelteKit · Svelte) → Backend (FastAPI · Uvicorn): REST
  • Chat UI (SvelteKit · Svelte) → Realtime (python-socketio): Socket.IO
  • Backend (FastAPI · Uvicorn) → App database (SQLite / PostgreSQL): SQLAlchemy
  • Backend (FastAPI · Uvicorn) → RAG pipeline (LangChain splitters): documents
  • RAG pipeline (LangChain splitters) → Vector store (Chroma (default)): embeddings
  • Realtime (python-socketio) → Redis (sessions · WS state): scale-out
  • Backend (FastAPI · Uvicorn) → Scheduler (APScheduler): schedules
  • Backend (FastAPI · Uvicorn) → Ollama (local models): inference
  • Backend (FastAPI · Uvicorn) → Model APIs (OpenAI-compatible): inference

Key architectural decisions

6 decisions
  1. 01

    One Docker image bundles the built frontend and the Python backend

    The Dockerfile builds the SvelteKit app in a node:22-alpine stage, then copies the compiled /app/build output and CHANGELOG.md into a python:3.11-slim-bookworm runtime stage that also installs backend/requirements.txt, so a single ghcr.io/open-webui/open-webui image serves both.

  2. 02

    SQLite by default, PostgreSQL for scale, same SQLAlchemy models

    pyproject.toml pins sqlalchemy[asyncio] and aiosqlite unconditionally, then adds psycopg[binary] and pgvector as an optional "postgres" extra plus alembic for migrations, so operators pick a database without changing application code.

  3. 03

    Nine vector databases sit behind one RAG interface

    chromadb is a base dependency while qdrant-client, pymilvus, pinecone, opensearch-py, elasticsearch, weaviate-client and the pgvector extra are optional installs listed in pyproject.toml, letting self-hosters swap the RAG backend to match existing infrastructure.

  4. 04

    Realtime transport is python-socketio plus Redis, not raw WebSockets

    The backend depends on python-socketio and redis/hiredis while the frontend depends on socket.io-client, and starsessions[redis] is used for session storage so chat streaming and multi-worker deployments share state through Redis instead of in-process memory.

  5. 05

    LLM provider access goes through official vendor SDKs, not a single abstraction

    backend/requirements.txt pins openai, anthropic and google-genai directly alongside langchain/langchain-community for document processing, keeping provider-specific features available instead of hiding them behind one wrapper.

  6. 06

    In-browser Python execution ships via Pyodide, not a server sandbox

    package.json depends on pyodide and runs scripts/prepare-pyodide.js as a pretest/predev/prebuild step, and RestrictedPython is a separate backend dependency for server-side execution, splitting client-side and server-side code execution paths.

How Open WebUI is built

How Open WebUI is structured

Open WebUI is a single monorepo with a SvelteKit frontend at the root (src/, svelte.config.js, vite.config.ts) and a Python FastAPI backend under backend/open_webui. The two are built and shipped together: npm run build compiles the SvelteKit app, and the root Dockerfile copies that build output into a Python runtime image alongside the backend, so the project ships as one artifact rather than separate frontend and backend deployments. pyproject.toml defines the Python package (open-webui, built with hatchling) while package.json defines the npm package and build scripts; hatch_build.py and the [tool.hatch] config read the version straight out of package.json so both halves stay in sync.

Frontend

The client is built with SvelteKit (@sveltejs/kit, @sveltejs/adapter-node, @sveltejs/adapter-static, @sveltejs/adapter-auto all present in package.json) on top of Svelte 5, bundled with Vite 5 and styled with Tailwind CSS 4 plus the container-queries and typography plugins (tailwind.config.js, postcss.config.js). Editing surfaces are built on TipTap/ProseMirror (@tiptap/*, prosemirror-*) for the Notes feature, CodeMirror 6 for code blocks, and Mermaid/KaTeX/Vega-Lite for diagrams, math and charts. Realtime chat streaming and presence run over socket.io-client. Two more distinctive dependencies stand out: pyodide, run through scripts/prepare-pyodide.js before every dev/build, executes Python in the browser for interactive features, and @huggingface/transformers plus kokoro-js enable local, in-browser inference for embeddings and text-to-speech without a round trip to the backend.

Backend & APIs

The backend is a FastAPI application (fastapi==0.136.3 in pyproject.toml) served by Uvicorn, using Pydantic 2 for validation and python-socketio for the WebSocket layer that pairs with the frontend's Socket.IO client. Authentication and security dependencies include PyJWT, authlib, argon2-cffi, bcrypt and ldap3 for LDAP/Active Directory, matching the README's claims of SSO and enterprise auth. Scheduled automations run through APScheduler, and RestrictedPython sandboxes any user-supplied code executed server-side (distinct from the client-side Pyodide sandbox). AI-provider access is not hidden behind a single abstraction: openai, anthropic, google-genai, and langchain/langchain-community/langchain-classic are all direct dependencies, alongside tiktoken for token counting and mcp for Model Context Protocol client support.

Data & persistence

Persistence goes through async SQLAlchemy (sqlalchemy[asyncio]) with Alembic migrations. SQLite via aiosqlite is the default, unconditional dependency; PostgreSQL via psycopg[binary] and pgvector is an optional postgres extra, and a mariadb extra exists too, all sharing the same model layer. Session state and caching go through redis/hiredis and aiocache, and starsessions[redis] backs cookie sessions specifically for multi-worker deployments. For retrieval-augmented generation, chromadb is the always-installed default vector store, with qdrant-client, pymilvus, pinecone, opensearch-py, elasticsearch, and weaviate-client available as optional installs under the all extra — nine backends total per the README. File storage is similarly pluggable: boto3 (S3), google-cloud-storage, and azure-storage-blob are all listed dependencies for cloud file storage alongside local disk.

Realtime / collaboration

Realtime features (chat streaming, channels, live workflow status, calendar/automation updates) run over python-socketio on the backend and socket.io-client on the frontend. pycrdt (a Python binding for Yjs CRDTs) and the frontend's yjs/y-prosemirror/y-protocols dependencies together implement collaborative editing in the Notes and document-editing surfaces. Redis-backed sessions (starsessions[redis], redis, hiredis) are what make this realtime layer horizontally scalable across multiple backend workers, as called out in the README's "Horizontal Scalability" feature.

Build, test & deploy

package.json scripts drive svelte-check for type-checking, eslint/prettier for linting/formatting, vitest for frontend unit tests, and cypress for end-to-end tests; the Python side uses pylint, ruff, and black, invoked through npm run lint/format. GitHub Actions workflows split by concern: frontend.yaml and backend.yaml for CI, docker.yaml for image builds, and release.yml/release-pypi.yml for GitHub releases and the open-webui PyPI package (built via hatchling, entry point open-webui = "open_webui:app"). The Dockerfile supports build-time flags for CUDA, Ollama bundling, and a slim mode (USE_CUDA, USE_OLLAMA, USE_SLIM build args), producing different image variants from one file.

Self-hosting notes

The project is designed to be self-hosted and to run fully offline: the top-level docker-compose.yaml bundles an ollama service with the open-webui service and mounts a named volume at /app/backend/data for persistence, which the README calls out as required to avoid data loss. Multiple docker-compose.*.yaml variants (.gpu, .amdgpu, .api, .data, .otel, .playwright) target different hardware and feature combinations. SCARF_NO_ANALYTICS, DO_NOT_TRACK, and ANONYMIZED_TELEMETRY environment variables in the Dockerfile default to disabling external telemetry, consistent with the offline-first positioning.

What to copy (and what not to)

Worth copying: shipping frontend and backend as one container so there is exactly one thing to deploy, and putting the ORM (SQLAlchemy) ahead of the specific database so SQLite-to-PostgreSQL is a config change, not a rewrite. The nine-vector-database abstraction is powerful but adds real dependency weight (pyproject.toml's all extra pulls in seven additional client libraries); a project that only needs one vector store should not copy that breadth. Similarly, pinning exact versions with inline comments explaining why (aiodns==3.6.1 # keep pinned: ...) in backend/requirements.txt is a pattern worth reusing for any dependency that has bitten the team before.

Sources & repo audit

Audited
Sep 17, 2026
Commit
0a7c158
License
NOASSERTION

Independent analysis of repository at github.com/open-webui/open-webui. Spotted an inaccuracy? Use the claim form to request a correction.

Show this stack on your README or website
Tech stack of Open WebUI
[![Tech stack of Open WebUI on STACK IT FAST](https://stackitfast.com/badge/open-webui.svg)](https://stackitfast.com/project/open-webui)

Paste it into your README. It shows your current stack and links to this page.

Use this stack

Scaffold it with your agent

Paste this prompt into Claude Code, Cursor, Windsurf or AGY to start a project with Open WebUI's architecture.

  1. 1Copy the promptThe full markdown spec, with every layer and decision.
  2. 2Open your AI toolClaude Code, Cursor, Windsurf or Copilot, in a new repo.
  3. 3Paste and scaffoldUse it as the first instruction; review before you ship.
use-this-stack.md · 61 lines · 8.5 KB
# MISSION: Scaffold "Open WebUI" Production Architecture
You are an expert Senior Staff Software Architect and Full-Stack Engineer. Your mission is to scaffold and implement a production-grade, highly reliable, and modular codebase following the proven architecture of **Open WebUI**.
---
## 1. PROJECT SPECIFICATIONS & BENCHMARK
- **Reference Architecture**: Open WebUI
- **What It Does**: Open WebUI is a self-hosted, offline-capable AI interface with a SvelteKit frontend and a Python FastAPI backend that connects to Ollama, OpenAI-compatible APIs, and Anthropic and Google models.
- **Domain & Category**: Self-Hosted AI Interface & Agent Hub
- **Production Scale**: 2-5 people
- **Development Mode**: AI-AGENT
- **Architectural Rationale**: A SvelteKit-plus-FastAPI split lets one Docker image serve the UI and API together, while SQLAlchemy over SQLite or PostgreSQL and a swappable vector-store layer let self-hosters scale from a laptop to a multi-worker Redis-backed deployment without changing code.
- **Live Website Reference**: https://openwebui.com
- **Source Repository**: https://github.com/open-webui/open-webui
---
## 2. PRODUCTION TECH STACK
- **Full Stack Array**: Python, Svelte, SvelteKit, TypeScript, FastAPI, SQLAlchemy, SQLite, PostgreSQL, Redis, Chroma, Vite, Tailwind CSS, LangChain, Socket.IO, Docker, Ollama
- **Primary Language(s)**: Python, Svelte, JavaScript
- **License of the reference repo**: NOASSERTION
- **Frontend**: SvelteKit — Builds the chat UI, admin dashboards, and PWA shell; adapter-node and adapter-static both ship in devDependencies.; Svelte — Component framework for the whole client; largest non-Python language in the repo by bytes.; Vite — Dev server and production bundler invoked by npm run dev/build before the SvelteKit adapter runs.; Tailwind CSS — Utility CSS for the app, configured with the container-queries and typography plugins.; Socket.IO — socket.io-client drives live chat streaming and presence in the browser.
- **Backend & APIs**: Python — Largest language in the repo; hosts the FastAPI app under backend/open_webui.; FastAPI — Serves the REST and WebSocket API consumed by the SvelteKit frontend.; python-socketio — Implements the realtime channel/notes/collaboration transport on the backend side of Socket.IO.; LangChain — Splits and chunks documents for the local RAG pipeline (langchain-community, langchain-text-splitters).; APScheduler — Runs scheduled prompts and calendar automations described in the README.
- **Data & persistence**: SQLAlchemy — Async ORM layer with Alembic migrations backing both supported databases.; SQLite — Default embedded database via aiosqlite; no external server required out of the box.; PostgreSQL — Optional production database via psycopg; pgvector extra enables it as a vector store too.; Redis — Backs sessions (starsessions[redis]) and horizontal-scale WebSocket state per the README.; Chroma — Default vector database for RAG; Qdrant, Milvus, Pinecone, OpenSearch, Elasticsearch and pgvector are optional extras.
- **Infrastructure & deploy**: Docker — Multi-stage build compiles the SvelteKit frontend then copies it into a Python 3.11 runtime image published to ghcr.io.; GitHub Actions — Separate backend.yaml, frontend.yaml, docker.yaml and release-pypi.yml workflows build, test and publish images and the PyPI package.; Ollama — Bundled as a companion service in docker-compose.yaml, with dedicated Dockerfile build args (USE_OLLAMA) to bake it into the image.
- **Tooling, testing & ops**: Model Context Protocol — The mcp Python SDK lets Open WebUI act as an MCP client for external tool servers.; OpenAI API — openai, anthropic and google-genai SDKs are pinned dependencies for provider-agnostic model access.
---
## 3. KEY ARCHITECTURAL DECISIONS (audited from https://github.com/open-webui/open-webui @ 0a7c158)
1. **One Docker image bundles the built frontend and the Python backend**: The Dockerfile builds the SvelteKit app in a node:22-alpine stage, then copies the compiled /app/build output and CHANGELOG.md into a python:3.11-slim-bookworm runtime stage that also installs backend/requirements.txt, so a single ghcr.io/open-webui/open-webui image serves both.
2. **SQLite by default, PostgreSQL for scale, same SQLAlchemy models**: pyproject.toml pins sqlalchemy[asyncio] and aiosqlite unconditionally, then adds psycopg[binary] and pgvector as an optional "postgres" extra plus alembic for migrations, so operators pick a database without changing application code.
3. **Nine vector databases sit behind one RAG interface**: chromadb is a base dependency while qdrant-client, pymilvus, pinecone, opensearch-py, elasticsearch, weaviate-client and the pgvector extra are optional installs listed in pyproject.toml, letting self-hosters swap the RAG backend to match existing infrastructure.
4. **Realtime transport is python-socketio plus Redis, not raw WebSockets**: The backend depends on python-socketio and redis/hiredis while the frontend depends on socket.io-client, and starsessions[redis] is used for session storage so chat streaming and multi-worker deployments share state through Redis instead of in-process memory.
5. **LLM provider access goes through official vendor SDKs, not a single abstraction**: backend/requirements.txt pins openai, anthropic and google-genai directly alongside langchain/langchain-community for document processing, keeping provider-specific features available instead of hiding them behind one wrapper.
6. **In-browser Python execution ships via Pyodide, not a server sandbox**: package.json depends on pyodide and runs scripts/prepare-pyodide.js as a pretest/predev/prebuild step, and RestrictedPython is a separate backend dependency for server-side execution, splitting client-side and server-side code execution paths.
---
## 4. NON-NEGOTIABLE ARCHITECTURAL GUARDRAILS
1. **Monorepo & Modular Separation**:
   - Structure as a Turborepo monorepo with strict package boundaries:
     - `apps/web`: Application UI, routing, layouts, and server endpoints.
     - `packages/ui`: Shared design tokens, CSS variables, and Radix UI primitive components.
     - `packages/db`: Database schemas, client singleton, declarative migrations, and seed scripts.
     - `packages/config`: Shared TypeScript, ESLint, and build configurations.
2. **Strict Type Safety & Zero `any` Policy**:
   - Enable `strict: true`, `noImplicitAny: true`, and `strictNullChecks: true`.
   - Validate ALL external inputs, API request bodies, and query parameters with **Zod** schemas before execution.
3. **Frontend & Rendering Guidelines**:
   - Utilize Vite 6 with TanStack Router for fully type-safe routing. Manage server state and caching via TanStack Query v5 with optimistic UI updates.
4. **Design System & Aesthetics**:
   - Keep every color, radius, shadow and font in a single token file (CSS variables) and consume tokens everywhere; never hardcode hex values in components.
   - Prefer crisp 1px borders and one subtle shadow scale over blurry default shadows. Pair one sans-serif for body/headings with one monospace for tags, badges, metrics, and code.
5. **Data Layer & Reliability**:
   - Write declarative schema definitions with foreign keys, composite indexes on queried filters, and automated timestamp triggers.
   - Use connection pooling and prepared statements for serverless database execution.
---
## 5. STEP-BY-STEP SCAFFOLDING ROADMAP
- **Phase 1: Workspace & Root Config**: Initialize package manager, monorepo configuration (`turbo.json`, `tsconfig.base.json`, `package.json`).
- **Phase 2: Database Schema & Client**: Set up the data layer (SQLAlchemy, SQLite, PostgreSQL, Redis, Chroma): client, connection pool, models, and migration scripts.
- **Phase 3: Design Tokens & UI Primitives**: Build accessible `Button`, `Input`, `Card`, `Badge`, and layout wrappers inside `packages/ui`.
- **Phase 4: Core Application Routes & Handlers**: Implement primary authentication, user session handling, and application routes.
- **Phase 5: Quality Assurance & Build Verification**: Run `tsc --noEmit`, ESLint, Prettier, and smoke test suites to ensure zero compilation or runtime errors.
---
## 6. EXECUTION INSTRUCTIONS
1. Review all specifications, architectural guardrails, and stack choices above.
2. Present the full monorepo directory tree structure.
3. Systematically generate the complete, production-ready codebase according to the 5-phase roadmap above — starting with the root workspace setup, followed by the database schema, UI design system package, and full-stack application routes until the repository is fully scaffolded and ready to run.
Scaffolded something with this prompt?
Would you pick this stack for a self-hosted ai interface & agent hub project?

Frequently asked about Open WebUI

What is Open WebUI built with?

A SvelteKit and Svelte 5 frontend built with Vite and Tailwind CSS, talking to a Python FastAPI backend over REST and Socket.IO, packaged together into one Docker image.

Does Open WebUI need Ollama to work?

No. It connects to Ollama and to any OpenAI-compatible API; backend/requirements.txt also pins the openai, anthropic and google-genai SDKs directly for provider-native features.

What database does Open WebUI use?

SQLite by default through aiosqlite, with PostgreSQL available as an optional extra in pyproject.toml, both accessed through the same async SQLAlchemy models and Alembic migrations.

Can Open WebUI be self-hosted fully offline?

Yes. The README describes running it entirely offline via Docker, pip, or Kubernetes, and the Dockerfile builds a self-contained image with no required external services beyond an optional database or vector store.

Which vector databases does Open WebUI support for RAG?

Chroma ships as the default per pyproject.toml, with Qdrant, Milvus, Pinecone, OpenSearch, Elasticsearch, Weaviate and pgvector available as optional extras behind the same retrieval interface.

Which models can Open WebUI connect to?

Local models through Ollama plus any OpenAI-compatible API; backend/requirements.txt also pins the openai, anthropic and google-genai SDKs so provider-native OpenAI, Anthropic and Google features stay available.

One email a month: new deep dives and stack trends

New source-audited architectures, head-to-head comparisons and the monthly stack report. No spam, unsubscribe anytime.

use-this-stack.md