Blog

/

Self-hosting your email data in Cloudflare D1 (no vendor lock-in)

“Self-hosted” is one of those words that gets stretched to mean almost anything. In the context of email, the question is specific: where do the messages live, who can read them, and what does it take to walk away. This post is about putting the authoritative copy of your email in a database you control.

What “self-hosted” usually means

In most email platforms, “self-hosted” is a marketing claim. The product is open source, the binary runs on your machine, and yet the database schema, the migration tooling, and the upgrade path are all owned by the vendor. If you want to leave, you discover what was actually yours on day one and what was rented back to you.

For email data specifically, the only thing that really matters is the database. Anyone can ship a UI. The hard part — the part that determines whether you can actually leave — is where the rows live.

D1 as the authoritative store

Cloudflare D1 is a serverless SQLite database that lives inside your Cloudflare account. The data is yours in the literal sense: the rows are in a database that only your Workers and your D1 console can read.

For email data, that maps to the entire inbox and outbox: every message, every routing rule, every API key, every webhook subscription. When you connect a Cloudflare account to Flowmails, the platform provisions a D1 database inside that account and uses it as the system of record. Flowmails’ own infrastructure brokers the OAuth-style connection and renders the dashboard; it does not see the rows.

Practically, that means: open the Cloudflare dashboard, go to Workers → D1, and you can query your email data with ordinary SQL. Export is a wrangler d1 export command. There is no migration tax.

What this changes in practice

Compliance reviews get shorter. When a security reviewer asks where customer email data is stored, the answer is a database ID inside the customer’s own Cloudflare account. There is no separate data-processing agreement to negotiate, no shared multi-tenant table to scope.

Exit cost is approximately zero. If you stop using Flowmails, the Worker stops running and the rows stay. You can read them with a one-line SQL query, hand them to whichever vendor you move to next, or keep the Worker running yourself with no Flowmails code in the loop.

AI features become a privacy story, not a liability. When the AI draft-and-reply feature launches in Q3 2026, the messages used as context and the resulting drafts all live in the same D1. Inference can run on Workers AI by default; the data does not need to leave your account.

The trade-offs nobody will hand to you

D1 is serverless SQLite, not Postgres. You do not get row-level triggers, full-text search extensions, or arbitrary stored procedures. For most email workloads, that is fine — the shape of the data is simple and the access pattern is read-heavy with a few writes.

You also do not get a built-in admin UI from Cloudflare. The console is great for inspecting a row, not for triaging a thousand. That is the gap Flowmails fills: a dashboard for the human workflow, a REST API for the service workflow, and the underlying database remaining yours.

Keep your email data in a database you own.

Start free