Self-hosted CobabaAi
Run CobabaAi on your own infrastructure when you need a private domain, custom branding, or full data control.
Reference architecture
text
Internet → Nginx (TLS) → CobabaAi gateway :3000 → PostgreSQL / RedisThe admin UI is embedded in the gateway binary (web/dist via go:embed).
Prerequisites
- Linux server (Ubuntu/Debian recommended)
- Docker for PostgreSQL and Redis (or managed databases)
- Go 1.22+ and Bun for building from source
- A domain with TLS (e.g.
https://api.yourcompany.com)
Build with SEO (recommended)
From the project web/ directory, create web/.env.production.local:
env
VITE_PUBLIC_SITE_URL=https://your-domain.com
VITE_APP_HTML_TITLE=CobabaAi
VITE_SEO_GITHUB_REPO=https://github.com/your-org/cobabaai
VITE_GOOGLE_SITE_VERIFICATION=<Search Console token>Build documentation and frontend:
bash
cd web
bun install
bun run build:seoThen build the Go binary (embeds web/dist):
bash
cd ..
go build -o cobabaai .Environment variables
| Variable | Purpose |
|---|---|
SQL_DSN | Database connection |
REDIS_CONN_STRING | Cache and rate limiting |
SESSION_SECRET | Session signing |
PORT | Listen port (default 3000) |
Nginx example
nginx
server {
listen 443 ssl http2;
server_name your-domain.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}Keep one origin for UI and API: leave VITE_REACT_APP_SERVER_URL empty so clients call /v1 on the same host.
Google indexing
After deploy:
- Verify the site in Google Search Console
- Submit
https://your-domain.com/sitemap.xml - Request indexing for
/and/docs/
Public docs are served at /docs/ (English, CobabaAi-branded).
Security
- HTTPS only in production
robots.txtblocks/consoleand auth pages from crawlers- Rotate secrets and restrict admin access
- Use only upstream API keys your organization is authorized to use