Skip to main content

GDPR Guide for Developers

GDPR

Comprehensive guide to implementing GDPR compliance with data subject rights, lawful bases for processing, and consent requirements.

Data Subject Rights

Handle access, deletion, and portability requests

Lawful Bases

Understand the six legal grounds for processing

Consent Records

Maintain audit trails and proof of consent

Compliance Tools

Built-in APIs for GDPR requirements

GDPR Overview

The General Data Protection Regulation (GDPR) is a comprehensive data protection law that applies to organizations processing personal data of EU residents. Understanding GDPR is essential for any application handling user data.

Who does GDPR apply to?

GDPR applies to any organization that processes personal data of EU residents, regardless of where the organization is located. This includes both data controllers (who determine the purposes of processing) and data processors (who process data on behalf of controllers).

Key Principles

  • Lawfulness, fairness, and transparency
  • Purpose limitation
  • Data minimization
  • Accuracy
  • Storage limitation
  • Integrity and confidentiality

Penalties

Tier 1 Violations

Up to 10M EUR or 2% of annual global turnover

Tier 2 Violations

Up to 20M EUR or 4% of annual global turnover

Six Lawful Bases for Processing

GDPR requires a lawful basis for any processing of personal data. You must identify and document your lawful basis before processing begins.

Consent

User has given clear, affirmative consent for specific purposes

Example: Email marketing, analytics tracking, personalized ads

Contract

Processing is necessary to fulfill a contract with the user

Example: Processing orders, delivering services, account management

Legal Obligation

Processing is required to comply with the law

Example: Tax records, fraud prevention, regulatory reporting

Vital Interests

Processing is necessary to protect someone's life

Example: Emergency medical situations, disaster response

Public Task

Processing is necessary for official functions or public interest

Example: Government services, public health monitoring

Legitimate Interests

Processing is necessary for your legitimate business interests

Example: Security logging, fraud detection, direct marketing to existing customers

Choosing the right basis

Consent is not always the best choice. If you can rely on another lawful basis (like contract or legitimate interests), it may be more appropriate. However, consent is required for marketing communications and most analytics/tracking.

Data Subject Rights

GDPR grants individuals specific rights over their personal data. You must have processes in place to handle these requests within the required timeframes.

Right of Access

Users can request a copy of their personal data

Response: 30 days

Right to Rectification

Users can request correction of inaccurate data

Response: 30 days

Right to Erasure

Users can request deletion of their data ("right to be forgotten")

Response: 30 days

Right to Portability

Users can request their data in a machine-readable format

Response: 30 days

Right to Object

Users can object to certain types of processing

Response: Immediate

Right to Restrict

Users can request limitation of processing

Response: 30 days

Handling Data Subject Requests

Use the Sylphx Consent API to handle data subject requests programmatically:

Right of Access (Data Export)
import { platform } from '@/lib/platform'

// Handle data access request
export async function handleAccessRequest(userId: string) {
  // Gather all user data
  const userData = await platform.consent.exportUserData(userId)

  // Returns:
  // {
  //   profile: { name, email, ... },
  //   consents: [{ type, granted, timestamp, ... }],
  //   activity: [...],
  //   analytics: [...],
  //   // All data associated with the user
  // }

  // Send data to user via secure download link
  const downloadUrl = await platform.storage.createSecureDownload({
    content: JSON.stringify(userData, null, 2),
    filename: 'my-data-export.json',
    expiresIn: '7d',
  })

  await platform.email.send({
    to: userData.profile.email,
    template: 'data-export-ready',
    data: { downloadUrl },
  })
}
Right to Erasure (Deletion)
import { platform } from '@/lib/platform'

// Handle deletion request
export async function handleDeletionRequest(userId: string, reason?: string) {
  // Verify the request (e.g., re-authenticate user)

  // Request deletion - data is queued for removal
  const request = await platform.consent.requestDeletion({
    userId,
    reason: reason || 'User requested account deletion',
    // Optional: specify what to delete
    scope: ['profile', 'analytics', 'consents', 'activity'],
    // Optional: exclude data required for legal compliance
    excludeRetained: ['billing', 'audit_logs'],
  })

  // Returns deletion request details
  // {
  //   requestId: 'del_abc123',
  //   status: 'pending',
  //   scheduledAt: '2024-02-15T00:00:00Z',
  //   estimatedCompletion: '2024-02-20T00:00:00Z',
  // }

  // Send confirmation email
  await platform.email.send({
    to: user.email,
    template: 'deletion-scheduled',
    data: {
      requestId: request.requestId,
      completionDate: request.estimatedCompletion,
    },
  })

  return request
}
Right to Portability
import { platform } from '@/lib/platform'

// Export data in machine-readable format
export async function handlePortabilityRequest(userId: string) {
  const data = await platform.consent.exportUserData(userId, {
    format: 'json', // or 'csv'
    // Only include data user provided directly
    scope: ['profile', 'preferences', 'content'],
    // Exclude derived/inferred data
    excludeInferred: true,
  })

  // Create downloadable file
  const downloadUrl = await platform.storage.createSecureDownload({
    content: JSON.stringify(data, null, 2),
    filename: 'my-data-portable.json',
    contentType: 'application/json',
    expiresIn: '7d',
  })

  return downloadUrl
}

Data Retention

You may need to retain some data even after a deletion request (e.g., for legal compliance, fraud prevention, or ongoing disputes). Document your retention policies and inform users about any data that cannot be deleted.

Implementation Checklist

1

Identify Your Lawful Bases

Document the lawful basis for each type of processing you perform. Update your privacy policy to reflect these bases.

2

Implement Consent Collection

Use the CookieBanner and ConsentPreferences components to collect valid GDPR-compliant consent.

3

Set Up Audit Trails

Configure consent logging to record all consent interactions with timestamps and metadata.

4

Build Data Subject Request Handlers

Implement APIs to handle access, deletion, and portability requests within required timeframes.

5

Test and Document

Test all consent flows and data subject request handlers. Document your compliance procedures.

Also operating in California?

Learn about CCPA/CPRA requirements and how they differ from GDPR.

CCPA Guide