Magic Portal
Overview
Section titled “Overview”The Magic Portal (portal.magiceverse.online) is the central management hub for the entire Magic e-VERSE ecosystem. Built with Vite + React frontend and Express backend, it integrates tenant management, documentation, CRM, support, and infrastructure monitoring into a single interface.
Location: /mnt/data/magic_omniverse/magic_portal/
Architecture
Section titled “Architecture”Frontend: React 19 + Vite 7 + TypeScriptBackend: Express 4.18 (server.cjs, ~3,500 lines)Frontend: Single App.tsx (~6,500 lines)Database: MySQL (magic_doc) + PostgreSQL (3 pools: magic_b2b_brinxx, magic_b2b_development, master_magic)Port: 4096Features
Section titled “Features”Tenant Management
Section titled “Tenant Management”- Deploy projects to multiple tenants simultaneously
- Sequential multi-tenant backend/storefront rebuild with progress tracking
- Deployment history and release tracking
- Docker-based infrastructure control
Documentation System
Section titled “Documentation System”- Multi-category documentation with full-text search
- Markdown rendering with Mermaid diagram support
- System updates and security alerts (severity levels: critical, high, medium, low)
- Release notes and version tracking
Support System
Section titled “Support System”- Support ticket lifecycle (open, in_progress, waiting_customer, waiting_internal, resolved, closed)
- Comments and activity logging
- Staff assignment and categories
- Knowledge base articles
CRM Lead Manager
Section titled “CRM Lead Manager”- Lead pipeline (new, contacted, qualified, proposal, negotiation, won, lost, churned)
- Activity tracking (calls, meetings, emails)
- Task management with due dates
- Priority levels (hot, warm, cold)
IP Gatekeeper
Section titled “IP Gatekeeper”- IP whitelist management
- Access request approval workflow
- Email-based activation links
- Expiration dates for IP entries
Infrastructure Monitoring
Section titled “Infrastructure Monitoring”- Port registry with service categorization
- Asset management with health status
- Nginx URLs overview (grouped by category)
Admin Panel
Section titled “Admin Panel”- User management with roles (admin, developer, client)
- Project access control per user
- Client management
- Email invitations with temporary passwords
Authentication
Section titled “Authentication”- User submits email + password
- Server validates against MySQL
userstable (bcrypt hashed) - IP check against PostgreSQL
ip_whitelist - If IP not whitelisted: 2FA via WhatsApp (6-digit OTP, 5-min expiry)
- Session created with 30-day expiration
- First login forces password change if
must_change_password=1
Database Tables
Section titled “Database Tables”MySQL (magic_doc):
users— Portal users with rolesportal_clients— Client organizationsportal_projects— Projects per clientportal_user_permissions— Access control matrixportal_support_tickets— Support ticketsportal_tenant_deployments— Deployment historydocuments— Documentation articlessystem_updates— Security/feature updates
PostgreSQL (3 separate database pools via 172.17.0.1:5432):
pgPool — magic_b2b_brinxx (Gatekeeper / IP whitelist):
ip_whitelist— IP whitelist entries
pgDevPool — magic_b2b_development (Releases / Dev Projects):
dev_projects— Development project trackingdev_project_releases— Release history
pgMasterPool — master_magic (CRM):
crm_leads— CRM lead datacrm_lead_activities— Lead interaction historycrm_lead_tasks— Lead-related tasks
API Endpoints
Section titled “API Endpoints”Authentication
Section titled “Authentication”| Method | Endpoint | Purpose |
|---|---|---|
| POST | /api/auth/login | User login |
| POST | /api/auth/verify-2fa | 2FA verification |
| POST | /api/auth/logout | Session termination |
| GET | /api/auth/check | Check auth status |
| POST | /api/auth/change-password | Change password (also for forced change on first login) |
Customer Dashboard
Section titled “Customer Dashboard”| Method | Endpoint | Purpose |
|---|---|---|
| GET | /api/customer-dashboard | Customer-facing dashboard data |
System Updates
Section titled “System Updates”| Method | Endpoint | Purpose |
|---|---|---|
| GET | /api/updates | List system updates and alerts |
Tenant Management
Section titled “Tenant Management”| Method | Endpoint | Purpose |
|---|---|---|
| GET | /api/tenant/tenants | List tenants |
| POST | /api/tenant/deploy-project | Deploy projects |
| POST | /api/tenant/rebuild | Start rebuild job |
| GET | /api/tenant/rebuild/:jobId | Poll rebuild status |
| Method | Endpoint | Purpose |
|---|---|---|
| GET/POST | /api/crm/leads | Lead CRUD |
| POST | /api/crm/leads/:id/activities | Log activity |
| POST | /api/crm/leads/:id/tasks | Create task |
| GET | /api/crm/stats | CRM statistics |
Gatekeeper
Section titled “Gatekeeper”| Method | Endpoint | Purpose |
|---|---|---|
| GET | /api/gatekeeper/my-ip | Current IP detection |
| POST | /api/gatekeeper/whitelist | Add IP |
| GET | /api/gatekeeper/requests | Access requests |
| POST | /api/gatekeeper/requests/:id/approve | Approve request |