I performed a comprehensive code analysis of all 92 API endpoints across 11 endpoint files to validate readiness for migrating from HTMX/Alpine to React-only frontend.
47 out of 92 endpoints (51%) still contain HTMX-specific code that returns HTML templates instead of JSON when the HX-Request header is present.
Pattern Found:
async def endpoint(
hx_request: Optional[str] = Header(None), # ← HTMX header check
...
):
if hx_request:
return templates.TemplateResponse("template.html", {...}) # ← HTML response
return {json_data} # ← JSON response- batch.py - 7 endpoints contaminated (all public router endpoints)
- kits.py - 4 endpoints contaminated
- sp404_export.py - 4 endpoints contaminated
- samples.py - 3 endpoints contaminated
- public.py - 3 endpoints contaminated
- preferences.py - 2 endpoints contaminated
- auth.py (2 endpoints)
- usage.py (10 endpoints)
- vibe_search.py (2 endpoints)
- projects.py (2 endpoints)
- collections.py (9 endpoints)
Without fixing these endpoints first:
- React frontend will receive HTML instead of JSON for 47 API calls
- App will crash or show errors
- User workflows will be completely broken
-
Remove all HTMX response logic from 47 endpoints (~3-4 hours)
- Delete
hx_request: Optional[str] = Header(None)parameters - Delete
if hx_request:conditional blocks - Delete all
templates.TemplateResponse()returns - Keep only JSON responses
- Delete
-
Fix database connection issue (~30 minutes)
- Backend currently cannot connect to database
- Prevents runtime testing
-
Create validation tests (~1 hour)
- Automated script to verify all endpoints return JSON
- No HTML responses
-
Test user workflows (~1 hour)
- Verify React app can consume all APIs
- No console errors
Total Time: 4-6 hours before Phase 2 can begin
- PHASE_1_VALIDATION_REPORT.md - Detailed analysis of all 92 endpoints
- PHASE_1_FIX_PLAN.md - Step-by-step fix instructions
- PHASE_1_SUMMARY.md - This file (executive summary)
DO NOT PROCEED TO PHASE 2 until:
- ✅ All 47 contaminated endpoints converted to JSON-only
- ✅ Backend starts successfully
- ✅ Automated tests confirm 100% JSON responses
- ✅ React app tested and working
Migration should be paused until these fixes are complete.
- Review PHASE_1_VALIDATION_REPORT.md for complete endpoint inventory
- Use PHASE_1_FIX_PLAN.md as guide to fix endpoints
- Run validation tests after fixes
- Only then proceed to Phase 2 (removing old UI)
Analysis Date: 2025-11-18 Status: ❌ NOT READY FOR PHASE 2 Blockers: 47 endpoints with dual response logic + database connection issue