This guide explains how to deploy ShopCall.ai with static hosting and Supabase Edge Functions.
The database migrations have already been applied. The following tables were created:
Stores temporary signup data with OTP for email verification (15-minute expiration).
Stores OAuth state/nonce values for secure OAuth flows (10-minute expiration).
Stores e-commerce platform credentials and configuration.
auth - /functions/v1/auth/*
/auth/signup - Create new user account with OTP/auth/signup/verify - Verify OTP and complete registration/auth/signup/resend-otp - Resend OTP email/auth/login - Email/password login/auth/logout - Sign out/auth/check - Validate session tokenshopify-oauth - /functions/v1/shopify-oauth/*
/shopify-oauth/init - Initialize Shopify OAuth flow/shopify-oauth/callback - Handle Shopify OAuth callbackwoocommerce-oauth - /functions/v1/woocommerce-oauth/*
/woocommerce-oauth/init - Initialize WooCommerce OAuth flow/woocommerce-oauth/callback - Handle WooCommerce callbackgdpr-webhooks - /functions/v1/gdpr-webhooks/*
/gdpr-webhooks/customers-data-request - Handle customer data requests/gdpr-webhooks/customers-redact - Handle customer data redaction/gdpr-webhooks/shop-redact - Handle shop data redactionConfigure these in your Supabase project settings:
# Supabase (automatically available)
SUPABASE_URL=https://YOUR_PROJECT.supabase.co
SUPABASE_ANON_KEY=your_anon_key
# Email Service (Resend)
RESEND_API_KEY=re_YOUR_API_KEY
# Shopify Integration
SHOPIFY_API_KEY=your_shopify_api_key
SHOPIFY_API_SECRET=your_shopify_api_secret
SHOPIFY_REDIRECT_URI=https://YOUR_PROJECT.supabase.co/functions/v1/shopify-oauth/callback
# Frontend URL (for OAuth redirects)
FRONTEND_URL=https://yourdomain.com
# Edge Function Base URL
EDGE_FUNCTION_BASE_URL=https://YOUR_PROJECT.supabase.co/functions/v1
Create or update .env file in shopcall.ai-main/:
# Supabase Configuration
VITE_SUPABASE_URL=https://YOUR_PROJECT.supabase.co
VITE_SUPABASE_ANON_KEY=your_anon_key
# Backend API Base URL (Supabase Edge Functions)
VITE_API_URL=https://YOUR_PROJECT.supabase.co/functions/v1
# Frontend URL (for OAuth callbacks)
VITE_FRONTEND_URL=https://yourdomain.com
cd shopcall.ai-main
npm install
npm run build
This creates a dist/ directory with your static files.
dist/ to your web server (e.g., /var/www/html/)Create .htaccess file in the root directory for SPA routing:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
Enable mod_rewrite:
sudo a2enmod rewrite
sudo systemctl restart apache2
dist/ to your web server (e.g., /var/www/shopcall.ai/)Configure nginx:
server {
listen 80;
server_name yourdomain.com;
root /var/www/shopcall.ai;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
Test and reload:
sudo nginx -t
sudo systemctl reload nginx
cd shopcall.ai-main && npm run buildshopcall.ai-main/distAdd the API key to your Supabase Edge Function secrets:
supabase secrets set RESEND_API_KEY=your_api_key
Verify your sending domain in Resend (recommended for production)
https://yourdomain.comhttps://YOUR_PROJECT.supabase.co/functions/v1/shopify-oauth/callbackhttps://YOUR_PROJECT.supabase.co/functions/v1/gdpr-webhooks/customers-data-requesthttps://YOUR_PROJECT.supabase.co/functions/v1/gdpr-webhooks/customers-redacthttps://YOUR_PROJECT.supabase.co/functions/v1/gdpr-webhooks/shop-redactNo special configuration needed. The OAuth flow is initiated from the dashboard.
# Test signup
curl -X POST https://YOUR_PROJECT.supabase.co/functions/v1/auth/signup \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "testpass123",
"full_name": "Test User",
"company_name": "Test Company",
"user_name": "testuser"
}'
# Test login
curl -X POST https://YOUR_PROJECT.supabase.co/functions/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "testpass123"
}'
/dashboard, /call-logs)Issue: 404 errors on routes when refreshing
.htaccess (Apache) or nginx configuration is properly set up for client-side routingIssue: CORS errors when calling Edge Functions
corsHeaders in each function)Issue: Email not sending
Issue: OAuth callback fails
delete_expired_pending_signups()delete_expired_oauth_nonces().env files to version controlFor issues or questions: