User-facing transparency page with data management controls
Add a dedicated /privacy/ page accessible from the hamburger sidebar menu (all users) and the guest dropdown menu. The page shows how Habla Hermano protects user data and gives authenticated users controls to delete conversation history or their entire account.
- Build user trust by surfacing the security infrastructure that already exists (Fernet encryption, RLS, no data selling)
- Highlight that the project is open source
- Give authenticated users self-service data management (delete history, delete account)
- Legal privacy policy or terms of service (this is a learning project, not a commercial product)
- Data export functionality
- Granular per-thread or per-conversation deletion (already handled in the thread sidebar)
- Cookie consent banners or GDPR compliance flows
New link in thread_sidebar.html bottom nav section, between "Progress" and "Theme":
Lessons
Progress
Privacy & Security ← NEW (shield icon)
Theme
Logout
New link in app_header.html guest dropdown, between "Free Chat" and the divider before themes:
Lessons
Progress
Free Chat
Privacy & Security ← NEW (shield icon)
---
Theme options...
---
Login
Route: GET /privacy/
Template: src/templates/privacy.html (extends base.html)
Pattern: Same as progress.html — header with back-to-chat link, scrollable content area.
Card grid (responsive: 1 col mobile, 2 col desktop). Each card has an icon, title, and 1-2 sentence description.
| Card | Icon | Title | Description |
|---|---|---|---|
| 1 | Lock/shield | Encrypted at rest | Your conversations and personal data are encrypted using AES-128 (Fernet). |
| 2 | Users/isolate | Data isolation | Your data is isolated at the database level with row-level security. No user can access another user's data. |
| 3 | X-circle | No data selling | We never sell, share, or monetize your learning data. Your conversations exist to help you learn, nothing else. |
| 4 | Code/github | Open source | Habla Hermano is fully open source. You can inspect every line of code that handles your data. |
Card 4 includes a link to the GitHub repository.
Single card with:
- Delete conversation history button (accent-colored, not red)
- Inline confirmation: "This will permanently delete all your conversations. This cannot be undone." with Confirm (red) / Cancel buttons
- On success: toast/flash message, redirect to
/
Single card with:
- Delete my account button (red/danger styled)
- Two-step confirmation: first click reveals a text input where user must type "DELETE" to confirm
- On success: clears auth cookies, redirects to
/with a flash message
When not authenticated, sections B and C are replaced with:
"Log in to manage your data and account." [Log in] button
router = APIRouter(prefix="/privacy")
GET / → render privacy.html
POST /delete-history → delete all user threads + checkpoint data
POST /delete-account → delete Supabase auth user (cascades all data)- Accepts
OptionalUserDep(works for both guests and authenticated users) - Renders
privacy.htmlwithusercontext variable
- Requires authentication (return 401 if not authenticated)
- Requires CSRF header (
HX-Request: true) - Deletes all rows from
conversation_threadswhereuser_id = auth.uid() - Deletes all checkpoint data for threads matching
user:{user_id}:*pattern - Returns redirect to
/on success
- Requires authentication
- Requires CSRF header
- Validates that request body contains
confirm=DELETE - Calls Supabase admin API to delete the auth user
- All user data cascades via
ON DELETE CASCADEforeign keys - Clears auth cookies
- Returns redirect to
/on success
- Both destructive endpoints require authentication + CSRF headers
- Delete account requires explicit typed confirmation ("DELETE")
- Delete history uses inline confirm/cancel (consistent with thread delete pattern in sidebar)
- No data is returned in responses — just redirects
- Rate limiting applies via existing middleware
| File | Action |
|---|---|
src/templates/privacy.html |
Create — new page template |
src/api/routes/privacy.py |
Create — new route file |
src/api/routes/__init__.py |
Modify — register privacy router |
src/templates/partials/thread_sidebar.html |
Modify — add Privacy & Security nav link |
src/templates/partials/app_header.html |
Modify — add Privacy & Security to guest dropdown |
Uses existing design system: bg-surface, bg-surface-elevated, border-border, text-text, text-text-muted, bg-accent, text-accent-text, rounded-2xl, etc. No new CSS or design tokens needed.
Danger buttons use bg-red-500/15 text-red-500 for the delete account action (consistent with thread delete styling in sidebar).