kossakovsky/selfhost-ai
A Docker Compose stack for self-hosted AI chat, workflows, and document retrieval
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Selfhost AI is a Docker Compose distribution, not a new chat application or inference engine. The interactive scripts/install.sh entry point selects services, generates secrets in .env, and starts the stack. Caddy, PostgreSQL, and Redis-compatible Valkey are always installed. Caddy terminates HTTPS and routes web traffic by subdomain, while tools such as Python Runner and Open Terminal run without a public URL. The Compose manifest declares named volumes for state such as n8n workflows, Ollama storage, and Qdrant data.
Open WebUI is the chat front end; Ollama runs local inference, and external model APIs are another option. n8n runs workflows in queue mode with a configurable worker count and one task runner per worker. Integrations can be added at several levels: the n8n MCP service exposes node documentation and workflow tools to compatible IDEs, Python Runner loads code and requirements from python-runner/, and Compose overrides or Caddy add-ons let operators extend the deployment without editing files that updates reset.
Key Capabilities & Differentiators
Ollama runs model families including Llama, Qwen, Mistral, and Gemma on CPU or on NVIDIA and AMD GPUs, with multi-GPU support. Open WebUI brings local inference, API models, and n8n agents into one chat interface. n8n supplies more than 400 integrations and an optional import of roughly 300 community workflows; Dify and Letta offer different approaches to agent orchestration and persistent memory. ComfyUI and InvokeAI provide separate image-generation interfaces.
For document workflows, Docling converts PDF, Office, HTML, and image inputs into Markdown or JSON with OCR support, and PaddleOCR offers a separate CPU-based OCR API. Qdrant and Weaviate provide vector and hybrid search options, LightRAG offers graph-based retrieval, and RAGFlow focuses on document understanding and citations. These are components to assemble, not a single preconfigured retrieval pipeline. Prometheus and Grafana cover system and n8n workflow monitoring, while optional Langfuse adds LLM tracing and evaluations.
Trade-offs & Limitations
Compared with ChatGPT, this stack puts the chat interface and local inference under the operator's control; it does not bundle a hosted model service. Compared with Zapier AI, n8n Cloud, or Dify Cloud, the advantage is running automation, model serving, and retrieval together. The cost is owning resource contention, upgrades, backups, and access control. On a modest server, start with chat and inference or with n8n, then add document processing and indexing once their resource requirements are clear. Use Keelflow rather than starting a new Flowise deployment if you want the continuation of the archived upstream project.
Caddy-managed TLS does not govern ports published directly by Docker. Review the Supabase port exceptions and inspect bindings with make doctor: published ports can bypass ufw. Review the trust boundary before enabling OpenClaw with full server access or selecting the privileged fallback for the n8n Assistant sandbox. External APIs still receive whatever inputs a workflow sends them. Apache-2.0 covers the installer, not the separate terms of bundled services or models.
Hardware & Deployment Guide
The supported quick-start path is a public-IP VPS running 64-bit Ubuntu 24.04 LTS, with a domain and wildcard A record configured before installation. Review the privileged installer before running it: it updates the host, configures the firewall and brute-force protection, installs Docker, and generates secrets for the selected services. The n8n, monitoring, Databasus, and Portainer profile lists 4 GB RAM, 2 CPU cores, and 40 GB disk; the full stack lists at least 20 GB RAM, 4 cores, and 60 GB disk. Size inference, OCR, and indexing separately for the chosen models and concurrency. Local inference avoids a hosted model API, but the standard install with image pulls and Let's Encrypt is not an air-gapped deployment.
Use make status, make logs, and make doctor to check service health. Preview updates with make update-preview, back up persistent data and .env, and keep local changes in docker-compose.override.yml or caddy-addon/site-*.conf because make update resets tracked files. Recent releases cover practical operating issues: v1.18.0 added checks for broadly published ports, v1.18.1 fixed a leftover-container check that misread Docker's lowercase missing-object error, and v1.18.2 addressed cAdvisor memory pressure and swapping on smaller hosts with many local images.
Teams or individual operators with an Ubuntu VPS who want local-model chat, n8n automation, and a selectable retrieval stack on one server, and can own backups, upgrades, and access control.
You only need a managed chat or automation service, require a supported localhost or home-server setup, or want the full stack to fit on a 16 GB host without making service and model trade-offs.
Quick Start & Installation
git clone https://github.com/kossakovsky/selfhost-ai && cd selfhost-ai && sudo bash ./scripts/install.sh
Comparison vs. Top Chat UI & AI Apps Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| selfhost-ai ★ | 967 | +2 | Shell | Apache-2.0 | A Docker Compose stack for self-hosted AI chat, workflows, and document retrieva |
| cherry-studio | 54.1k | +204 | TypeScript | AGPL-3.0 | Electron AI workspace for comparing cloud and local models, running agents, and |
| ODS | 8k | +88 | Python | Apache-2.0 | A Docker Compose stack for private AI chat and inference on your own hardware |
| LocalAI | 50.7k | +102 | Go | MIT | A Go-based, self-hosted chat workspace and API server for local models |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/kossakovsky/selfhost-ai.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about selfhost-ai
How do chat, inference, and automation connect?
What can a 16 GB server run, and is a GPU required?
Does Apache-2.0 cover commercial use of the whole stack?
When should I choose this over standalone Open WebUI or a managed platform?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy