# Self-host Oatmilk

> Run your own Oatmilk on your computer, a server or a cloud, with your data and AI models staying with you.

Source: https://app.getoatmilk.com/docs/self-hosting

Oatmilk runs on your own hardware with everything it needs: the web app and its AI agents, PostgreSQL, file storage, Redis, scheduled jobs, sign-in, the REST API, MCP for AI apps and the [command line](https://app.getoatmilk.com/docs/terminal.md). Set up for it, nothing leaves the machine: accounts, books, statements, receipts and documents stay in your database and on your disk, and AI models can run on your own hardware too.

One command asks a few questions, writes the settings, builds Oatmilk and starts it:

```bash
bun run self-host setup
```

## Choose a guide

| You want | Follow | Time |
| --- | --- | --- |
| Oatmilk on your own computer, just for you | [Run it on your computer](https://app.getoatmilk.com/docs/self-hosting/your-computer.md) | 20 minutes |
| Every AI model on your own hardware | [Use local AI models](https://app.getoatmilk.com/docs/self-hosting/local-models.md) | 15 minutes |
| Nothing at all leaving the machine | [Go completely off-grid](https://app.getoatmilk.com/docs/self-hosting/off-grid.md) | 30 minutes |
| A server for your team at your own domain | [Run it on a server](https://app.getoatmilk.com/docs/self-hosting/server.md) | 30 minutes |
| Amazon Web Services with RDS, ElastiCache and S3 | [Deploy on AWS](https://app.getoatmilk.com/docs/self-hosting/aws.md) | 1 hour |
| Google Cloud with Cloud SQL, Memorystore and Cloud Storage | [Deploy on Google Cloud](https://app.getoatmilk.com/docs/self-hosting/google-cloud.md) | 1 hour |
| Microsoft Azure with its managed PostgreSQL and Redis | [Deploy on Azure](https://app.getoatmilk.com/docs/self-hosting/azure.md) | 1 hour |
| Your own PostgreSQL, Redis or S3-compatible storage (Neon, Upstash, Cloudflare R2, MinIO…) | [Bring your own services](https://app.getoatmilk.com/docs/self-hosting/services.md) | 20 minutes |
| A machine without Docker | [Run it without Docker](https://app.getoatmilk.com/docs/self-hosting/without-docker.md) | 1 hour |
| To change Oatmilk's code | [Develop Oatmilk locally](https://app.getoatmilk.com/docs/self-hosting/develop.md) | 15 minutes |

Then [manage sign-in and accounts](https://app.getoatmilk.com/docs/self-hosting/accounts.md), and [update, back up and troubleshoot](https://app.getoatmilk.com/docs/self-hosting/operate.md) your installation.

## What runs where

Everything runs in Docker Compose, from the `self-host/` folder of Oatmilk's source.

| Piece | What it is | Stays on your machine? |
| --- | --- | --- |
| Web app and agents | One container, `app`, with the web app, every AI agent and the five-minute jobs | Yes |
| Database | PostgreSQL 17, bundled, or your own PostgreSQL 15 or newer | Yes |
| Database API | PostgREST, the same piece Supabase runs. Never published. | Yes |
| File storage | Supabase Storage, on a Docker volume or in an S3-compatible bucket | Yes, on the disk or MinIO |
| Redis | Caches, rate limits and locks. Bundled, or your own. | Yes |
| Sign-in | Accounts in your database with Better Auth, or Clerk | Yes, with Better Auth |
| HTTPS | Caddy: its own certificate for `*.localhost`, Let's Encrypt for a real domain | Yes, on `*.localhost` |
| AI models | Ollama, LM Studio or any OpenAI-compatible server, or Vercel AI Gateway | Yes, with local models |
| Email | Off, or Resend for invoices, invitations and reminders | Off |
| Bank, payment and data connections | Wise, Stripe, Notion, Google Drive, Microsoft: each optional, set up per company | Only when you connect them |

## What you need

- **Oatmilk's source code**, cloned with Git.
- **Docker** Desktop, or Docker Engine with Compose 2.20 or newer. Check with `docker compose version`.
- **[Bun](https://bun.sh)** 1.3 or newer, which runs the setup commands.
- **About 4 GB of memory and 15 GB of disk** for Oatmilk itself. Local AI models need more: see [Use local AI models](https://app.getoatmilk.com/docs/self-hosting/local-models.md#what-your-computer-needs).
- **The internet, once,** to build the image. After that, Oatmilk can run without it.

## Use your Oatmilk like the hosted one

A self-hosted Oatmilk has the same app, [REST API](https://app.getoatmilk.com/docs/quickstart.md), [webhooks](https://app.getoatmilk.com/docs/webhooks.md) and [MCP server](https://app.getoatmilk.com/docs/mcp.md). These docs are part of it too: open `/docs` on your own address, and every example uses that address.

- **API keys** come from **Developers › API keys**: `oat_test_…` on an install for one computer, `oat_live_…` on a server.
- **AI apps** connect to `https://<your address>/api/mcp` and sign in through your Oatmilk's own accounts.
- **The CLI** signs in with `oatmilk login --host https://<your address>`. See [Sign in and choose a company](https://app.getoatmilk.com/docs/terminal/sign-in.md#your-own-oatmilk).

> [!NOTE]
> Self-hosted installs run the same code as the hosted Oatmilk. The settings that only matter to a self-hosted install are switched on by `OATMILK_DEPLOYMENT=self-hosted`, which the Compose stack sets for you.
