Skip to content

Portal API Connections

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)│
└────────────┘
  • 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
  • Host: 172.17.0.1:5432 (Docker host gateway)
  • Connections use 3 separate pools to different databases:
PoolDatabaseUsed for
pgPoolmagic_b2b_brinxxGatekeeper / IP whitelist (ip_whitelist)
pgDevPoolmagic_b2b_developmentReleases, dev-projects
pgMasterPoolmaster_magicCRM leads, lead activities, lead tasks
  • API: Facebook Graph API
  • Template: magiceverse_2tfa
  • Purpose: Send 6-digit OTP codes for portal login
  • Expiry: 5 minutes
  • Portal connects to each tenant’s Docker Compose for rebuild operations
  • Executes docker compose build and docker compose up -d commands
  • Polls rebuild status via job IDs
  • URL: office.magiceverse.online (port 8581)
  • Purpose: Real-time document editing for project files
  • JWT: Authenticated with shared secret
  • Instance 1: n8n.magiceverse.online (port 8090)
  • Instance 2: n8n2.magiceverse.online (port 8091)
  • Instance 3: n8n3.magiceverse.online (port 8092)

The portal is served via Nginx reverse proxy:

# Portal main application
portal.magiceverse.online → localhost:4096
# API routes
portal.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/request
  • Store: MySQL portal_sessions table
  • Cookie: magic_portal_sid
  • TTL: 30 days
  • Cleanup: Old sessions purged every 15 minutes
  • Security: httpOnly cookies, session-based authentication