Skip to content

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 / Redis

The 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)

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:seo

Then build the Go binary (embeds web/dist):

bash
cd ..
go build -o cobabaai .

Environment variables

VariablePurpose
SQL_DSNDatabase connection
REDIS_CONN_STRINGCache and rate limiting
SESSION_SECRETSession signing
PORTListen 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:

  1. Verify the site in Google Search Console
  2. Submit https://your-domain.com/sitemap.xml
  3. Request indexing for / and /docs/

Public docs are served at /docs/ (English, CobabaAi-branded).

Security

  • HTTPS only in production
  • robots.txt blocks /console and auth pages from crawlers
  • Rotate secrets and restrict admin access
  • Use only upstream API keys your organization is authorized to use

CobabaAi — AI model gateway