How to Build GDPR-Compliant Software: A Developer's Guide
GDPR-compliant software builds privacy into the design: map the data, pick a lawful basis, minimise what you collect and build consent and deletion into the code.
On this page
Short answer
GDPR-compliant software development is the practice of building software so that it collects, stores and uses personal data in line with the EU General Data Protection Regulation. It means privacy is part of the design from the first sketch, not a checklist added after the code is written.
What is GDPR-compliant software development?
GDPR-compliant software development is the practice of building software so that it collects, stores and uses personal data in line with the EU General Data Protection Regulation (GDPR). It means privacy is part of the design from the first sketch, not a checklist added after the code is written.
The regulation applies to any software that handles the personal data of people in the EU, wherever the company is based. Personal data covers names, email addresses, location, device identifiers and anything else that can identify a person, directly or when combined with other data.
A compliant build covers five areas, and each one shows up in the code:
| Area | What it means in the code |
|---|---|
| Lawful basis | Every feature that touches personal data has a recorded reason |
| Data minimisation | Forms and APIs collect only the fields a feature needs |
| Storage limits | Records carry a retention period and are deleted on schedule |
| Security | Encryption, access control and logging protect the data |
| People's rights | Consent, access, correction and deletion work in the product |
None of this needs a large legal team to start. It needs a clear data map, a few deliberate design choices and habits that the whole team follows. If you are starting from zero, read what GDPR compliance means first, then work through the steps below.
How do you map personal data before you write code?
You map personal data by listing every field your software collects, where it comes from, where it is stored, who can see it and when it is deleted. This map is the record of processing that GDPR expects you to keep, and it is the base for every later decision.
For each field, record five facts: the source, the purpose, the lawful basis, the retention period and who has access. A booking app, for example, collects a name and phone number to confirm a booking, keeps them for 24 months after the last visit, and limits access to support staff and the booking system itself.
The map also shows where data crosses boundaries: into analytics tools, email services, payment providers and logs. Those crossings are where most surprises hide, because a field that looks harmless in your database may be copied into a tool with its own retention rules.
Do the map before you design the database. Changing a schema after launch is far more expensive than leaving a field out at the start, and a good map often shows that half the fields on a form were never needed at all.
What does privacy by design change in the architecture?
Privacy by design changes the architecture by pushing data-protection decisions into the earliest choices: the data model, the APIs and the logging. The goal is to make the safe behaviour the default one, so a developer has to work to expose data rather than to protect it.
In practice, that means a few concrete patterns. Collect only the fields a feature needs, and question every new field at review time. Keep identity data separate from activity data where you can, so a breach of one store does not hand over the other. Pseudonymise analytics so reports work without names attached, and encrypt data both at rest and in transit.
Logs deserve special care. Logs often capture email addresses, IP addresses and request details by default, and teams forget they are personal data. Set log retention to weeks rather than years, and strip or hash identifiers that nobody needs for debugging.
Retention should be a default, not a manual job. Give every record a lifetime when it is created, and let a scheduled job delete or anonymise it when that lifetime ends. For the security side of the design, data security and compliance covers the controls that sit around the code.
How do you handle consent, access and deletion in code?
You handle consent by storing a record of what each person agreed to, when they agreed and in which version of the wording, so consent can be checked and withdrawn. Consent is only one lawful basis; many features rely on contract or legitimate interest instead, and the basis should be recorded per feature, not per product.
Access and deletion need real flows in the product, not a support inbox. Build an export that gathers a person's data from the database, file storage and connected tools into one file, and a deletion flow that removes it from the same places. Deletion from backups is the hard part: the usual answer is to mark the record for deletion and let the next backup rotation remove it, then document that delay.
Keep the flows simple and test them the way a user would. A deletion request that works in the main database but leaves copies in analytics, logs and a marketing tool is not a deletion, and it is exactly the kind of gap a regulator asks about.
Finally, record what happened. A short log of each request, what was exported or deleted, and when, gives you proof that the process works and shows the next request where to look.
What is the build sequence for a GDPR-compliant release?
The build sequence for a GDPR-compliant release runs in six steps, and the first three happen before any feature code is written.
- Map the data. List every personal-data field, its source, purpose, lawful basis, retention and access, as described above.
- Pick the lawful basis per feature. Consent, contract, legal duty or legitimate interest, recorded against each feature that uses personal data.
- Design for minimisation. Cut fields, separate identity from activity, plan pseudonymisation and set retention defaults in the schema.
- Build the rights flows. Consent records, data export, correction and deletion, including the tools and logs they must reach.
- Review vendors and processors. Check data processing agreements, sub-processors and where data is hosted before you integrate.
- Test with synthetic data. Use generated test data, not a copy of production, and check that deletion and export actually work end to end.
Run the sequence again for each major release. New features add new fields and new vendors, and a release that skips the first three steps is how compliant products quietly stop being compliant. The programme view of the same work is covered in how to implement GDPR compliance.
What do you need from vendors and processors?
Every vendor that processes personal data for you needs a data processing agreement that says what the vendor may do with the data, how it protects it and what happens when the contract ends. Without that agreement, you are responsible for data you do not control.
Check three things before you integrate a vendor. First, where the data is hosted and whether it leaves the EU or EEA, which triggers transfer rules. Second, which sub-processors the vendor uses, because your data flows to them too. Third, what happens on exit: can you get your data back, and does the vendor delete its copies?
Analytics and tracking tools deserve a second look. Many software development kits collect device identifiers, IP addresses and usage data by default, and that is personal data even when no name is attached. Either get consent for it, switch it off, or choose a configuration that keeps the data inside your own systems.
Keep a short vendor register alongside your data map: vendor, purpose, data shared, hosting location and agreement date. It takes an afternoon to build and saves weeks when a new rule or a customer question arrives.
Example (hypothetical): a small team ships a compliant booking app
Example (hypothetical): a team of four builds a booking app for local clinics. Before writing code, the team maps its data: name, phone, email, appointment time and clinic notes. The lawful basis is contract, retention is 24 months after the last visit, and access is limited to the clinic and two support staff.
During design, the team drops the date of birth field after realising the clinic does not need it, separates patient identity from appointment history, and sets the database to delete records automatically at 24 months. Logs keep request paths for 30 days and strip email addresses.
The numbers show why the defaults matter. The app holds 4,000 patient records, and 1,100 of them are older than 24 months, so the first scheduled cleanup deletes 1,100 records and leaves 2,900. Support handles 60 deletion requests a month; doing each by hand takes 20 minutes, or 20 hours a month, while the built-in export and deletion flow takes 5 minutes each, or 5 hours a month, saving 15 hours.
The team also signs processing agreements with its email and hosting vendors and switches its analytics tool to a configuration that stores no device identifiers. The app ships a week later than planned, but every later feature reuses the same map, flows and defaults.
What are the common mistakes?
The most common mistakes in GDPR-compliant software development are collecting data just in case, building no deletion path, and trusting vendors without checking what they do with the data.
- Collecting fields just in case. Every extra field is a liability you must protect, map and delete. If no feature needs it, leave it out.
- Consent banners that record nothing. A banner that shows a choice but stores no record of it cannot prove consent, and a withdrawal that changes nothing is worse than no banner.
- No deletion path for logs and backups. Deleting from the main database while copies sit in logs, analytics and backups is not a deletion.
- Assuming a vendor is fine. A vendor without a processing agreement, or one that moves data abroad without transfer safeguards, puts your compliance at risk.
- Testing with production data. A copy of the live database in a test environment is a second copy of personal data with weaker controls. Use generated data instead.
- No retention defaults. Records without a lifetime pile up forever, and a cleanup project years later is far harder than a scheduled job.
Key takeaways
- GDPR compliance starts with a data map, not with a legal document
- Every feature that uses personal data needs a recorded lawful basis
- Privacy by design means minimisation, short retention and safe defaults in the code
- Consent, export and deletion must work as product flows, not support tickets
- Vendors and SDKs need agreements, hosting checks and an exit plan
Frequently asked questions
Does GDPR apply to software built outside the EU?
Yes, if the software handles the personal data of people in the EU. The regulation follows the person whose data it is, not the location of the company or the servers, so a team anywhere in the world must comply when it serves EU users.
What is the difference between a controller and a processor?
A controller decides why and how personal data is used, while a processor handles it on the controller's instructions, such as a hosting or email provider. If you build software for clients, you are usually a processor for their data and a controller for your own users.
How long can you keep personal data?
Only as long as needed for the purpose you collected it for. Set a retention period per record type, such as 24 months after the last visit, and delete or anonymise the data when that period ends. Keeping data just in case is not a valid reason.
Do you need consent for everything?
No. Consent is one of several lawful bases. A booking app can rely on contract to store the details needed for the booking, while marketing emails usually need consent. Record the basis per feature and use consent only where it genuinely fits.
What happens if a user asks for their data to be deleted?
You must delete their personal data from your database, file storage, logs and connected tools, or explain why a specific piece must stay, such as a tax record. Backups are usually handled by marking the record and letting the next rotation remove it.
Is test data covered by GDPR?
Yes, if it is a copy of real personal data. A test database filled with production records is personal data under the regulation, so use generated or anonymised test data instead and keep it out of shared environments.