# Host in Europe: data at rest in the EU, as an opt-in

The repository's architectural decision, rationale and consequences.

# Host in Europe: data at rest in the EU, as an opt-in

**Status:** accepted · **Date:** 2026-11-28

**Enforcement:** `scripts/check-production-config.mjs` and `packages/project-setup-cli/src/hyperdrive.mjs check`, both steps of `.github/workflows/deploy-prod.yml`; `pnpm doctor` for the tracked Worker config.

Four projects created from the template each wrote this decision on their own: the database in Frankfurt, the bucket in R2's EU jurisdiction, a placement hint toward the database, and the same caveat about where a Worker runs. One of them also wrote a deploy check. The template had none of it, so every project re-derived the facts and only one verified them.

## Decision [#decision]

1. **EU hosting is an opt-in with one switch.** `"DATA_RESIDENCY": "eu"` in the `vars` of `apps/web/wrangler.jsonc` records it. `pnpm run setup --data-residency eu` writes it (the wizard asks once; `--data-residency none` removes it). The template itself ships without it.
2. **With the opt-in, data at rest lives in the European Union:**
   - the production database is in an EU region. On Neon that is `aws-eu-central-1` (Frankfurt), the only Neon region inside the Union;
   - files are in an R2 bucket created with the `eu` jurisdiction and reached through `https://<account>.eu.r2.cloudflarestorage.com`; a bucket bound in `r2_buckets` sets `"jurisdiction": "eu"`;
   - the Worker's `placement.region` is an EU cloud region next to the database (`aws:eu-central-1` by default).
3. **Every production deploy verifies it and refuses to publish otherwise.** `check-production-config.mjs` reads the placement hint, the bound buckets, `STORAGE_ENDPOINT` and `DATABASE_URL`; `hyperdrive.mjs check` reads the origin host of the Hyperdrive config the Worker uses. Both print names and regions, never a value. A database that is not on Neon cannot be located from its URL: the check says so in a warning and the project confirms the region with its provider.
4. **The claim this supports is "data is stored in the EU".** It does not support "data is processed only in the EU"; the table below says why.

"EU" means the Union. London (`aws:eu-west-2`, `gcp:europe-west2`) and Zurich (`aws:eu-central-2`, `gcp:europe-west6`) carry a European prefix and are refused.

## What cannot be pinned [#what-cannot-be-pinned]

Read from the providers' pages on 2026-11-28.

| Part                      | What the opt-in gives                                                                             | What stays open                                                                                                                                                                                                                         |
| ------------------------- | ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Postgres rows             | In the EU region; Neon cannot move a project to another region after creation                     | Backups and dumps follow where you put them: a backup bucket needs the EU jurisdiction too, and the check does not see it                                                                                                               |
| R2 objects                | Stored in the EU: a jurisdiction is a guarantee, unlike a location hint, and is fixed at creation | Nothing                                                                                                                                                                                                                                 |
| Worker execution          | A latency hint toward the EU for `fetch` handlers                                                 | Placement is a performance feature, not a boundary. A request is received at the data center closest to the visitor and TLS ends there. Keeping execution inside a region needs the Data Localization Suite, an Enterprise-only add-on. |
| Cron tick                 | Nothing                                                                                           | Cloudflare does not document where a `scheduled` handler runs                                                                                                                                                                           |
| Hyperdrive                | Its pool is placed "in one or more regions closest to your origin database"                       | The location is Cloudflare's choice and is not configurable                                                                                                                                                                             |
| Workers Logs and traces   | Nothing                                                                                           | Without the Customer Metadata Boundary (Enterprise), logs "may be stored in Cloudflare's core data centers globally". Keep personal data out of logs.                                                                                   |
| Rate limiter, email, push | Nothing                                                                                           | The Web Vitals limiter counts per client address at the edge; email and push leave through their providers                                                                                                                              |
| Other processors          | Nothing                                                                                           | AI providers, payment providers, the error tracker and analytics each have their own location and contract                                                                                                                              |

## Consequences [#consequences]

- Public and legal copy says "data is stored in the EU". "Hosted in Germany" or "processed only in the EU" needs the Data Localization Suite or the Node target on a server in the EU ([production guide](/docs/production#run-on-a-node-server-instead)), and legal advice; neither is decided here.
- The two things the opt-in cannot do for you cannot be changed later: create the Neon project in the EU region and the R2 bucket with the EU jurisdiction before the first real user. Setup prints both steps.
- Pull request previews copy `placement`, and their database is a branch of the production Neon project, so previews stay in the same region. They do not copy `DATA_RESIDENCY`; the check runs on the production deploy only.
- A project that opted in and later moves its database outside the EU fails its next deploy, which is the point.
- The opt-in lists what is verified, not every processor. A project still writes its own list of subprocessors.

## Alternatives [#alternatives]

- EU hosting as the template's default. Projects for Brazil place their database in São Paulo; a default that half the projects must undo is not a default.
- Documentation only. Four projects wrote the document and one wrote the check; a region is one typo away from wrong, and a bucket's jurisdiction cannot be repaired after the fact.
- Promise processing in the EU. It is not ours to promise on this plan.
