Panel Alexamigo
← Memory

crm-alexamigo.md

---
name: crm-alexamigo
description: CRM AlexAmigo - Suite de prospeccion y gestion de clientes SEO
type: reference
---

## CRM AlexAmigo

### Infraestructura
- **VPS path**: `/home/ubuntu/proyectos-cloud/crm-beepeek/`
- **Stack**: Flask (backend) + React/Vite + Tailwind + shadcn/ui (frontend)
- **Service**: `sudo systemctl restart crm-beepeek`
- **Build**: `cd /home/ubuntu/proyectos-cloud/crm-beepeek && npm run build`
- **Frontend dist**: `/home/ubuntu/proyectos-cloud/crm-beepeek/dist/` (servido por Flask catch-all)

### Supabase (proyecto `tqoxpogxvapwsmzgwcdp`)
- **URL**: `https://tqoxpogxvapwsmzgwcdp.supabase.co`
- **Anon Key**: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InRxb3hwb2d4dmFwd3Ntemd3Y2RwIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTEzNzc5MTIsImV4cCI6MjA2Njk1MzkxMn0.jra34DZgIovaD4z2oxJrK4M3G8brBXsFGVoKa5Gr8E8`
- **Service Role Key**: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InRxb3hwb2d4dmFwd3Ntemd3Y2RwIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc1MTM3NzkxMiwiZXhwIjoyMDY2OTUzOTEyfQ.8H2LhbDIxFVr8f3ybczKi98imasO07ohToKKUT7yqSw`
- **DB Password**: `TryqGQ98z8sDgfOk`
- **Connection**: `PGPASSWORD='TryqGQ98z8sDgfOk' psql 'host=db.tqoxpogxvapwsmzgwcdp.supabase.co port=6543 dbname=postgres user=postgres sslmode=require'`
- **NOTA**: Puerto 6543 (no 5432). Solo IPv6, funciona desde VPS.

### Tablas Supabase
- `CRM-alexamigo` — Leads y clientes (company_name, email, stage, tags, detected_urls, notes, audit_id, client_type, hub_client_id, etc.)
- `bee_audit_data` — Datos de auditorias SEO (id, domain, score, technical_data, opportunities)
- `crm_activities_alexamigo` — Log de actividades por cliente (client_id, content, created_at)
- `websites` — Websites auditados (domain, user_id)
- `website_audits` — Auditorias guardadas (website_id, results, score, status)

### Archivos principales
- **Backend**: `/home/ubuntu/proyectos-cloud/crm-beepeek/SEO_Audit/app.py` (Flask, ~820 lineas)
- **Frontend CRM**: `/home/ubuntu/proyectos-cloud/crm-beepeek/src/pages/CRMAlexAmigo.tsx` (~1673 lineas)
- **Config API**: `/home/ubuntu/proyectos-cloud/crm-beepeek/src/config/api.ts` (API_BASE_URL)
- **Supabase client**: `/home/ubuntu/proyectos-cloud/crm-beepeek/src/integrations/supabase/client.ts`
- **.env**: `/home/ubuntu/proyectos-cloud/crm-beepeek/.env` (VITE_SUPABASE_URL, VITE_SUPABASE_PUBLISHABLE_KEY)

### Stages del CRM
- Prospeccion: "Nuevo Lead", "Primer Contacto", "Interesado Futuro", "No Interesa", "Cerrado"
- Clientes: "Cliente", "Cliente Existente"
- Tabs: prospeccion | auditorias | clientes | cerrados

### Hub Integration (abril 2026)
- `client_type` column: "mensual" o "tarea" (tipo de cliente)
- `hub_client_id` column: UUID del hub_client tras sync con Hub Beepeek
- Endpoint: `POST /api/sync-to-hub` — Sincroniza cliente "mensual" con Hub (localhost:3000/api/clients/)
- Internal key Hub: `hub_internal_k3y_portal_2026_Xm9qLw`