Why we built our own team AI chat as a 28 MB Go binary
We wanted our team to use AI models without pasting company data into a hosted service. Ollama made running the models easy. The part around them was harder: a shared chat with sign-in, permissions, document search, tool
We wanted our team to use AI models without pasting company data into a hosted service. Ollama made running the models easy. The part around them was harder: a shared chat with sign-in, permissions, document search, tools and an audit trail.
Most self-hosted chat UIs we tried needed several moving parts: an app server, Redis, a vector database, a task queue, sometimes more. Each one is another thing to patch, back up and explain to the next admin. So we built Kera, ran it for our own team since November, and have now open-sourced it under Apache-2.0.
Repo: https://github.com/cdmx-in/kera
The numbers
- Container image: ~28 MB (distroless, static binary,
CGO_ENABLED=0) - Idle memory: ~20 MB
- Required services: one, Postgres 18 with pgvector
The web app is React and Vite, built into web/dist and embedded in the binary with embed. You run one binary and one database.
How Postgres replaces the usual stack
| Usually a separate service | In Kera |
|---|---|
| Vector database | pgvector |
| Search engine | Postgres full-text search, combined with vectors for hybrid search |
| Job queue / locks | Postgres advisory locks (for example, so a scheduled sync and the admin button never overlap) |
| Session store | Signed tokens, no external store |
It is less flexible than a dedicated vector database, but it's far simpler to run. A team of a few hundred people doesn't need more.
Boring Go on purpose
- HTTP is the standard library's
net/httpwith Go 1.22 route patterns, with no framework. - The database is pgx with hand-written SQL and goose migrations, with no ORM.
- Sessions and IDs use small in-repo code instead of JWT or UUID libraries.
- Each feature is a package under
internal/that registers itself frominit(). Adding a feature means one package and one blank import. - Plugins are plain HTTP services (OpenAPI or MCP), not code loaded into the server. A broken plugin can't crash the core.
Tests run with -race against a real Postgres database for each test. CI also runs govulncheck and a gitleaks scan of the full history.
What it does
- Works with Ollama first and any OpenAI-compatible endpoint second, including the Responses API.
- Google and OIDC sign-in, groups, per-resource sharing and API keys.
- Knowledge search over your documents, with optional reranking and OCR for scanned PDFs.
- A code interpreter for Python, Node, Go, Java, R and more, returning files and images.
- Cowork, where the model drives a sandboxed Linux desktop that you can watch and take over.
- Scheduled Google Workspace directory sync: users in, departments as groups, leavers disabled.
Guardrails on every model call
This was a requirement from day one, because our team handles payments data. Every call to a model goes through one guard that can:
- redact or block personal data: emails, phone numbers, cards (Luhn check), Indian Aadhaar numbers (Verhoeff check digit), IBANs (mod 97) and SSNs;
- check for prompt-injection phrases and your own blocklist;
- optionally run a moderation model;
- write an audit event that records the rule and the count, never the matched text.
Each mode (off, log, redact, block) can be set per model. Local Ollama models can be exempted if you trust them more than hosted ones.
Try it
git clone https://github.com/cdmx-in/kera && cd kera/deploy
cp .env.example .env # set KERA_SECRET_KEY and KERA_DB_PASSWORD
docker compose up -d
docker compose exec kera kera user login-link [email protected]
On an empty install, login-link creates the first admin, so you can get in before setting up any sign-in provider. Then add Google or OIDC sign-in in the admin console.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.