Portal API Connections
Connected Services
Section titled “Connected Services”The Magic Portal acts as the central hub connecting to all other ecosystem services:
┌──────────────────┐ │ Magic Portal │ │ (port 4096) │ └────────┬─────────┘ │ ┌───────────────────┼───────────────────┐ │ │ │ ┌────▼────┐ ┌─────▼──────┐ ┌────▼────┐ │ MySQL │ │ PostgreSQL │ │ Tenants │ │ :3306 │ │172.17.0.1 │ │ :40XX │ │magic_doc│ │ :5432 │ │ (x9) │ └─────────┘ │ 3 pools: │ └─────────┘ │ brinxx(gk) │ │ dev(proj) │ │ master(crm)│ └────────────┘Database Connections
Section titled “Database Connections”MySQL (Primary Portal DB)
Section titled “MySQL (Primary Portal DB)”- Host:
172.17.0.1:3306(Docker host gateway) - Database:
magic_doc - Used for: Users, sessions, projects, support tickets, documentation, deployments
- Key tables:
users,portal_clients,portal_projects,portal_user_permissions,portal_support_tickets,portal_tenant_deployments,documents,system_updates,portal_sessions,portal_2fa_tokens,portal_invites
PostgreSQL (3 Database Pools)
Section titled “PostgreSQL (3 Database Pools)”- Host:
172.17.0.1:5432(Docker host gateway) - Connections use 3 separate pools to different databases:
| Pool | Database | Used for |
|---|---|---|
pgPool | magic_b2b_brinxx | Gatekeeper / IP whitelist (ip_whitelist) |
pgDevPool | magic_b2b_development | Releases, dev-projects |
pgMasterPool | master_magic | CRM leads, lead activities, lead tasks |
External API Integrations
Section titled “External API Integrations”WhatsApp 2FA
Section titled “WhatsApp 2FA”- API: Facebook Graph API
- Template:
magiceverse_2tfa - Purpose: Send 6-digit OTP codes for portal login
- Expiry: 5 minutes
Tenant Backends
Section titled “Tenant Backends”- Portal connects to each tenant’s Docker Compose for rebuild operations
- Executes
docker compose buildanddocker compose up -dcommands - Polls rebuild status via job IDs
OnlyOffice
Section titled “OnlyOffice”- URL:
office.magiceverse.online(port 8581) - Purpose: Real-time document editing for project files
- JWT: Authenticated with shared secret
N8N Workflow Automation
Section titled “N8N Workflow Automation”- Instance 1:
n8n.magiceverse.online(port 8090) - Instance 2:
n8n2.magiceverse.online(port 8091) - Instance 3:
n8n3.magiceverse.online(port 8092)
Nginx Routing
Section titled “Nginx Routing”The portal is served via Nginx reverse proxy:
# Portal main applicationportal.magiceverse.online → localhost:4096
# API routesportal.magiceverse.online/api/ → localhost:4096/api/
# Tenant portal (separate app)portal.magiceverse.online/tenant/ → localhost:4090
# Public endpoints (no auth required)portal.magiceverse.online/api/activate/portal.magiceverse.online/api/gatekeeper/requestSession Management
Section titled “Session Management”- Store: MySQL
portal_sessionstable - Cookie:
magic_portal_sid - TTL: 30 days
- Cleanup: Old sessions purged every 15 minutes
- Security: httpOnly cookies, session-based authentication