Building GDPR-Compliant Web Applications: A Developer's Technical Guide
GDPR enforcement is getting stricter. Here is how to build applications that are compliant by design.
GDPR has been in effect since 2018, but enforcement has intensified significantly in 2025 and 2026. The ICO issued over 45 million pounds in fines in 2025 alone, and investigations are more thorough than ever. The bar for what constitutes adequate data protection has risen substantially. If you are building web applications that serve UK or EU users, compliance is not optional — it is a fundamental engineering requirement.
Post-Brexit, the UK retained GDPR as the UK GDPR, supplemented by the Data Protection Act 2018. For practical purposes, if your application complies with UK GDPR, it will also satisfy EU GDPR requirements. But there are nuances — particularly around international data transfers — that catch developers off guard.
This article is not a legal guide. It is an engineering guide. We are going to walk through exactly how to build web applications that are GDPR-compliant by design, with specific technical implementations that our team uses on every UK project.
Data Minimisation in Practice
The core GDPR principle is data minimisation — collect only what you need, for as long as you need it. This sounds simple in theory. In practice, it requires discipline that most development teams lack.
Here is what data minimisation actually means in code. Do not store user data in your analytics that can identify individuals — use anonymised session IDs rather than user IDs in your event tracking. Do not keep form submissions indefinitely — if someone filled out a contact form three years ago and you never followed up, that data should be gone. Implement automated data deletion after your retention period expires. And give users granular control over what data you collect.
We see UK companies making the same mistake over and over: they collect everything because they might need it later. Your marketing team wants to store the user's company size, industry, job title, phone number, and LinkedIn profile URL on a simple newsletter signup form. Every additional field you collect increases your GDPR exposure. If you do not have a documented, legitimate business purpose for each piece of data, do not collect it.
Building Your Database Schema for GDPR
Technically, data minimisation means building your database schema with GDPR in mind from the first migration. Every table that stores personal data should have a retention policy defined in your documentation. We typically implement this as a retention_expires_at column on relevant tables and a background job that runs nightly to purge data that has exceeded its retention period.
Here is how we structure personal data in PostgreSQL. We separate personal data from application data using a dedicated schema. The users table contains the minimum needed for authentication — email, hashed password, created_at. Profile information goes in a separate table with an explicit retention policy. Transaction history might have a different retention period than marketing preferences.
This separation matters because when a user requests deletion, you need to know exactly which tables contain their personal data and which data you are legally required to retain. Financial records, for example, must be kept for six years under UK tax law even if the user requests deletion. Your schema should make this distinction clear at the database level, not buried in application logic.
We also implement soft deletion with a hard deletion pipeline. When a user requests account deletion, we immediately anonymise their profile data — replacing names, emails, and identifiers with hashed values — and then schedule a hard deletion job that runs 30 days later. This gives you a window to handle any edge cases while immediately removing the user's identifiable information from active queries.
Consent Management: Getting It Right
Cookie consent banners are the most visible GDPR requirement, but they are almost universally implemented incorrectly. The ICO's own research in 2025 found that over 60 percent of UK websites had non-compliant cookie consent mechanisms.
The common mistakes: pre-checked consent boxes, which are not valid consent under GDPR. Treating closing the banner as consent — the ICO has been explicit that this does not constitute valid consent. Not providing an equally easy way to reject all cookies as to accept them. Making the reject button smaller or less prominent than the accept button. And the most common violation of all: loading analytics and advertising scripts before consent is given.
The correct implementation requires careful engineering. No tracking scripts load until explicit, affirmative consent is given. This means your Google Analytics, Meta Pixel, Hotjar, and any other tracking tools must be loaded dynamically after consent, not included in your initial HTML.
In a Next.js application, we handle this with a consent context provider that wraps the application. Third-party scripts are loaded using next/script with the strategy set to lazyOnload, but only after the consent state confirms the user has opted in. The consent preferences are stored in a first-party cookie and respected on subsequent visits.
Users must be able to change their preferences at any time through a clearly accessible interface. We typically add a Cookie Preferences link in the footer that reopens the consent dialog. And critically, you must maintain records of when and how consent was obtained. We log consent events to the database with the timestamp, the specific categories consented to, the version of the privacy policy that was active, and the user's IP address.
Lawful Basis: Beyond Consent
Many developers assume that consent is the only lawful basis for processing personal data under GDPR. It is not. There are six lawful bases, and choosing the right one for each processing activity matters enormously.
For a typical UK web application, the breakdown usually looks like this. User authentication and account management falls under legitimate interest or contract performance. Transactional emails fall under contract performance. Marketing emails require consent. Analytics for product improvement can use legitimate interest, but only if you have conducted a Legitimate Interest Assessment. Sharing data with third-party advertising networks requires consent, and it must be granular.
The reason this matters technically is that data processed under consent can be withdrawn at any time, and you must stop processing immediately. Data processed under legitimate interest cannot be withdrawn in the same way, but users have the right to object. Your application needs different handling paths depending on the lawful basis for each processing activity.
Right to Deletion: The Engineering Challenge
Users have the right to request deletion of their data. Your application needs a mechanism to fulfil these requests completely within 30 days. This sounds straightforward until you start mapping all the places where user data lives.
A typical web application stores user data in the primary database, database backups, Redis or Memcached cache layers, log files, analytics services, email marketing platforms, payment processors like Stripe, customer support tools, CDN cache headers, and browser local storage or cookies.
Deleting from the primary database is easy. Deleting from backups is harder — you cannot selectively remove one user from a database backup without restoring the entire backup, removing the user, and re-creating the backup. The ICO's guidance allows for a reasonable timeframe for backup deletion, but you must have a documented process.
We build a dedicated data deletion pipeline for every application that handles personal data. It is triggered by user request or automated based on account inactivity. The pipeline cascades through all systems that hold user data: it calls the Stripe API to delete the customer record, calls the email platform API to remove the subscriber, anonymises analytics data, and logs the deletion event for compliance records.
International Data Transfers Post-Brexit
The UK has its own adequacy decisions for international data transfers, separate from the EU. As of 2026, the UK recognises the EU, EEA, and several other jurisdictions as providing adequate data protection. But transfers to the US require specific safeguards.
If your Next.js application is deployed on Vercel, your data is processed in the US by default. This means you need Standard Contractual Clauses or equivalent safeguards in place. Similarly, if you use Supabase, your database might be hosted in the US unless you explicitly choose a European region. We always deploy UK client databases on eu-west-2 London or eu-central-1 Frankfurt to avoid international transfer complications entirely.
For applications that must keep all data within the UK, we deploy on AWS eu-west-2 or Azure UK South. CDN configuration needs attention too — Cloudflare will cache content at edge nodes worldwide by default, which means cached personal data could technically be processed outside the UK. We configure cache rules to exclude any responses containing personal data from edge caching.
Subject Access Requests: Automating the Response
Under GDPR, users have the right to request a copy of all personal data you hold about them. You have 30 days to respond. For applications with significant user bases, you need automation.
We build a self-service data export feature into every application. Users can request a complete export of their data from their account settings. The system generates a JSON file containing all personal data from all tables, packages it into a downloadable archive, and notifies the user when it is ready. This satisfies the Subject Access Request requirement automatically and reduces the operational burden on your team.
Privacy-Preserving Analytics
You need analytics to build a good product. But traditional analytics tools like Google Analytics collect far more personal data than most developers realise — IP addresses, device fingerprints, browsing patterns, and location data are all personal data under GDPR.
We have moved most of our UK projects to privacy-preserving analytics tools. Plausible Analytics is our default recommendation — it collects no personal data, requires no cookie consent banner, and provides the aggregate metrics that product teams actually need. For applications that need more detailed analytics, PostHog with self-hosting on UK infrastructure gives you full event tracking while keeping all data under your control.
Security Measures Required by GDPR
GDPR Article 32 requires appropriate technical and organisational measures to protect personal data. The ICO has provided guidance on what this means in practice: encryption of personal data at rest and in transit, access controls that limit who can view personal data to those who need it for their role, regular testing through penetration testing and vulnerability scanning, and pseudonymisation where possible.
For UK web applications, our standard security implementation includes all personal data encrypted at rest using AES-256, TLS 1.3 for all data in transit, role-based access controls with database-level row security policies in Supabase, automated daily vulnerability scanning with Snyk, quarterly penetration testing, and comprehensive audit logging of all access to personal data.
Handling Data Breaches
Under UK GDPR, you must notify the ICO of a personal data breach within 72 hours of becoming aware of it, unless the breach is unlikely to result in a risk to individuals. If the breach is likely to result in a high risk, you must also notify the affected individuals without undue delay.
You need an incident response plan before a breach happens. Our standard plan includes automated alerting for potential breach indicators, a documented escalation procedure with specific people responsible for each step, pre-drafted notification templates for both the ICO and affected users, and a forensic investigation checklist for determining the scope and impact of the breach.
Our GDPR-First Development Approach
When we build applications for UK and EU clients, GDPR compliance is architected in from the first database migration. We use privacy-by-design principles throughout: minimal data collection with documented justification for every field, encrypted storage with UK-based key management, automated retention enforcement that runs nightly, comprehensive audit logging for all personal data access, self-service data export and deletion, privacy-preserving analytics by default, and consent management that actually works correctly.
This is not expensive to build when you do it from the start. Our GDPR-compliant architecture adds roughly one week to the initial development timeline. Retrofitting GDPR compliance onto an existing application takes four to eight weeks and usually requires database schema changes that risk breaking existing functionality.
If you are building a web application for the UK market and want GDPR compliance built in from day one — not bolted on as an afterthought — our team has done this dozens of times. We know exactly what the ICO expects, and we build it into every project by default.
Want to discuss this topic?
Our team is ready to help you implement the ideas from this article.
