Codapult includes GDPR-oriented account controls: data export and account deletion. They are implemented as server-side helpers plus authenticated API routes.
Endpoints
| Route | Method | Purpose |
|---|---|---|
/api/account/export | GET | Download user data as JSON |
/api/account/delete | POST | Delete the authenticated user's account |
Exported data
exportUserData(userId) gathers:
- User profile
- Sessions and linked auth accounts
- Subscriptions
- Organizations
- Notifications and preferences
- Activity log
- API keys without key hashes
- Usage credits and events
- Feature requests and votes
- Experiment assignments
Sensitive auth tokens are omitted from the export.
Deletion behavior
deleteUserAccount(userId) deletes the user and associated records. It also handles organization membership cleanup: if the user is the last member of an organization, the organization and invitations are removed.
Subscriptions should be canceled or handled with your billing provider before deletion if your product requires that policy.
Key files
| File | Purpose |
|---|---|
src/lib/gdpr/index.ts | Export and deletion helpers |
src/app/api/account/export/route.ts | JSON export route |
src/app/api/account/delete/route.ts | Account deletion route |
src/lib/db/schema.ts | Related user/account/org tables |
Product checklist
- Add UI copy that explains account deletion consequences.
- Require explicit confirmation before deletion.
- Decide whether subscriptions are canceled automatically or manually.
- Log deletion events before the user row is removed if your compliance policy requires it.