This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
ShopCall.ai is a dual-repository application for AI-powered calling system integrated with e-commerce platforms. The project consists of:
/data/shopcall/
├── shopcall.ai-main/ # Frontend application
│ ├── src/
│ │ ├── components/ # React components
│ │ │ ├── context/ # React context providers (AuthContext)
│ │ │ └── ui/ # shadcn-ui component library
│ │ ├── pages/ # Route pages (Dashboard, Login, CallLogs, etc.)
│ │ ├── hooks/ # Custom React hooks
│ │ ├── lib/ # Utility functions
│ │ └── App.tsx # Main application with routing
│ └── package.json
└── shopcall.ai-backend-main/ # Backend API
├── api/
│ └── index.js # Main Express server (950 lines)
├── public/ # Static files
└── package.json
cd shopcall.ai-main
npm install # Install dependencies
npm run dev # Start dev server on port 8080
npm run build # Production build
npm run build:dev # Development build
npm run lint # Run ESLint
npm run preview # Preview production build
cd shopcall.ai-backend-main
npm install # Install dependencies
npm start # Start server (node api/index)
Authentication Flow:
src/components/context/AuthContext.tsx) manages global auth statesession_data/auth/check endpointRouting Structure:
/ (Index) → Landing page
/signup → User registration
/login → User login
/otp → OTP verification
/dashboard (protected) → Main dashboard
/call-logs (protected) → Call history
/analytics (protected) → Analytics dashboard
/webshops (protected) → E-commerce integrations
/phone-numbers (protected) → Phone number management
/ai-config (protected) → AI configuration
/onboarding (protected) → User onboarding flow
/about, /privacy, /terms → Public pages
Component Organization:
src/pages/ handle routingDashboardContent.tsx) contain page logicsrc/components/ui/ are reusable shadcn componentsApp.tsxSingle Server File: All API logic is in api/index.js (~950 lines)
Core Middleware:
/gdpr webhookssecuredSession middleware validates Supabase auth tokensAuthentication Endpoints:
POST /auth/signup - Step 1: Store user data, generate and send OTPPOST /auth/signup/verify - Step 2: Verify OTP and create Supabase userPOST /auth/signup/resend-otp - Resend OTP emailPOST /auth/login - Email/password login via SupabasePOST /auth/logout - Sign outGET /auth/check - Validate bearer tokenE-commerce Integration Endpoints:
GET /auth/shopify - Initialize Shopify OAuth flowGET /auth/shopify/callback - Handle Shopify OAuth callbackGET /auth/woocommerce - Initialize WooCommerce OAuth (requires auth)POST /auth/woocommerce/callback - Handle WooCommerce credentialsWebhook Endpoints (GDPR compliance):
POST /gdpr/customers-data-request - Customer data requestPOST /gdpr/customers-redact - Customer redactionPOST /gdpr/shop-redact - Shop redactionverifyWebhook middlewareOther Endpoints:
GET /health - Health checkKey Functions:
generateOTP() - Creates 6-digit OTPsendOTPEmail(email, otp, userName) - Sends styled verification emailnormalizeShopUrl(shop) - Cleans Shopify URLsisValidShopUrl(shop) - Validates Shopify domain formatprocessWebhook(req, res, topic) - Async webhook processingState Management:
pendingSignups Map - Temporary storage for unverified signups (15 min TTL)nonceStore Map - OAuth state validation (10 min TTL)stores table:
- user_id: UUID (FK to auth.users)
- platform_name: text (e.g., 'shopify', 'woocommerce')
- store_name: text
- store_url: text
- api_key: text
- api_secret: text
- scopes: text[]
- alt_data: jsonb (platform-specific data)
- phone_number: text
- package: text
.env (shopcall.ai-backend-main)# Supabase Configuration
SUPABASE_URL=https://ztklqodcdjeqpsvhlpud.supabase.co
SUPABASE_ANON_KEY=<anon_key>
# URL Configuration
BACKEND_URL=https://shopcall-ai-backend.vercel.app # Backend API base URL
FRONTEND_URL=https://shopcall.ai # Frontend application URL
# OAuth Configuration
SHOPIFY_API_KEY=<shopify_api_key>
SHOPIFY_API_SECRET=<shopify_api_secret>
SHOPRENTER_CLIENT_ID=<shoprenter_client_id>
SHOPRENTER_CLIENT_SECRET=<shoprenter_client_secret>
# Email Configuration
EMAIL_USER=<gmail_address>
EMAIL_PASSWORD=<gmail_app_password>
# Environment
NODE_ENV=production|development
.env (shopcall.ai-main)# Backend API Base URL
VITE_API_URL=https://ztklqodcdjeqpsvhlpud.supabase.co/functions/v1
# Frontend URL (for OAuth callbacks)
VITE_FRONTEND_URL=https://shopcall.ai
Note: See .env.example files in both repositories for complete configuration templates.
Both applications deploy to Vercel:
Backend (vercel.json):
{
"version": 2,
"rewrites": [{ "source": "/(.*)", "destination": "/api" }]
}
/api/index.jshttps://shopcall-ai-backend.vercel.app (configure via BACKEND_URL env var)BACKEND_URL and FRONTEND_URL environment variables in Vercel project settingsFrontend (vercel.json):
{
"rewrites": [{ "source": "/(.*)", "destination": "/" }]
}
https://shopcall.ai (configure via VITE_FRONTEND_URL env var)VITE_API_URL and VITE_FRONTEND_URL environment variables in Vercel project settingsWhen making changes across both repositories:
shopcall.ai-backend-main/api/index.jsshopcall.ai-main/src//auth/* endpoints<PrivateRoute> wrapperapi/index.js with securedSession if auth requiredapi/index.js)pendingSignups, nonceStore) will reset on serverless function cold startsBACKEND_URL, FRONTEND_URL, VITE_API_URL, VITE_FRONTEND_URL)stores tableFrontend uses TypeScript path alias:
@/ → ./src/Example: import { Button } from "@/components/ui/button"