ShopCall.ai Refactoring TODO
Project Goal
Refactor the entire project to remove Vercel dependencies and enable static hosting on simple webhosting. Use Supabase Edge Functions for backend functionality.
Phase 1: Analysis & Planning
Phase 2: Database Migration
Create Supabase database tables to replace in-memory stores
Create pending_signups table (replace pendingSignups Map)
Fields: signup_id, email, password, full_name, company_name, user_name, otp, created_at, expires_at
Create oauth_nonces table (replace nonceStore Map)
Fields: nonce, user_id, platform, shop, app_url, shopname, created_at, expires_at
Add TTL/cleanup mechanism for expired records (cleanup functions created)
Update existing stores table if needed (already has required fields)
Create database migration files (applied via Supabase MCP)
Test database schema with sample data
Phase 3: Supabase Edge Functions Setup
Phase 4: Frontend Refactoring
Phase 5: Backend Cleanup
Phase 6: Deployment & Testing
Phase 7: Documentation
Phase 8: Final Review
Notes
Current Architecture
Frontend : React/Vite at shopcall.ai-main/ (deployed to Vercel)
Backend : Express.js serverless function at shopcall.ai-backend-main/api/index.js (deployed to Vercel)
Database : Supabase PostgreSQL
Authentication : Supabase Auth
Target Architecture
Frontend : Static React build (hosted on simple webhosting)
Backend : Supabase Edge Functions (Deno runtime)
Database : Supabase PostgreSQL (unchanged)
Authentication : Supabase Auth (unchanged)
Key Considerations
Edge Functions use Deno runtime (not Node.js)
Need to replace Nodemailer with Deno-compatible email solution
In-memory stores must move to Supabase database
Frontend needs proper routing configuration for static hosting
Environment variables must be properly managed for static hosting
Dependencies to Replace
❌ Vercel serverless functions → ✅ Supabase Edge Functions
❌ Nodemailer → ✅ Deno-compatible email service (Resend/SendGrid)
❌ In-memory Maps → ✅ Supabase database tables
❌ Hardcoded URLs → ✅ Environment variables
Progress Tracking
Status : ✅ Core Implementation Complete - Testing Phase
Last Updated : 2025-10-27
Current Phase : Phase 6 - Deployment & Testing
Summary of Completed Work
✅ Phase 1: Analysis & Planning - COMPLETE
✅ Phase 2: Database Migration - COMPLETE (testing pending)
✅ Phase 3: Edge Functions Setup - COMPLETE
✅ Phase 4: Frontend Refactoring - COMPLETE (testing pending)
⏭️ Phase 5: Backend Cleanup - SKIPPED (can keep old code for reference)
🔄 Phase 6: Deployment & Testing - IN PROGRESS
✅ Phase 7: Documentation - COMPLETE
⏸️ Phase 8: Final Review - PENDING
What's Ready
Database tables created and configured
4 Edge Functions deployed (auth, shopify-oauth, woocommerce-oauth, gdpr-webhooks)
Frontend updated to use Edge Functions
Static hosting configuration files created
Comprehensive documentation written
What Needs Testing
Next Steps
Configure Resend API key in Supabase
Test authentication flow end-to-end
Test OAuth integrations
Deploy to production hosting
Update OAuth callback URLs in provider settings