sojorn/sojorn_docs/TODO.md
Patrick Britton 38653f5854 Sojorn Backend Finalization & Cleanup - Complete Migration from Supabase
##  Phase 1: Critical Feature Completion (Beacon Voting)
- Add VouchBeacon, ReportBeacon, RemoveBeaconVote methods to PostRepository
- Implement beacon voting HTTP handlers with confidence score calculations
- Register new beacon routes: /beacons/:id/vouch, /beacons/:id/report, /beacons/:id/vouch (DELETE)
- Auto-flag beacons at 5+ reports, confidence scoring (0.5 base + 0.1 per vouch)

##  Phase 2: Feed Logic & Post Distribution Integrity
- Verify unified feed logic supports all content types (Standard, Quips, Beacons)
- Ensure proper distribution: Profile Feed + Main/Home Feed for followers
- Beacon Map integration for location-based content
- Video content filtering for Quips feed

##  Phase 3: The Notification System
- Create comprehensive NotificationService with FCM integration
- Add CreateNotification method to NotificationRepository
- Implement smart deep linking: beacon_map, quip_feed, main_feed
- Trigger notifications for beacon interactions and cross-post comments
- Push notification logic with proper content type detection

##  Phase 4: The Great Supabase Purge
- Delete function_proxy.go and remove /functions/:name route
- Remove SupabaseURL, SupabaseKey from config.go
- Remove SupabaseID field from User model
- Clean all Supabase imports and dependencies
- Sanitize codebase of legacy Supabase references

##  Phase 5: Flutter Frontend Integration
- Implement vouchBeacon(), reportBeacon(), removeBeaconVote() in ApiService
- Replace TODO delay in video_comments_sheet.dart with actual publishComment call
- Fix compilation errors (named parameters, orphaned child properties)
- Complete frontend integration with Go API endpoints

##  Additional Improvements
- Fix compilation errors in threaded_comment_widget.dart (orphaned child property)
- Update video_comments_sheet.dart to use proper named parameters
- Comprehensive error handling and validation
- Production-ready notification system with deep linking

##  Migration Status: 100% Complete
- Backend: Fully migrated from Supabase to custom Go/Gin API
- Frontend: Integrated with new Go endpoints
- Notifications: Complete FCM integration with smart routing
- Database: Clean of all Supabase dependencies
- Features: All functionality preserved and enhanced

Ready for VPS deployment and production testing!
2026-01-30 09:24:31 -06:00

8.8 KiB

Sojorn Development TODO List

Last Updated: January 30, 2026
Status: Ready for 100% Go Backend Migration
Estimated Effort: ~12 hours total


🎯 High Priority Tasks (Critical for 100% Go Backend)

1. Implement Beacon Voting Endpoints

Location: go-backend/internal/handlers/post_handler.go
Status: Not Started
Effort: 2 hours

Tasks:

  • Add VouchBeacon handler method
  • Add ReportBeacon handler method
  • Add RemoveBeaconVote handler method
  • Implement database operations for beacon votes
  • Add proper error handling and validation

Implementation Details:

func (h *PostHandler) VouchBeacon(c *gin.Context) {
    // Get user ID from context
    // Get beacon ID from params
    // Check if user already voted
    // Add vote to database
    // Update beacon confidence score
    // Return success response
}

2. Add Beacon Voting Routes

Location: go-backend/cmd/api/main.go
Status: Not Started
Effort: 30 minutes

Tasks:

  • Add POST /beacons/:id/vouch route
  • Add POST /beacons/:id/report route
  • Add DELETE /beacons/:id/vouch route
  • Ensure proper middleware (auth, rate limiting)

Routes to Add:

authorized.POST("/beacons/:id/vouch", postHandler.VouchBeacon)
authorized.POST("/beacons/:id/report", postHandler.ReportBeacon)
authorized.DELETE("/beacons/:id/vouch", postHandler.RemoveBeaconVote)

3. Update Flutter Beacon API

Location: sojorn_app/lib/services/api_service.dart
Status: Not Started
Effort: 1 hour

Tasks:

  • Replace empty vouchBeacon() method
  • Replace empty reportBeacon() method
  • Replace empty removeBeaconVote() method
  • Add proper error handling
  • Update method signatures to match Go API

Current State:

// These methods are empty stubs that need implementation:
Future<void> vouchBeacon(String beaconId) async {
  // Migrate to Go API - EMPTY STUB
}

Future<void> reportBeacon(String beaconId) async {
  // Migrate to Go API - EMPTY STUB
}

Future<void> removeBeaconVote(String beaconId) async {
  // Migrate to Go API - EMPTY STUB
}

⚠️ Medium Priority Tasks (Cleanup & Technical Debt)

4. Remove Supabase Function Proxy

Location: go-backend/internal/handlers/function_proxy.go
Status: Not Started
Effort: 1 hour

Tasks:

  • Delete function_proxy.go file
  • Remove function proxy handler instantiation
  • Remove /functions/:name route from main.go
  • Remove related environment variables
  • Test that no functionality is broken

Files to Remove:

  • go-backend/internal/handlers/function_proxy.go
  • go-backend/cmd/supabase-migrate/ (entire directory)

5. Clean Up Supabase Dependencies

Location: Multiple files
Status: Not Started
Effort: 2 hours

Tasks:

  • Remove SupabaseID field from internal/models/user.go
  • Remove Supabase environment variables from .env.example
  • Update configuration struct in internal/config/config.go
  • Remove any remaining Supabase imports
  • Update middleware comments that reference Supabase

Environment Variables to Remove:

# SUPABASE_URL
# SUPABASE_KEY  
# SUPABASE_SERVICE_ROLE_KEY

6. Update Outdated TODO Comments

Location: sojorn_app/lib/services/api_service.dart
Status: Not Started
Effort: 30 minutes

Tasks:

  • Remove comment "Beacon voting still Supabase RPC or migrate?"
  • Remove comment "Summary didn't mention beacon voting endpoint"
  • Update any other misleading Supabase references
  • Ensure all comments reflect current Go backend state

7. End-to-End Testing

Location: Entire application
Status: Not Started
Effort: 2 hours

Tasks:

  • Test beacon voting flow end-to-end
  • Verify all core features work without Supabase
  • Test media uploads to R2
  • Test E2EE chat functionality
  • Test push notifications
  • Performance testing
  • Security verification

🔧 Low Priority Tasks (UI Polish & Code Cleanup)

8. Fix Video Comments TODO

Location: sojorn_app/lib/widgets/video_comments_sheet.dart
Status: Not Started
Effort: 1 hour

Tasks:

  • Replace simulated API call with real publishComment() call
  • Remove "TODO: Implement actual comment posting" comment
  • Test comment posting functionality
  • Ensure proper error handling

Current State:

// TODO: Implement actual comment posting
await Future.delayed(const Duration(seconds: 1)); // Simulate API call

Should Become:

await ApiService.instance.publishComment(postId: widget.postId, body: comment);

9. Implement Comment Reply Features

Location: sojorn_app/lib/widgets/threaded_comment_widget.dart
Status: Not Started
Effort: 2 hours

Tasks:

  • Implement actual reply submission in _submitReply()
  • Add reply UI components
  • Connect to backend reply API
  • Remove "TODO: Implement actual reply submission" comment

10. Add Post Options Menu

Location: sojorn_app/lib/widgets/post_with_video_widget.dart
Status: Not Started
Effort: 1 hour

Tasks:

  • Implement post options menu functionality
  • Add menu items (edit, delete, report, etc.)
  • Remove "TODO: Show post options" comment
  • Connect to backend APIs

11. Fix Profile Navigation

Location: sojorn_app/lib/widgets/sojorn_rich_text.dart
Status: Not Started
Effort: 1 hour

Tasks:

  • Implement profile navigation from mentions
  • Remove "TODO: Implement profile navigation" comment
  • Add proper navigation logic
  • Test mention navigation

12. Clean Up Debug Code

Location: sojorn_app/lib/services/simple_e2ee_service.dart
Status: Not Started
Effort: 1 hour

Tasks:

  • Remove _FORCE_KEY_ROTATION debug flag
  • Remove debug print statements
  • Remove force reset methods for 208-bit key bug
  • Clean up any remaining debug code

Already Completed Features (For Reference)

Core Functionality

  • User authentication (JWT-based)
  • Post creation, editing, deletion
  • Feed and post retrieval
  • Image/video uploads to R2
  • Comment system (fully implemented)
  • Follow/unfollow system
  • E2EE chat (X3DH implementation)
  • Push notifications (FCM)
  • Search functionality
  • Categories and user settings
  • Chain posts functionality

Infrastructure

  • Go backend API with all core endpoints
  • PostgreSQL database with proper schema
  • Cloudflare R2 integration for media
  • Nginx reverse proxy
  • SSL/TLS configuration
  • Systemd service management

📊 Current Status Analysis

What's Working Better Than Expected

  • Comment System: Fully implemented with Go backend (TODO was outdated)
  • Media Uploads: Direct to R2, no Supabase dependency
  • Chain Posts: Complete implementation
  • E2EE Chat: Production-ready X3DH system

What Actually Needs Work

  • Beacon Voting: Only 3 missing endpoints (core feature)
  • Supabase Cleanup: Mostly removing legacy code
  • UI Polish: Fixing outdated TODO comments

Key Insight

The codebase is 90% complete for Go backend migration. Most TODO comments are outdated and refer to features that are already implemented. The beacon voting system is the only critical missing piece.


🚀 Implementation Plan

Day 1: Beacon Voting (4 hours)

  1. Implement beacon voting handlers (2h)
  2. Add API routes (30m)
  3. Update Flutter API methods (1h)
  4. Test beacon voting flow (30m)

Day 2: Supabase Cleanup (3 hours)

  1. Remove function proxy (1h)
  2. Clean up dependencies (2h)

Day 3: UI Polish (3 hours)

  1. Fix video comments TODO (1h)
  2. Implement reply features (2h)

Day 4: Final Polish & Testing (2 hours)

  1. Add post options menu (1h)
  2. End-to-end testing (1h)

🎯 Success Criteria

100% Go Backend Functionality

  • All features work without Supabase
  • Beacon voting system operational
  • No Supabase code or dependencies
  • All TODO comments resolved or updated
  • End-to-end testing passes

Code Quality

  • No debug code in production
  • No outdated comments
  • Clean, maintainable code
  • Proper error handling
  • Security best practices

📝 Notes

  • Most TODO comments are outdated - features are already implemented
  • Beacon voting is the only critical missing feature
  • Supabase cleanup is mostly removing legacy code
  • UI polish items are nice-to-have, not blocking

Total estimated effort: ~12 hours to reach 100% Go backend functionality


Next Steps: Start with high-priority beacon voting implementation, as it's the only critical missing feature for complete Go backend functionality.