# Self-hosting overview

> How a self-hosted Teemli is put together - one app server with docker-compose, a second server for agent computers, and an optional one for calls.

Source: https://docs.teemli.com/self-hosting/overview/

:::note[Available when the source is public]
Teemli's source code isn't public yet. When it is, it will be released under the Apache-2.0 licence, and you'll be able to run Teemli on your own servers. This page describes the architecture Teemli Cloud runs on today, so you can plan. Installation steps will be added with the release. Need a self-hosted deployment sooner? Write to hello@teemli.com.
:::

A self-hosted Teemli is the same software as Teemli Cloud: one architecture for everyone, with no special "enterprise edition". It runs as a handful of containers on two servers.

## The shape

```
 Apps: web · desktop · extension · mobile          Slack · Teams
          │                                           │
          ▼                                           ▼
 ┌─ App server (docker-compose) ─────────────────────────────────┐
 │ Caddy (HTTPS, serves the web app)                             │
 │ api ──► Kafka ──► worker                                      │
 │ worker ──► Redis (live updates) ──► api ──► apps              │
 │ Postgres ×3: Teemli · Keycloak · OpenBao                      │
 │ Keycloak (sign-in) · OpenBao (secrets) · monitoring           │
 └───────────────────────────────────────────────────────────────┘
          │ private network only
          ▼
 ┌─ Computers server ────────────────────────────────────────────┐
 │ E2B (self-hosted) → one Firecracker microVM per person        │
 │ and per AI employee                                           │
 └───────────────────────────────────────────────────────────────┘
 ┌─ Calls server (optional) ─────────────────────────────────────┐
 │ LiveKit, for huddles and meetings                             │
 └───────────────────────────────────────────────────────────────┘
```

## Components

| Component | What it does |
|---|---|
| **api** | Everything facing outward: the REST API and WebSockets for the apps, Slack and Teams events, laptop connections, and inbound email for AI employees and routines. It answers quickly and hands work on. |
| **worker** | The agent work: turns, model and tool calls, routines, meeting notes, notifications. `api` and `worker` are two roles of one Rust program, so both scale by adding servers. |
| **Postgres** ×3 | One database for Teemli (with pgvector for memory search), one for Keycloak, one for OpenBao. Every Teemli table is protected by row-level security. |
| **Kafka** | Delivers work from the api to workers, in order per conversation. Postgres stays the record of everything; Kafka only delivers. |
| **Redis** | Live updates from workers to the apps. |
| **Keycloak** | Sign-in: email and password, Google and Microsoft sign-in, company single sign-on (OIDC and SAML) and SCIM. |
| **OpenBao** | The vault for model keys, app tokens, saved logins and other secrets, with a separate encryption key per organisation. |
| **Caddy** | HTTPS certificates and the front door; also serves the web app. |
| **Monitoring** (optional) | Grafana with OpenTelemetry metrics, logs and traces. No customer content is ever sent to it. |
| **E2B** | Runs agent computers, each in its own Firecracker microVM, on a second server. |
| **LiveKit** (optional) | Calls and huddles. Media needs public UDP ports, so it gets its own server. |

## Models

A self-hosted Teemli can use:

- an **OpenRouter** key for the organisation, as on Teemli Cloud;
- **any OpenAI-compatible endpoint**, such as vLLM or Ollama on your own GPUs, or another provider. This option is hidden on Teemli Cloud and available when you self-host;
- people's own ChatGPT and Grok plans and Anthropic, Gemini or OpenRouter keys, as on Teemli Cloud. Each of these has its own on/off setting for the whole server.

## Outside services

None of these is required for Teemli's core:

| Service | For |
|---|---|
| Composio | The app catalogue. Without it, people use Zapier and MCP servers. |
| Zapier (MCP) | The long tail of apps, through each person's own Zapier account. |
| An email provider (Resend, or any SMTP relay) | Sign-up and notification emails, and AI employees' outgoing mail. |
| Slack and Microsoft apps | AI employees in Slack and Teams. |
| Soniox | Optional live meeting transcripts. |
| S3-compatible object storage | Uploaded files (or a local volume), and off-site backups. |

## How a request flows

1. You send a message in the app. The **api** saves it in Postgres and publishes it to Kafka.
2. A **worker** picks it up, calls the model, and runs tools through Teemli's permission gateway: asking you first where the rules say so.
3. Tools that need a computer go to the person's microVM on the computers server, waking it if it's asleep.
4. Progress streams back through Redis to the api and over the WebSocket to your screen.

## Security in a self-hosted setup

- Only the app server faces the internet (HTTPS, plus port 25 for inbound mail). Postgres, Kafka and Redis stay on the private network, with passwords.
- The computers server accepts traffic only from the app server. Computers can't reach your internal network.
- OpenBao starts **sealed** after every restart and must be unsealed with its key shares before Teemli can read secrets. Keep those shares offline, in more than one place.
- Encrypt the data disk at rest, and encrypt off-site backups.

See [Requirements](/self-hosting/requirements/) for sizes, ports and DNS, and [Security](/security/) for the security model.
