Date: 2025-10-27 Status: ✅ Core Implementation Complete
Successfully migrated ShopCall.ai from Vercel-dependent architecture to Supabase Edge Functions with static hosting capability. This enables deployment on simple web hosting without vendor lock-in.
shopcall.ai-backend-main/api/index.jsCreated two new database tables to replace in-memory storage:
pending_signups table
pendingSignups Mapoauth_nonces table
nonceStore MapDeployed 4 Edge Functions to replace the Vercel backend:
Handles all authentication operations:
POST /auth/signup - Create account with OTP verificationPOST /auth/signup/verify - Verify OTP and complete registrationPOST /auth/signup/resend-otp - Resend OTP emailPOST /auth/login - Email/password authenticationPOST /auth/logout - Sign outGET /auth/check - Validate session tokenChanges from original:
Manages Shopify OAuth integration:
GET /shopify-oauth/init - Initialize OAuth flowGET /shopify-oauth/callback - Handle OAuth callbackChanges from original:
Manages WooCommerce OAuth integration:
GET /woocommerce-oauth/init - Initialize OAuth flow (requires auth)POST /woocommerce-oauth/callback - Handle credentials callbackChanges from original:
Handles Shopify GDPR compliance webhooks:
POST /gdpr-webhooks/customers-data-requestPOST /gdpr-webhooks/customers-redactPOST /gdpr-webhooks/shop-redactChanges from original:
Updated frontend to use Edge Functions:
Environment Variables
.env.example with proper configuration.env with Edge Function URLssrc/lib/config.tsUpdated Components
AuthContext.tsx - Now uses API_URL from configSignup.tsx - Uses Edge Function for signupOTP.tsx - Uses Edge Functions for OTP verification and resendIndex.tsx - Uses Edge Function for Shopify OAuthCallLogsContent.tsx - Uses Edge Function base URLShopRenterConnect.tsx - Uses Edge Function base URLFiles Updated:
src/lib/config.ts
src/components/context/AuthContext.tsx
src/pages/Signup.tsx
src/pages/OTP.tsx
src/pages/Index.tsx
src/components/CallLogsContent.tsx
src/components/ShopRenterConnect.tsx
Created configuration files for various hosting options:
Apache (public/.htaccess)
Nginx (nginx.conf.example)
Created comprehensive documentation:
DEPLOYMENT_GUIDE.md
REFACTORING_SUMMARY.md (this file)
Create Additional Edge Functions (if needed)
/api/dashboard/stats)/api/call-logs)/api/stores)Testing
Email Service Configuration
Security Enhancements
Performance Optimization
Monitoring Setup
ShopRenter Integration
Database Cleanup
Additional Features
Old Backend Base URL:
https://shopcall-ai-backend.vercel.app
New Backend Base URL:
https://ztklqodcdjeqpsvhlpud.supabase.co/functions/v1
| Old Endpoint | New Endpoint |
|---|---|
/auth/signup |
/auth/signup (same path, different base) |
/auth/login |
/auth/login |
/auth/shopify |
/shopify-oauth/init |
/auth/shopify/callback |
/shopify-oauth/callback |
/auth/woocommerce |
/woocommerce-oauth/init |
/auth/woocommerce/callback |
/woocommerce-oauth/callback |
/gdpr/* |
/gdpr-webhooks/* |
/data/shopcall/DEPLOYMENT_GUIDE.md
/data/shopcall/REFACTORING_SUMMARY.md
/data/shopcall/shopcall.ai-main/.env.example
/data/shopcall/shopcall.ai-main/public/.htaccess
/data/shopcall/shopcall.ai-main/nginx.conf.example
/data/shopcall/shopcall.ai-main/.env
/data/shopcall/shopcall.ai-main/src/lib/config.ts
/data/shopcall/shopcall.ai-main/src/components/context/AuthContext.tsx
/data/shopcall/shopcall.ai-main/src/pages/Signup.tsx
/data/shopcall/shopcall.ai-main/src/pages/OTP.tsx
/data/shopcall/shopcall.ai-main/src/pages/Index.tsx
/data/shopcall/shopcall.ai-main/src/components/CallLogsContent.tsx
/data/shopcall/shopcall.ai-main/src/components/ShopRenterConnect.tsx
- pending_signups (with indexes and cleanup function)
- oauth_nonces (with indexes and cleanup function)
1. auth (version 2)
2. shopify-oauth (version 1)
3. woocommerce-oauth (version 1)
4. gdpr-webhooks (version 1)
Refer to the DEPLOYMENT_GUIDE.md for:
The core refactoring is complete! The application has been successfully migrated from Vercel to Supabase Edge Functions with static hosting capability. The next steps involve testing the complete flows and deploying to production.
The architecture is now: