# Every record in its own country, one system for all

> The FoundationCX way to handle data spread across many countries simply, keeping personal data inside its home jurisdiction.
> Version: 1.0 · Date: 2026-11-14 · Author: FoundationCX Team · Contact: info@foundationcx.com

---
## Part 1: The idea in one minute

1. **The problem:** your company or partner serves clients in Egypt, Saudi Arabia, Europe and the US, and each country restricts people's data leaving it.
2. **What many miss:** the law cares **not only where the database sits**, but where any program that reads, processes or copies the data runs. Reading data from another country counts as moving it, even if nothing is saved.
3. **The solution:** each country gets a complete "home" (the program, the database and the backups, all inside it). On top sits **one interface**: the user signs in once and sees each country's data coming straight from its home.
4. **What reaches the centre:** numbers and totals only, never names or phone numbers.
5. **The result:** one system in the user's eyes, personal data that stays in its country, and the least possible licensing and contract work.

---

## Part 2: The plain explanation

### 2.1 Example: one partner, clients in four countries
Sara is an Egyptian partner who sells our systems. She has a client in Cairo, one in Riyadh, one in Berlin and one in Dubai. She wants one screen with her clients, deals and commissions.
* **Sara's own data** (name, phone, bank account) is Egyptian, so it lives in Egypt.
* **The Riyadh client's data** (company name, the people we deal with) is Saudi, so it lives in Saudi Arabia.
* The same goes for Berlin in Europe and Dubai in the UAE.

### 2.2 An analogy: a bank with branches in several countries
Each branch keeps its customers' files in its own country, and its staff work on them there. Head office sees only consolidated reports.
* **The branch** is the country's "home": program and data together.
* **The single card** is the single sign-on: one login, and the user reaches every branch they are allowed into.
* **Head office** is the centre, and it sees only totals.



### 2.3 Three common beliefs that are not accurate
| Belief | Reality |
| :--- | :--- |
| "It's enough for the database to be in the country" | The program reading it, the backups, the mail and the error logs are all data or processing. If they are abroad, the data has left |
| "We'll only read from abroad and store nothing" | Reading is a transfer: Egypt's law says "making available", Kenya's 2026 guidance says so explicitly, and European practice leans the same way |
| "The law requires the server to be in-country" | Mostly it does not. Laws put conditions on data **leaving**, and keeping it home is the simplest way to meet them |

### 2.4 Who sees what
| Party | Sees | From where |
| :--- | :--- | :--- |
| Sara, the partner | All her clients and deals on one screen | Each client straight from its country's home to her screen |
| The Riyadh client | Only its own data | The Saudi home |
| Programme management at the centre | Number of deals, their value, commissions | Totals sent by the homes, no personal data |
| Technical support | Nothing by default | Temporary access the client approves, logged |

---

## Part 3: For decision-makers

### 3.1 When do we open a home in a new country?
When a client or partner covers its cost. A home is not opened "just in case".
* **Until then:** the deal is recorded with company data only (name, sector, value, status), without contact persons unless they agree in writing.
* **Europe and the US:** neither requires a server in each country, so one home for Europe and one for the US are enough, unless a client's contract asks otherwise.

### 3.2 Ten questions for any system you buy or build
1. What is each client's country, and is it in the contract?
2. Where are the database and files?
3. **Where does the program that reads and processes the data run?**
4. Where are the backups and the disaster-recovery copy?
5. Where are the encryption keys?
6. Where does support log in from, and on what legal basis?
7. Where do mail and SMS pass?
8. Where are the error logs and monitoring tools?
9. What reaches the centre? Only totals?
10. Is there a register proving all of this to an auditor or regulator?

---

## Part 4: What the laws say

| Market | Must data stay in-country? | When may it leave? | Breach notice | Top penalty |
| :--- | :--- | :--- | :--- | :--- |
| **Egypt** (Law 151/2020; Regulations 816/2025; grace period ended 31/10/2026) | No general rule; classified government data is hosted in Egypt | A PDPC licence per destination, protection not lower than Egypt's, and the data subject's consent. **Storing abroad is a transfer** | 72 h (immediately if national security is involved) | ≥3 months' prison and/or EGP 0.5–5M |
| **Saudi Arabia** (PDPL; Transfer Regulation updated 2024) | No general rule; government bodies fall under the NCA Cloud Cybersecurity Controls (CCC-2:2024) | Adequacy list or SDAIA standard clauses, with a risk assessment in defined cases | 72 h | SAR 5M, doubled on repeat |
| **UAE** (Decree-Law 45/2021) | No general rule; health data may not be stored abroad without an official exemption (Federal Law 2/2019) | Adequate country, binding contract or express consent | Set by the regulations |Executive Regulations not issued as of mid-2026, per international law firms |
| **EU** (GDPR) | No | Adequacy, or standard clauses with an impact assessment. The EU–US framework was upheld by the General Court on 3/9/2025 | 72 h | €20M or 4% of turnover |
| **Bahrain, Morocco, Oman** | No | Strict: adequacy list or authorisation; in Oman, explicit consent before any transfer | Varies | Varies |
| **Qatar** | No | Free flow by default | Yes | Fines |
| **Kuwait** (CITRA licensees) | No | After notifying the user | **24 h** | Per licence |
| **Kenya** | **Yes** for strategic data | With safeguards; **remote access is a transfer** | 72 h | Fines |
| **India** | No, except some sectors such as payments | Allowed except to barred countries, from 13/5/2027 | Yes | Up to INR 250 crore |
| **US** | No | Free, but transfers to "countries of concern" are barred | State laws | Varies by state |

Each row's source and reading date are listed under Sources at the end of the paper.




---

## Part 5: Technical details

### 5.1 The governing principle
> **Data and the program that processes it live together inside the country. The code can be one; the running is local.**

### 5.2 Four ways we assessed
| Way | Description | Verdict |
| :--- | :--- | :--- |
| 1. One program connected to many databases | One server (say, in Egypt) reads each country's database | ✘ Reading from abroad is a transfer. In ERPNext a request is bound to one database, so the framework would need rebuilding |
| 2. A middle layer that gathers at read time and stores nothing | Federated queries (Trino, MariaDB FederatedX/CONNECT) | ✘ Every page view is a transfer, logs and caches keep copies, and it bypasses the system's permissions |
| 3. **One interface, many homes** | A complete home per country with the same code; single sign-on; the browser calls each home directly and shows everything on one screen | ✔ **Recommended** for full systems |
| 4. A data vault per country | The central system stores tokens instead of names and phones; the real values sit in a vault in each country and the browser fetches them directly | ✔ Fits systems with little personal data (like a partner portal); not a full ERP |



### 5.3 The overall shape

```
            Browser (one screen) ── single sign-on from the user's home
              │            │            │            │
              ▼            ▼            ▼            ▼
         Egypt home    Saudi home    Europe home    US home
         program +     program +     program +      program +
         database +    database +    database +     database +
         backups +     backups +     backups +      backups +
         mail +        mail +        mail +         mail +
         keys          keys          keys           keys
              │            │            │            │
              └──── totals only (counts, amounts) ───┘
                              ▼
          Centre: client directory and countries, releases, reports
                         (no personal data)
```

### 5.4 Where each kind of data lives
| Data | Location |
| :--- | :--- |
| The user's personal data (name, phone, bank account) | Their country |
| The client and its contact persons | The client's country |
| The user's presence in other countries' homes | **A pseudonymous ID only** |
| A deal's status, value and commission | In the client's home; reaches the centre as totals |
| The central directory | Client ID, country, URL, plan and status only |



### 5.5 Operating rules
1. **Sign-in:** single, from the user's home, over OAuth2; each home verifies the token.
2. **Addresses:** each home has a country subdomain; there is no global login page that looks people up by e-mail.
3. **Support:** no standing access. Access is temporary and time-boxed, approved by the client, logged inside the home, and backed by the contract.
4. **Backups and recovery:** inside the same country, through a second provider if needed.
5. **Encryption keys:** inside the country.
6. **Sub-processors** (mail, SMS, monitoring): in-country or self-hosted. CDNs are used for DNS only.
7. **Totals:** have a minimum threshold so small counts cannot identify people.
8. **Releases:** one for all homes; tried on one site first, then rolled through the sites one by one without stopping at the first error.
9. **Residency register:** per home, recording the data, its location, sub-processors and who accessed it.

### 5.6 Applying it to ERPNext/Frappe
* **Available out of the box:** a separate site per client with its own database and backups; independent server groups per country; Frappe can act as an OAuth2 sign-in provider; a REST API and per-site CORS.
* **To avoid:** different clients in one site separated only by the "Company" field. In v16 that separation leaks through reports and notifications.

---

## Part 6: What large companies do
* **Microsoft** completed the EU Data Boundary on 26/2/2025 in three phases; **the last covered support data and logs**, the hardest part.
* **Salesforce** runs the same platform in about twenty countries, the UAE among them. It **states that some data may leave** and sells an add-on for more control.
* **AWS** runs a separate European cloud operated by EU residents, so residency covers the people, not only the machines.
* **Atlassian and Slack** let the customer choose a region and publish what that covers.
* **Google in Dammam** has encryption keys run by a Saudi partner; the customer can refuse access to them.

Links for these examples are under Sources at the end of the paper.

---

## Part 7: An invitation to the community
We propose this method as an **open reference**:
* a law comparison table, updated regularly with its sources;
* a free checklist for any company;
* a documented reference design on ERPNext for anyone who wants to apply it.

Corrections from lawyers and engineers are welcome at info@foundationcx.com.