1. Front Matter
Title: Permanent Delete (Quest/Adventure)
Author: scorevi (Sean Patrick Caintic)
Reviewers: dyorgie (Jethro Lagmay)
Created: February 2026
Status: Approved
References:
Issue: [1.6] Permanent Delete #28
Milestone: [1] Diagnose (Project Setup)
2. Introduction & Goals
Problem Summary: Creators need the ability to permanently remove archived projects from the system. This requires explicit confirmation to prevent accidental data loss.
Goals:
Implement hard-delete for archived projects only
Require explicit confirmation (type "DELETE" or project name)
Remove all associated data (DB + Storage)
Cascade delete to related records
Non-Goals:
Permanent delete of active projects (must archive first)
Undo/recovery after permanent delete
Batch permanent delete
Glossary:
Hard Delete: Irreversible database removal
Cascade Delete: Automatic deletion of related records via FK constraints
3. High-Level Architecture
System Diagram:

Technologies Used:
Server Actions - Delete logic
Supabase - Database + Storage
Shadcn AlertDialog - Confirmation modal
4. Detailed Design & Implementation
Data Model / Schema: Cascade deletions and storage cleanup:
Table | Relationship | Action |
|---|---|---|
| FK to | CASCADE |
| FK to | CASCADE |
| FK to | CASCADE |
| FK to | CASCADE |
Storage buckets: quest-assets ({questId}/*), thumbnails ({questId}.*)
API Specification:
DELETE /api/creator/permanent-delete- Hard delete archived questRequest body:
questId(UUID, required),confirmation(string, required - must match "DELETE" or project title)
Logic & Workflows: Delete flow:
Click "Delete Forever" - Opens modal
Type confirmation - Must match "DELETE" or title
Click confirm - Only enabled when valid
Delete storage files -
quest-assets,thumbnailsDelete DB record - Cascades to related tables
UI refresh - Removed from Trash
Key Files:
app/api/creator/(content)/permanent-delete/route.ts- Delete APIcomponents/creator/PermanentDeleteDialog.tsx- Confirmation UI
5. Infrastructure & Operations
Dependencies:
Supabase DB - Record deletion
Supabase Storage - File cleanup
Monitoring & Alerting: Track permanent deletes in logs for audit. No alerts (user-initiated action).
Deployment Plan:
Ensure FK CASCADE constraints exist
Deploy API and UI
Test storage cleanup
6. Testing & Quality Assurance
Test Strategy:
Manual: Full delete flow, confirmation
Integration: Cascade verification, storage cleanup
Known Limitations:
Cannot delete active projects (archive first)
No recovery after permanent delete
Storage cleanup is best-effort (may leave orphans on error)
7. Maintenance & Support
Troubleshooting:
"Only archived" error → Must archive before deleting
"Confirmation mismatch" → Type exactly "DELETE" or title
Orphaned storage files → Manual cleanup via Supabase dashboard
Changelog:
1.0 (Feb 2026): Initial implementation
Document Version
1.0 - Approved, Feature deployed to production, 02/23/2026