GDPR turned 8 years old in 2026, and most SaaS companies still get it wrong. Not because the regulation is unclear — but because the gap between legal requirements and technical implementation is enormous.
Your lawyer tells you to "implement data subject rights." Your developer asks: "What does that mean in PostgreSQL?" This guide bridges that gap.
We've built GDPR-compliant features into platforms for legal document management (Dossier), healthcare case management (Bridgelaw), and multi-location operations (FleetGrid). The patterns below come from real implementations, not theoretical frameworks.
Phase 1: Data Mapping — Know Where Everything Lives
Before you implement anything, map every location where personal data exists in your system. This sounds obvious. In practice, most teams miss 30-40% of their data touchpoints.
The Complete Data Map
For each piece of personal data, document:
| Data Point | Locations | Lawful Basis | Retention |
|---|---|---|---|
| Email address | DB, Stripe, SendGrid, logs, backups | Contract | Account lifetime + 30 days |
| IP address | Logs, CDN, analytics, rate limiter | Legitimate interest | 90 days |
| Usage analytics | PostHog, internal metrics DB | Consent | Until consent withdrawn |
| Payment info | Stripe (tokenized, never in our DB) | Contract | As required by tax law |
The locations most teams miss
Application logs (structured and unstructured), error tracking services (Sentry, Datadog), CDN access logs, email service provider records, customer support chat transcripts, and database backups. A deletion request that only clears your primary database is not GDPR-compliant.
Phase 2: Consent Management Architecture
GDPR consent must be: freely given, specific, informed, and unambiguous. Technically, this means you need granular consent tracking — not a single "I agree to everything" checkbox.
Consent Database Schema
CREATE TABLE consent_records (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES users(id),
consent_type VARCHAR(50) NOT NULL, -- 'analytics', 'marketing_email', 'third_party_sharing'
granted BOOLEAN NOT NULL,
granted_at TIMESTAMP WITH TIME ZONE,
withdrawn_at TIMESTAMP WITH TIME ZONE,
ip_address INET,
user_agent TEXT,
consent_version VARCHAR(20) NOT NULL, -- tracks which privacy policy version
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Every consent change creates a new record (audit trail)
-- Never UPDATE consent_records, only INSERT
CREATE INDEX idx_consent_user_type ON consent_records(user_id, consent_type, created_at DESC);
Key design decisions:
- Append-only table — Never update or delete consent records. Each change (grant or withdrawal) creates a new row. This gives you a complete audit trail of when consent was given and withdrawn.
- Consent version tracking — When you update your privacy policy, existing consent may no longer be valid. Track which version of the policy the user agreed to.
- Granular types — Separate consent for analytics, marketing emails, and third-party data sharing. "All or nothing" consent is not GDPR-compliant.
Consent Checking Middleware
Don't scatter consent checks throughout your codebase. Build middleware that checks consent before processing:
// Consent middleware
const requireConsent = (consentType) => async (req, res, next) => {
const consent = await getLatestConsent(req.user.id, consentType);
if (!consent || !consent.granted || consent.withdrawn_at) {
return res.status(403).json({
error: 'consent_required',
consentType,
message: `User has not granted consent for: ${consentType}`
});
}
// Check if consent version matches current privacy policy
if (consent.consent_version !== CURRENT_POLICY_VERSION) {
return res.status(403).json({
error: 'consent_outdated',
consentType,
message: 'Privacy policy updated. Re-consent required.'
});
}
next();
};
// Usage
app.post('/api/analytics/track', requireConsent('analytics'), trackEvent);
app.post('/api/newsletter/subscribe', requireConsent('marketing_email'), subscribe);
Phase 3: Right to Deletion — The Hardest Part
Article 17: "The data subject shall have the right to obtain from the controller the erasure of personal data." You have 30 days to comply.
In practice, this means building a deletion pipeline that reaches into every system where user data exists — including the ones you forgot about in your data map.
Deletion Pipeline Architecture
We build deletion as a multi-step background job with status tracking:
- Request received — User submits deletion request. Verify identity (re-authentication required). Create a deletion job record.
- Grace period — 7-day cooling period (configurable). User can cancel. Email confirmation sent.
- Primary database — Delete or anonymize user records. For records needed for legal compliance (invoices, tax records), anonymize instead of delete: replace name with "Deleted User #[hash]", remove email, keep transaction data.
- Search indexes — Remove user data from Elasticsearch/Algolia. Trigger re-index for any content that referenced this user.
- Third-party services — API calls to delete data from Stripe (customer record), SendGrid (contact), analytics (user profile). Each service has its own deletion API and confirmation mechanism.
- Caches — Flush all Redis keys containing user data. Invalidate CDN cache for user-specific resources.
- Logs — Add user ID to a deletion exclusion list. Log rotation pipeline checks against this list and scrubs matching entries.
- Backups — Add to backup exclusion registry. When backups are restored, the exclusion list is applied to prevent resurrecting deleted data.
- Confirmation — Send deletion confirmation email (to the address before deletion). Mark deletion job as complete.
The backup problem
GDPR doesn't require you to delete data from encrypted backups immediately — that would make backups useless. But you must ensure that if a backup is restored, deleted users' data doesn't come back. We implement this with a "deletion registry" table that survives restores and is checked during the restoration process.
Phase 4: Right to Access and Data Portability
Users can request all personal data you hold about them (Article 15) and receive it in a machine-readable format (Article 20). Response time: 30 days.
We build this as an automated export pipeline:
// Data export job
async function generateUserDataExport(userId) {
const exportData = {
profile: await db.query('SELECT name, email, created_at FROM users WHERE id = $1', [userId]),
activity: await db.query('SELECT action, timestamp FROM audit_log WHERE user_id = $1', [userId]),
content: await db.query('SELECT * FROM user_content WHERE user_id = $1', [userId]),
consent: await db.query('SELECT * FROM consent_records WHERE user_id = $1 ORDER BY created_at', [userId]),
thirdParty: {
stripe: await stripe.customers.retrieve(stripeCustomerId),
analytics: await posthog.getPersonProperties(userId)
}
};
// Generate JSON + human-readable PDF
const jsonExport = JSON.stringify(exportData, null, 2);
const pdfExport = await generatePDFReport(exportData);
// Upload to secure, time-limited download link
return await createSecureDownload(userId, { json: jsonExport, pdf: pdfExport }, { expiresIn: '7d' });
}
Provide both JSON (machine-readable, satisfies portability requirement) and PDF (human-readable, better user experience). The download link expires after 7 days and requires re-authentication to access.
Phase 5: Breach Notification System
GDPR requires notification to the supervisory authority within 72 hours of discovering a breach. If the breach is high-risk, affected users must also be notified.
72 hours sounds generous until you realize it includes: detecting the breach, assessing its scope, determining which data was affected, drafting the notification, and submitting it. Most of that needs to be automated.
Automated Breach Detection
- Unusual data access patterns — Alert when a single user account accesses more than 100 records in an hour (configurable per role). Our Dossier platform for legal document management flags any access pattern that deviates 3x from the user's historical norm.
- Failed authentication spikes — More than 50 failed logins from the same IP in 10 minutes triggers automatic IP blocking and an investigation alert.
- Data export anomalies — Large data exports outside business hours or from unusual locations trigger manual review before the export completes.
- API access pattern monitoring — Track which API endpoints are accessed, by whom, and how frequently. Sudden spikes in data-heavy endpoints (user search, bulk export) trigger alerts.
Breach Response Automation
When a potential breach is detected:
- Automatic containment: suspicious session terminated, API keys rotated, affected accounts locked
- Scope assessment: query audit logs to determine exactly which records were accessed
- Pre-populated incident report with: timestamp, affected data types, number of records, access source
- Notification template ready with affected user list and personalized data impact summary
The goal: reduce the "investigation to notification" timeline from days to hours, leaving more of the 72-hour window for decision-making and legal review.
Phase 6: Data Processing Agreements
Every sub-processor that touches personal data needs a DPA (Data Processing Agreement). For a typical SaaS product, that's:
- Cloud provider (AWS, GCP, Azure) — all three have standard DPAs
- Payment processor (Stripe) — DPA available in Stripe dashboard
- Email service (SendGrid, Postmark) — DPA in account settings
- Analytics (PostHog, Mixpanel) — self-hosted PostHog avoids this entirely
- Error tracking (Sentry) — DPA available, configure PII scrubbing
- Customer support (Intercom, Zendesk) — DPA in enterprise plans
Architecture decision: self-hosting reduces DPA burden
For our Dossier platform (legal document management), we self-host analytics and error tracking specifically to avoid sharing personal data with additional sub-processors. Fewer sub-processors = fewer DPAs = simpler compliance. This is especially relevant for legal and healthcare SaaS where clients are sensitive about their data touching third-party services.
The GDPR Implementation Checklist
Here's the complete technical checklist we use when building GDPR-compliant SaaS. Items are ordered by priority — start at the top.
Data Foundation
- Complete data mapping (all personal data, all locations, all sub-processors)
- Lawful basis documented per data point
- Retention periods defined and automated
- Privacy policy matching actual data practices
Consent & Rights
- Granular consent management (not all-or-nothing)
- Consent audit trail (append-only records)
- Right to access (automated data export in JSON + PDF)
- Right to deletion (cascade deletion pipeline across all systems)
- Right to rectification (user can update/correct their data)
- Right to data portability (machine-readable export)
Security & Monitoring
- Encryption at rest (AES-256) and in transit (TLS 1.2+)
- Access controls (RBAC with principle of least privilege)
- Audit logging (all personal data access logged)
- Breach detection and automated containment
- 72-hour breach notification pipeline
- Regular access reviews (who has access to what?)
Organizational
- DPAs signed with all sub-processors
- Privacy impact assessment for new features
- Data protection officer designated (required if processing at scale)
- Staff training on data handling procedures
- Incident response plan documented and tested
Cost: What GDPR Compliance Actually Adds
For a new SaaS MVP in the $30k-$50k range, GDPR compliance typically adds $6,000-$10,000 (15-25% of base cost):
| Component | New Build | Retrofit |
|---|---|---|
| Data mapping + consent management | $1,500-$2,500 | $4,000-$6,000 |
| Deletion pipeline | $2,000-$3,000 | $5,000-$8,000 |
| Data export (access + portability) | $1,000-$2,000 | $2,500-$4,000 |
| Breach detection + notification | $1,500-$2,500 | $3,000-$5,000 |
| Total | $6,000-$10,000 | $14,500-$23,000 |
Retrofitting costs 2-3x more because you're working backwards: discovering where data lives, refactoring data access patterns, and building deletion logic that accounts for relationships you didn't design for.
Frequently Asked Questions
What are the technical requirements for GDPR in SaaS?
Data mapping, lawful basis tracking, granular consent management, right to access (automated export), right to deletion (cascade deletion pipeline), breach notification system (72-hour window), DPAs with all sub-processors, and privacy by design in new features.
How do you implement right to deletion?
Build a deletion pipeline that maps every data location: primary database, caches, search indexes, analytics, third-party services, logs, and backups. Use a background job with status tracking. Anonymize where full deletion isn't possible (tax records, aggregate analytics). Implement a backup exclusion registry.
What's the difference between GDPR and HIPAA?
GDPR protects all personal data of EU residents with extensive individual rights. HIPAA protects US health information with specific security controls. GDPR is broader in scope, HIPAA more prescriptive technically. Healthcare SaaS serving EU markets often needs both. Read our HIPAA development guide for the healthcare-specific requirements.
How much does GDPR compliance add to development cost?
For a new $40k MVP: $6,000-$10,000 (15-25% of base cost). Retrofitting into an existing product: $14,500-$23,000 (2-3x more). Building GDPR in from the start is always cheaper because you design data flows around compliance requirements rather than refactoring them later.
Do I need GDPR compliance if my SaaS is US-based?
Yes, if EU residents can use your product. GDPR applies based on the data subject's location, not your company's. Fines reach 4% of annual global turnover or €20 million. Even US-only products should implement GDPR-like practices — US state privacy laws (CCPA, CPRA, Virginia CDPA) have similar requirements.
Next Steps
GDPR compliance is an architecture decision, not a feature you bolt on. Start with data mapping, build consent and deletion into your data models from day one, and automate your breach response pipeline.
- Book a 30-minute compliance architecture call — we'll review your current data flows and identify compliance gaps
- HIPAA for SaaS Developers — if your SaaS handles health data
- SOC 2 for Early-Stage SaaS — the other compliance framework your enterprise buyers will ask about
- SaaS MVP Development — we build compliance into the architecture from day one