Leer en español · Lire en français · Auf Deutsch lesen
Section 8.7 of 8.8 · Intermediate · 24 min read
Privacy by design and the GDPR
Video lesson
5 min · narrated, with captionsListen only (audio)
Read the transcript
Many privacy duties can only be met if the system was designed for them from the start. This lesson shows how data protection law shapes software architecture. It's general information about how the law affects design, not legal advice. Whether and how a rule applies depends on the facts. For a real situation, an organisation should ask qualified data protection lawyers and its data protection officer.
Imagine lending your diary to a friend. You expect them to read only the page you showed them. Not to photocopy it, and not to keep it for ever. And to give it back when you ask. Privacy by design builds those expectations into software: collect only what's needed, use it only for the reason given, keep it only as long as necessary, and be able to show people what's held and delete it.
Security asks whether data is protected from people who shouldn't have it. Privacy also asks whether the organisation itself should collect the data at all, what it may do with it, for how long, and what control the person keeps. So a system can be free of breaches and still invade privacy. For example, by keeping every courier's location trail for ever, or quietly reusing order histories to train a pricing model.
The EU's General Data Protection Regulation, the GDPR, and the UK GDPR share the same principles. Purpose limitation means data collected for one purpose isn't reused for an incompatible one. So tag data with its purposes, and check the tag before a new consumer reads it. Data minimisation: collect only what's necessary. If you only need to know a customer is over eighteen, store that, not their date of birth. Storage limitation: give every data set a retention period, and enforce it automatically, including in logs and backups. Accountability: the controller must be able to demonstrate compliance, so records and audit logs are evidence the architecture must produce. And Article 25 requires data protection by design and by default: by default, only the data necessary for each purpose is processed, kept and made accessible.
Here's a key distinction. A customer record, with a name and an address, is personal data. Pseudonymisation replaces direct identifiers with a keyed hash, so analytics can count orders per customer without seeing who they are. But whoever holds the key can re-identify people, so for them it's still personal data. Aggregating, and hiding counts below ten, can make data anonymous, but only if no one can reasonably re-identify anyone. That's hard. Removing names isn't enough when a postcode, a birth date and sex together identify most people.
People's rights are where privacy law most directly becomes system requirements. They can ask for a copy of their data, ask for it to be corrected, or ask for it to be erased. They can ask for its use to be restricted, take it elsewhere in a machine-readable format, or object to some processing. A controller must normally respond within one month. In a system of twenty services, several outside processors and a data warehouse, that's impossible without a maintained data map, showing every store that holds personal data.
Erasure is the hardest right to design for. When a customer taps delete account, the account service orchestrates the request. It publishes one erasure event, and every store that holds the customer's data must act on it. Each owner applies its own rule. Orders are anonymised, but invoices are kept for tax law. Payments drop card tokens. Notifications delete contact details. The support desk redacts tickets through its API. Event logs can't be edited, so the customer's key is destroyed. Warehouse rows are found by pseudonym. Caches are evicted, and backups are put beyond use until they expire. Each store then confirms to an erasure ledger, which is the evidence that the request was completed.
A few design details make this work. The request needs a fresh login, and the customer is told what will be deleted and what kept. Keeping data the law requires, with a recorded reason, is not a failure of erasure. Any store that hasn't confirmed within seven days raises an alert, well inside the one month limit. And if a backup is ever restored, the list of erased customers is applied again before the system reopens. The data map is critical: a store missing from it is a store that keeps the data.
The full section covers lawful bases, impact assessments and international transfers. Next, in Section eight point eight, we look at security in operation. See you there.
What you need to know
- Privacy asks whether data should be collected and used at all, and what control people keep; a system can be secure and still violate privacy.
- The GDPR (Regulation (EU) 2016/679) and the UK GDPR with the Data Protection Act 2018, amended by the Data (Use and Access) Act 2025, share the Article 5 principles: lawfulness, fairness and transparency, purpose limitation, minimisation, accuracy, storage limitation, integrity and confidentiality, and accountability.
- Article 25 requires data protection by design (appropriate measures such as pseudonymisation) and by default (only necessary data processed, kept and made accessible), drawing on Ann Cavoukian's seven principles.
- Rights of access, rectification, erasure, restriction, portability and objection need a data map, per-service export and erasure handlers, restriction flags and suppression lists, with responses normally within one month.
- A DPIA is required before likely high-risk processing (Article 35) and works best alongside the threat model over the same data-flow diagram.
- Pseudonymised data remains personal data for whoever can re-identify it; anonymisation must withstand all means reasonably likely to be used, and is hard to achieve.
- Erasure must reach caches, search indexes, analytics, event logs (often by crypto-shredding), processors and backups (put beyond use until they expire); this section is information about how the law affects architecture, not legal advice.
Privacy is a design property
Security and privacy overlap but are not the same. Security asks whether data is protected from people who should not have it. Privacy also asks whether the organisation itself should collect the data at all, what it may do with it, for how long, and what control the person it describes keeps. A system can be free of breaches and still invade privacy, for example by keeping every courier's location trail for ever or by quietly reusing order histories to train a pricing model.
The food-delivery platform is a good example of why privacy is architectural. It holds names, phone numbers and home addresses; order histories that can reveal religion or health through dietary choices; payment references; and a continuous stream of courier locations. These data flow from the apps through dozens of services, events, caches, logs, analytics stores and backups, and to processors such as the payment provider, the SMS gateway and the support-desk SaaS. Decisions about where personal data is stored, how it is keyed and how it can be found and removed are expensive to change later, which is exactly the test for architectural significance.
The law in brief: the GDPR and the UK GDPR
The General Data Protection Regulation, Regulation (EU) 2016/679, has applied since 25 May 2018. It protects personal data, which Article 4(1) defines as any information relating to an identified or identifiable natural person, directly or indirectly, for example by a name, an identification number, location data or an online identifier. The controller decides why and how data is processed and carries primary responsibility; a processor processes on the controller's behalf under a contract (Article 28), as the platform's SMS gateway does. The GDPR applies to organisations established in the EU and, under Article 3, to others that offer goods or services to, or monitor the behaviour of, people in the EU.
In the United Kingdom the GDPR was retained after Brexit as the UK GDPR, which operates alongside the Data Protection Act 2018. The Data (Use and Access) Act 2025 amended both; most of its data protection changes came into force on 5 February 2026, including changes to lawful bases, automated decision-making and international transfers, and a requirement for controllers to handle data protection complaints follows from 19 June 2026. The European Commission renewed its adequacy decisions for the UK in December 2025, so personal data can continue to flow from the EU to the UK without extra safeguards. For architects, the two regimes share the same principles, rights and design duties; the differences are matters of detail for lawyers.
Maximum fines for the most serious infringements are EUR 20 million or 4% of worldwide annual turnover under the GDPR (GBP 17.5 million or 4% under the UK GDPR), whichever is higher, though the more common consequences are orders to stop processing, reputational damage and the cost of re-engineering. In November 2025 the European Commission proposed amendments to the GDPR as part of a Digital Omnibus package; at the time of writing these are still going through the legislative process and change nothing yet.
The Article 5 principles and what they mean for systems
| Principle | In short | Architectural consequence |
|---|---|---|
| Lawfulness, fairness and transparency (5(1)(a)) | Process only with a lawful basis, in ways people would reasonably expect, and tell them what you do. | Record a lawful basis per purpose; generate privacy notices from the same data map the systems use; no hidden tracking. |
| Purpose limitation (5(1)(b)) | Collect for specified, explicit purposes and do not reuse data for incompatible ones. | Tag data with its purposes; check the tag before a new consumer (such as a machine-learning pipeline) is allowed to read it. |
| Data minimisation (5(1)(c)) | Adequate, relevant and limited to what is necessary. | Do not collect date of birth if you only need an over-18 flag; store the courier's location trail only while it is needed. |
| Accuracy (5(1)(d)) | Accurate and, where necessary, kept up to date. | One owner per fact; let people correct their data and propagate corrections to copies. |
| Storage limitation (5(1)(e)) | Kept in identifiable form no longer than necessary. | A retention period for every data set, enforced automatically by TTLs, partition drops and expiry jobs, including in logs and backups. |
| Integrity and confidentiality (5(1)(f)) | Appropriate security, including against unauthorised processing, loss and damage. | Everything in Sections 8.1 to 8.6: access control, encryption, key management, zero trust, supply-chain controls. |
| Accountability (5(2)) | The controller is responsible for compliance and must be able to demonstrate it. | Records of processing, DPIAs, consent records, erasure ledgers and audit logs are evidence the architecture must produce. |
Lawful bases, briefly
Article 6 permits processing only on one of six lawful bases: consent, performance of a contract with the person, a legal obligation, vital interests, a task in the public interest, or legitimate interests that are not overridden by the person's interests and rights. Special categories of data, such as health or religious belief, need an additional condition under Article 9. The basis is chosen per purpose, not per system, and it changes what the architecture must do. On the food-delivery platform, the delivery address is processed to perform the contract; invoices are kept to meet a legal obligation under tax law; fraud screening typically relies on legitimate interests; and marketing e-mails normally need consent, which electronic marketing rules also govern.
Consent has the strictest mechanics. Under Article 7 the controller must be able to demonstrate that consent was given, it must be specific to a purpose, and withdrawing it must be as easy as giving it. That means consent cannot be a single boolean column: the system needs an append-only record of what the person agreed to, when, through which channel and in response to which wording, and every consumer must honour a withdrawal promptly.
{
"event": "ConsentGiven",
"subjectRef": "cust_4411",
"purpose": "marketing_email",
"noticeVersion": "privacy-notice-2026-09",
"wording": "Send me offers from restaurants near me",
"channel": "ios-app 7.3.0",
"method": "unticked checkbox, user ticked",
"at": "2026-10-03T18:22:41Z"
}
{
"event": "ConsentWithdrawn",
"subjectRef": "cust_4411",
"purpose": "marketing_email",
"channel": "email unsubscribe link",
"at": "2026-10-19T07:05:12Z"
}Data protection by design and by default
Article 25 turns privacy by design into a legal duty. Article 25(1), data protection by design, requires the controller, both when deciding how to process and during processing, to implement appropriate technical and organisational measures, such as pseudonymisation, that put the principles into effect, taking into account the state of the art, the cost, the nature and purposes of processing and the risks. Article 25(2), by default, requires that only the data necessary for each specific purpose is processed by default, covering the amount collected, the extent of processing, the storage period and accessibility; in particular, data must not be made accessible to an unlimited number of people without the person's intervention. The European Data Protection Board's Guidelines 4/2019 on Article 25 give practical examples.
The law borrowed the idea from Ann Cavoukian, Information and Privacy Commissioner of Ontario, who developed privacy by design in the 1990s and published its seven foundational principles in 2009; the international conference of data protection commissioners endorsed them in 2010. They remain a useful design review checklist.
Cavoukian's seven foundational principles of privacy by design
| Principle | What it asks of a design |
|---|---|
| 1. Proactive not reactive; preventive not remedial | Anticipate privacy harms at design time instead of fixing them after an incident. |
| 2. Privacy as the default setting | The person has to do nothing to be protected; optional sharing is off until they turn it on. |
| 3. Privacy embedded into design | Privacy is part of the architecture and business processes, not a bolt-on. |
| 4. Full functionality: positive-sum, not zero-sum | Seek designs that achieve both privacy and the business goal instead of trading one away. |
| 5. End-to-end security: full lifecycle protection | Protect data from collection to secure destruction. |
| 6. Visibility and transparency | Practices are open and verifiable by users and independent reviewers. |
| 7. Respect for user privacy | Keep it user-centric: strong defaults, clear notice and easy-to-use choices. |
Rights that the architecture must support
Data subjects' rights are where privacy law most directly becomes system requirements. A controller must normally respond within one month of a request, extendable by up to two further months for complex or numerous requests (Article 12(3)), and must be able to find the person's data wherever it lives. In a system of twenty services, five SaaS processors and a data warehouse, that is impossible without a maintained data map: the record of processing activities that Article 30 already requires, kept close enough to the code to be accurate. Under the UK's 2025 amendments, a controller responding to an access request is required only to make reasonable and proportionate searches, which a good data map makes quick.
Data subjects' rights and what each requires of systems
| Right | What the person can ask | What systems need |
|---|---|---|
| Access (Art. 15) | Confirmation that data is processed, a copy, and information such as purposes, recipients, retention and source. | A data map of every store holding personal data; a per-service export API keyed by a stable customer ID; identity verification; a way to assemble and deliver the result within the deadline. |
| Rectification (Art. 16) | Correction of inaccurate data and completion of incomplete data. | One authoritative owner per field; corrections propagated to copies and caches by events; recipients told (Art. 19). |
| Erasure (Art. 17) | Deletion where, among other grounds, the data is no longer needed or consent is withdrawn, subject to exceptions such as legal obligations. | An erasure orchestrator, per-store erasure rules (delete, anonymise, retain with reason), crypto-shredding for immutable stores, and a ledger proving completion. |
| Restriction (Art. 18) | Data kept but not otherwise used, for example while accuracy is disputed. | A restriction flag that every consumer checks, so data is stored but excluded from processing such as marketing or model training. |
| Portability (Art. 20) | Data the person provided, processed by automated means on the basis of consent or contract, in a structured, commonly used, machine-readable format. | An export in JSON or CSV with documented fields; optionally direct transmission to another controller where technically feasible. |
| Objection (Art. 21) | Stopping processing based on legitimate interests or public task unless there are compelling grounds; absolute for direct marketing. | Per-purpose switches; a suppression list (keeping the minimum needed, such as a hashed e-mail address) so the person is not re-added by a later import. |
| Automated decisions (Art. 22) | Safeguards against decisions based solely on automated processing with legal or similarly significant effects. | For example, automated deactivation of a courier: a route to human review, an explanation and a way to contest it. |
Data protection impact assessments
Article 35 requires a data protection impact assessment (DPIA) before processing that is likely to result in a high risk to people's rights and freedoms, in particular systematic and extensive profiling with significant effects, large-scale processing of special-category or criminal-offence data, and systematic monitoring of a publicly accessible area on a large scale. Supervisory authorities publish lists of further cases; continuous tracking of couriers' locations and algorithmic management of their work are typical candidates. A DPIA describes the processing and its purposes, assesses necessity and proportionality, assesses the risks to people, and records the measures that address them; if high risk remains, the controller must consult the supervisory authority before starting (Article 36).
Architects should treat a DPIA as the privacy counterpart of the threat model in Section 8.2, done at the same time and over the same data-flow diagram. The LINDDUN framework, developed at KU Leuven, does for privacy threats what STRIDE does for security threats, with categories such as linking, identifying, detecting, data disclosure and unawareness. The DPIA's conclusions become architectural requirements, such as location trails are deleted 30 days after the delivery, which can be tested.
International transfers and data residency
Chapter V of the GDPR restricts transfers of personal data to countries outside the European Economic Area. A transfer is lawful if the Commission has found the country adequate (Article 45), if appropriate safeguards such as the Commission's standard contractual clauses are in place (Article 46), or under narrow derogations (Article 49). After the Court of Justice invalidated the EU-US Privacy Shield in the Schrems II judgment of July 2020, transfers under contractual clauses need an assessment of the destination's laws; the EU-US Data Privacy Framework, found adequate in July 2023, covers transfers to US companies that certify under it, and survived a first challenge in the EU General Court in September 2025 (Latombe v Commission), although further litigation, including any appeal to the Court of Justice, could still change the position.
Two architectural points follow. First, a transfer is not only a database in another region: remote access by a support team abroad, a SaaS processor's sub-processors and a logging service hosted elsewhere all count, so the data map must record where data is stored and from where it is accessed. Second, data residency requirements, whether legal, contractual or chosen, are easiest to meet with regional deployment cells: each region holds its customers' personal data and keys, global services see only pseudonymous references, and replication across regions is explicit and reviewed. Retrofitting residency into a single global database is one of the most expensive changes a platform can face, which is why it belongs among the constraints captured early.
Minimisation, pseudonymisation and anonymisation
The cheapest personal data to protect is the data you never collect. Minimisation shows up in small decisions: an over-18 flag instead of a date of birth, a postcode district instead of a full address for analytics, a masked phone number relayed through the platform instead of revealing the customer's number to the courier, and location sampling only while a delivery is in progress.
Pseudonymisation (Article 4(5)) processes data so that it can no longer be attributed to a person without additional information, such as a key, that is kept separately and protected. A keyed hash (HMAC) of the customer ID, with the key held by the account team, lets the analytics team count orders per customer without seeing who the customers are. It is a valuable safeguard that Article 25 names explicitly, but Recital 26 is clear that pseudonymised data which could be attributed to a person by the use of additional information is still personal data. In EDPS v SRB (Case C-413/23 P, 4 September 2025) the Court of Justice added a nuance: whether data is personal is assessed from the perspective of whoever holds it, so pseudonymised data may not be personal data for a recipient that has no reasonable means of re-identifying anyone, although it remains personal data for the controller that holds the key, and the controller must still tell people about such recipients. The EDPB's Guidelines 01/2025 on pseudonymisation describe how to do it well.
Anonymisation goes further: the data no longer relates to an identifiable person, taking into account all the means reasonably likely to be used to identify someone, and the GDPR then no longer applies. True anonymisation is hard. Removing names is not enough when a combination of postcode, birth date and sex identifies most people, or when a single courier's location trail reveals where they live. Aggregation with small counts suppressed, generalisation and, for statistics, differential privacy are the usual techniques, and the result should be tested against realistic re-identification attempts.
Personal, pseudonymised and anonymised data
Retention and erasure across every copy
Storage limitation needs a retention schedule: for each category of data, how long it is kept, why, and what happens at the end (deletion, anonymisation or archiving). Schedules only work when systems enforce them automatically: TTLs on cache and key-value entries, time-partitioned tables whose old partitions are dropped, object-storage lifecycle rules, log retention settings and scheduled jobs whose success is monitored.
Erasure is hardest in the places personal data leaks into. Caches and search indexes need explicit eviction and re-indexing, with TTLs as a backstop. Analytics stores should hold pseudonymous references so that rows can be found and deleted, or the data should be anonymised on the way in. Event logs and event-sourced stores are immutable by design; the usual technique is crypto-shredding, encrypting each person's fields with a per-person key and destroying the key, as described in Section 7.5, or keeping personal data out of events and storing only references. Application logs should not contain personal data that is not needed, which Section 8.8 returns to. Backups usually cannot be edited; the UK Information Commissioner's Office accepts that data may remain in backups until they are overwritten on an established schedule, provided it is put beyond use meanwhile and the person is told clearly what will happen, and if a backup is ever restored, erasures must be re-applied, which requires keeping the list of erased IDs. Finally, processors must be instructed to delete, since they act only on the controller's instructions (Article 28), and other recipients must be told (Article 19), so erasure must reach the SMS gateway, the support desk and the marketing platform through their APIs.
Erasure fan-out in the food-delivery platform
Worked example
Worked example: designing "delete my account" for the food-delivery platform
A customer in London asks to delete their account. The design must erase what can be erased, keep what the law requires with a stated reason, finish well within one month, survive failures part-way through, and produce evidence. Retention periods below are illustrative choices for this example, not legal requirements for any particular business.
| 1. Verify and confirm | The request arrives in the app from a logged-in session; the account service requires a fresh authentication, explains what will be deleted and what will be kept, and offers a data export first. A short cooling-off period (for example 14 days) allows the customer to cancel; outstanding orders and refunds must complete first. |
|---|---|
| 2. Record the request | The account service writes an erasure ledger entry with a request ID, the customer ID and the list of stores expected to respond, taken from the data map. The ledger stores no more personal data than the ID needed to process the request. |
| 3. Fan out | It publishes CustomerErasureRequested through the outbox to a topic. Each consumer is idempotent, because delivery is at least once, and handles the event even if the customer was already partly deleted. |
| 4. Apply per-store rules | Orders replace name, phone and address with a tombstone but keep order lines and invoices for the tax retention period, with the legal obligation recorded as the reason. Payments ask the payment provider to delete stored card tokens and keep the transaction ledger. Notifications delete contact details and add a hashed e-mail to the suppression list. The event store destroys the customer's data key. The warehouse deletes rows by pseudonym in its next daily run. Caches are evicted and the search index updated. |
| 5. Reach processors | Connectors call the deletion APIs of the support-desk SaaS, the SMS gateway and the marketing platform, recording each response. |
| 6. Confirm and chase | Each consumer writes a confirmation to the ledger. A daily job raises an alert for any store that has not confirmed within seven days, well inside the one-month limit. |
| 7. Handle backups | Database backups are kept for 35 days and are not used for anything except disaster recovery. The erased customer IDs are kept in a list so that a restore re-applies all erasures before the system is reopened. |
| 8. Tell the customer | A final message confirms completion, says what has been kept, why and until when, and that backup copies will expire within 35 days. |
The data map is the critical artefact: a store missing from it is a store that keeps the data. A fitness function can fail the build if a new service declares a personal-data field without registering an erasure handler.
Retention with a reason is not a failure of erasure. Article 17(3) lists exceptions, including compliance with a legal obligation; the design keeps the minimum data needed for that obligation and deletes it when the obligation ends.
Questions people ask
Is encrypting personal data enough to satisfy the GDPR?
No. Encryption is an important security measure, and encrypted data that leaks may not need to be reported to individuals, but the principles, lawful bases, rights and retention rules apply to encrypted data as to any other.
Can we keep everything in an anonymised form instead of deleting it?
Only if it is truly anonymous, meaning no one can reasonably re-identify people from it. Hashing an ID or dropping names usually produces pseudonymised data, which is still personal data for whoever holds the means to re-identify.
Who decides retention periods: architects or lawyers?
Lawyers and the business decide the periods and reasons; architects make sure every store has a period, that it is enforced automatically and that the system can prove it.
Check your understanding
Why is a single marketing_consent boolean column a weak design?
It cannot show when, how and to what wording consent was given, which Article 7 requires the controller to demonstrate, and it loses the history of withdrawals. An append-only record of consent events provides that evidence.
The analytics team receives order data keyed by an HMAC of the customer ID. Is it personal data?
For the platform, which holds the key, yes: it is pseudonymised data. For a recipient with no reasonable means of re-identification it may not be, following EDPS v SRB, but the controller's obligations remain.
Why does a restored backup threaten erasures, and what prevents it?
The restore brings back data that was erased after the backup was taken. Keeping a list of erased IDs and re-applying the erasures before the restored system is used prevents it.
What does Article 25(2) mean by data protection by default?
Without any action by the person, only the data necessary for each purpose is collected, processed, stored and made accessible; for example, optional profile sharing is off by default.
Sources and further reading
Have a question about this section? ArchitectBot, the course’s AI study assistant, answers from the course first.
Ask: “How do I design a data map and erasure process so that a delete-my-account request reaches every service, cache and analytics store?”