Why self-host OpenUI on a VPS
OpenUI is aimed at front-end developers and designers who want to turn an idea ("a login form with a blue button and a forgotten-password option") into functional HTML/Tailwind/React code, rendered instantly in the browser. Rather than depending on an online service with generation limits and privacy risks, hosting it on your VPS gives you a permanent endpoint, shareable via an internal link, where anyone can prototype without a local installation. Key point: OpenUI needs an LLM to generate the code — you point it either to an external model via API key (OpenAI, Anthropic, Mistral…), or to a local Ollama running on the same VPS, which keeps the entire chain in-house. The real-time rendering of components hugely accelerates mock-up iterations: describe, see, copy the code into your project.
The concrete benefits of self-hosting
- UI prototyping workshop shared via a simple internal URL, no client-side installation.
- Live rendering of the generated components (HTML, Tailwind, React, Svelte).
- Choice of model backend: external API key or 100% local Ollama.
- No generation limit imposed by a third-party service.
- Clean code export, ready to copy into your project codebase.
- Confidentiality of client briefs and mock-ups kept on your VPS.
Hardware and software prerequisites
OpenUI itself is lightweight: the application (Python backend + front) fits on a 2 vCPU / 2 to 4 GB RAM VPS if you use an external API key for the model. If you want to keep everything local with Ollama on the same machine, size it according to the target model: count on 8 to 16 GB of additional RAM for a quantized 7B model (e.g. Qwen2.5-Coder-7B-Q4), and up to 32 GB for a 13B. Plan for a few GB of disk for Docker images and more if you store Ollama models (each model weighs 4 to 8 GB). On the software side: Ubuntu 22.04, Docker and Docker Compose, a model API key (or Ollama installed), git, and a configured subdomain like ui.mydomain.com pointing to your VPS.
Step-by-step deployment
Grab the project
Via SSH, clone the repository:
git clone https://github.com/wandb/openuithen move into thebackendfolder. OpenUI provides aDockerfileand ready-to-use build instructions. Check the current branch:git log --oneline -3to make sure you are starting from a stable commit.Choose the model backend
For an external model, fill in your key in an environment variable (
OPENAI_API_KEYor equivalent depending on the provider). To stay local, install Ollama (curl -fsSL https://ollama.com/install.sh | sh), pull a code-oriented model withollama pull qwen2.5-coder:7band point OpenUI to it viaOLLAMA_HOST=http://localhost:11434.Build and run the container
Build the image then start:
docker compose up -d. OpenUI exposes port7878by default. Follow the startup withdocker compose logs -funtil you see the server ready message. If the build fails on Python dependencies, make sure you are using theDockerfileprovided inbackend/.Check the rendering
Open
http://VPS_IP:7878, type a component description (e.g. "a primary button with icon and disabled state") and confirm that the code is generated AND rendered live in the preview. If generation fails with a model connection error, check the logs and ensure the API key environment variable is properly injected.Secure behind a reverse proxy
OpenUI has no strong authentication by default: place Caddy or Nginx in front of port 7878 with Basic Auth, and enable automatic SSL for
ui.mydomain.com. Restrict access to the raw port via the firewall (ufw deny 7878). See the dedicated section below for the full Nginx configuration.
Nginx configuration and TLS
Here is a minimal nginx configuration to expose OpenUI with Basic Auth and HTTPS. Create /etc/nginx/sites-available/openui with: an upstream openui_backend pointing to 127.0.0.1:7878, then a server block listening on 443 with your certificate (Let's Encrypt via Certbot or DNS-01). In the location / block, add proxy_pass http://openui_backend, proxy_http_version 1.1, the Upgrade and Connection headers for WebSocket (OpenUI uses persistent connections for real-time rendering), and auth_basic with a .htpasswd file generated by htpasswd -c /etc/nginx/.htpasswd user. Add a second server block on port 80 that 301-redirects to HTTPS. Enable the site with ln -s in sites-enabled and reload nginx. Remember to block port 7878 directly: ufw deny 7878 so that no unauthenticated access is possible by bypassing the proxy.
OpenUI vs Open WebUI: two tools not to confuse
The confusion is frequent in searches and discussions: OpenUI (by Wandb/W&B) and Open WebUI are two distinct projects with very different uses. OpenUI generates user interface component code from a text description — it is a prototyping and front-end code generation tool. Open WebUI is a web chat interface for interacting with LLMs (Ollama, OpenAI…), similar to what ChatGPT offers but self-hosted. To summarize: if you want to create UI components by description, use OpenUI. If you want a chat interface for your local models, use Open WebUI. Both can coexist on the same VPS and share the same Ollama backend — they complement each other without competing.
OpenUI vs Open WebUI: which tool for which use case?
Scroll the table
| OpenUI (Wandb) | Open WebUI |
|---|---|
| Generates HTML/Tailwind/React/Svelte components | Web chat interface for LLMs (self-hosted ChatGPT-style) |
| Live visual rendering in the browser | Multi-model management, RAG, conversation history |
| Ready-to-integrate source code export | Ideal for assistance, research, general tasks |
| Ideal for UI prototyping and front-end code generation | Requires Ollama or an OpenAI-compatible API |
| Requires an LLM (external API or local Ollama) | Built-in user and role management |
| Default port: 7878 | Default port: 3000 |
Advanced configuration with docker-compose
For a fully sovereign chain, have OpenUI and Ollama coexist in the same docker-compose.yml on an internal Docker network. Define two services: ollama (image ollama/ollama) and openui (image built from ./backend). Add a custom ai_net network and attach both services to it. In OpenUI's environment variables, point the backend to http://ollama:11434 — Docker DNS resolves the service name automatically, without ever exposing Ollama to the Internet. For generation quality, a code-oriented model (Qwen2.5-Coder, CodeLlama) gives far better Tailwind/React components than a generalist model of the same size. Test several and keep the one whose rendering is most faithful to your prompts. To enable session and user preference persistence, mount a Docker volume on OpenUI's data directory (/app/.openui) to preserve configuration between restarts.
Environment variables and authentication in production
OpenUI recognizes several environment variables useful for a secure deployment. OPENAI_API_KEY: key for OpenAI-compatible models (OpenAI, Mistral, Groq…). ANTHROPIC_API_KEY: for Anthropic's Claude models. OLLAMA_HOST: Ollama backend URL (e.g. http://ollama:11434 in Docker Compose). HOST and PORT: internal listening address (leave 0.0.0.0:7878 behind the proxy). Never store your API keys in plain text in docker-compose.yml: use a .env file (added to .gitignore) or a secrets manager. Since OpenUI's native authentication is limited, prefer nginx Basic Auth for restricted team access, or an identity proxy (Authelia, Authentik) if you need SSO and per-user access logs.
Troubleshooting: common errors
Here are the most common issues encountered when deploying OpenUI on a VPS. Port 7878 unreachable: check that the firewall temporarily allows the port for testing (ufw allow 7878) or test from the VPS itself with curl http://localhost:7878. Model connection error: verify that the API key environment variable is properly injected (docker compose exec openui env | grep API). If using local Ollama, check that it is running and accessible (curl http://localhost:11434/api/tags). Docker build fails: make sure you build from the backend/ folder, not from the repository root. Empty preview after generation: OpenUI uses WebSocket for real-time rendering — verify that your nginx configuration passes the Upgrade: websocket and Connection: Upgrade headers. Insufficient memory with Ollama: if the container is killed (OOMKilled), reduce the model size (switch to a 3B or Q4-quantized 7B) or increase your VPS RAM.
For a fully sovereign chain, have OpenUI and Ollama coexist in the same docker-compose.yml on an internal Docker network: OpenUI calls Ollama via http://ollama:11434 without ever exposing the LLM to the Internet. On the generation-quality side, a code-oriented model (CodeLlama, Qwen2.5-Coder) produces far better Tailwind/React components than a generalist model of the same size — test several and keep the one whose rendering is most faithful to your prompts.