Skip to content

Magic Monitor (Tenant Pulse)

Magic Monitor is the platform control plane dashboard at monitor.magicomniverse.online. It provides real-time monitoring of all Magic e-VERSE tenants, containers, orders, products, and system health.

Frontend

React + Vite + Tailwind v4 + shadcn/ui

Backend

Express + TypeScript + PostgreSQL

Hosting

Coolify on 159.195.68.41

Repo

midego1/Magic-Monitor

ViewDescription
OverviewStat cards, platform trends (24h), tenant pulse grid
Error LogLive error feed with severity filters, CSV export
EventsPlatform events timeline
Audit LogUser action tracking
CompareSide-by-side tenant comparison
ContainersAll 55+ Coolify resources with status (via Coolify API)
UsersUser management per tenant
PIM ProductsProduct counts across tenants
APLT OrdersOrders, quotations, invoices, revenue across all tenants
SettingsAlerting config (Slack, WhatsApp), Coolify API settings
Browser → https://monitor.magicomniverse.online
Coolify Proxy (Traefik)
Docker Container (Node.js)
├── Express API (port 3000)
│ ├── /api/tenants → polls all tenant backends
│ ├── /api/metrics → aggregated platform metrics
│ ├── /api/containers → Coolify API (http://coolify:8080)
│ ├── /api/aplt/overview → queries tenant PostgreSQL databases
│ ├── /api/pim/stats → product counts per tenant
│ └── /api/settings → app configuration
└── Static Frontend (Vite build)
└── React SPA with shadcn/ui components
  • Coolify API access: The container reaches Coolify via Docker internal DNS at http://coolify:8080 (internal port). The URL is stored in the settings DB table as coolify_api_url and takes priority over the COOLIFY_API_URL env var.
  • Tenant databases: The monitor connects to each tenant’s PostgreSQL database (on magic_pim_postgres_dev) to query APLT tables directly.
  • CSS: Uses Tailwind v4 with @theme block for CSS variables. Global resets MUST be inside @layer base or they override Tailwind utilities (CSS cascade layers).
Magic-Monitor/
├── .github/workflows/
│ ├── deploy.yml # Auto-deploy to Coolify on push to main
│ └── pr-preview.yml # Preview deploy + PR comment on PRs
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ │ ├── ui/ # shadcn/ui components (card, button, badge, etc.)
│ │ │ ├── App.tsx # Main layout (header, sidebar, views)
│ │ │ ├── StatusBar.tsx
│ │ │ ├── TenantCard.tsx
│ │ │ ├── PlatformCharts.tsx
│ │ │ └── ...
│ │ ├── styles.css # Tailwind v4 @theme + @layer base
│ │ └── types/
│ └── package.json
├── src/
│ ├── server.ts # Express server
│ ├── db/ # PostgreSQL connection + schema
│ ├── routes/ # API routes
│ │ ├── tenants.ts
│ │ ├── metrics.ts
│ │ ├── containers.ts # Coolify API proxy
│ │ ├── aplt.ts # APLT orders/quotations/invoices
│ │ ├── pim.ts # PIM product stats
│ │ ├── settings.ts
│ │ └── users.ts
│ └── alerts/ # Slack + WhatsApp notifications
├── Dockerfile # Multi-stage build (frontend + backend)
└── package.json

All Magic repos follow this workflow:

feature/xyz → PR → development → PR → main (production)
BranchPurposeProtection
mainProduction. Auto-deploys to Coolify.PR required, no direct push, no force push
developmentIntegration branch.Open for direct push
feature/*Feature/bug branches.None

deploy.yml — Triggers on push to main:

  • Calls Coolify API GET /api/v1/deploy?uuid={APP_UUID} to trigger a production deploy
  • Uses secrets: COOLIFY_API_URL, COOLIFY_APP_UUID, COOLIFY_API_TOKEN

pr-preview.yml — Triggers on PR open/push:

  • Deploys the PR branch via Coolify API
  • Waits up to 3 minutes for deploy to finish
  • Posts a status comment on the PR with preview URL and deploy info
  • Cleans up old bot comments on subsequent pushes
SettingValue
App UUIDhwwmonk4o0vyy43qw04hsm5x
Server159.195.68.41
Coolify APIhttp://159.195.68.41:8000 (external) / http://coolify:8080 (Docker internal)
FQDNhttps://monitor.magicomniverse.online
Preview URL template{{pr_id}}.{{domain}}pr-1.monitor.magicomniverse.online
Git branchmain
BuildDockerfile (multi-stage, ~90-120s)
Terminal window
curl -s -X GET \
"http://159.195.68.41:8000/api/v1/deploy?uuid=hwwmonk4o0vyy43qw04hsm5x" \
-H "Authorization: Bearer $COOLIFY_API_TOKEN"

Cleaned up the Coolify server from 89 to 55 containers:

ActionCount
Orphaned sslip.io duplicates deleted28
Duplicate production containers deleted (same FQDN, older deploy)6
sslip.io domains replaced with .internal on Redis/internal services11
Total removed34
  • Containers with *.magicomniverse.online domains = production, never delete
  • Containers with *.sslip.io domains that have a production counterpart = orphan, safe to delete
  • Redis instances with sslip.io but no production counterpart = only instance, keep (domain changed to .internal)
  • exited:unhealthy containers = dead, safe to delete
  • Duplicate production FQDNs = older created_at is the orphan

These services use .internal domains (not publicly routable, just Coolify metadata):

ServiceDomain
bovisales-redishttp://bovisales-redis.internal
desluis-redishttp://desluis-redis.internal
logohorloge-redishttp://logohorloge-redis.internal
jodasign-redishttp://jodasign-redis.internal
spranz-redishttp://spranz-redis.internal
redis-masterhttp://redis-master.internal
redis-defaulthttp://redis-default.internal
redis-demohttp://redis-demo.internal
redis-developmenthttp://redis-development.internal
toolvizion-redishttp://toolvizion-redis.internal
webhook-serverhttp://webhook-server.internal
TokenValueUsage
background#09090bPage background (darkest)
card#18181bCard backgrounds (clearly lighter)
secondary#111113Sidebar, header
border#2e2e33Visible card borders
muted#27272aDisabled/muted backgrounds
primary#8b5cf6Purple accent
foreground#fafafaText
muted-foreground#a1a1aaSecondary text

Located in frontend/src/components/ui/. All use Radix UI primitives + CVA + cn() utility. Components: button, card, badge, dialog, select, input, table, tabs, scroll-area, skeleton, switch, dropdown-menu, separator, label, avatar.

Currently PR previews deploy to the same production URL. For true isolated previews (pr-1.monitor.magicomniverse.online):

  1. Open Coolify UI at http://159.195.68.41:8000

    • Login: admin@magicomniverse.online / <your-db-password>
  2. Link Magic Monitor to the GitHub App

    • Go to Applications → magic-monitor → General/Source
    • Change source from “Public GitHub” to “magic-everse-coolify” (GitHub App, id=3)
    • Save
  3. Enable Preview Deployments

    • In the same app settings, enable “Preview Deployments”
    • Template is already set: {{pr_id}}.{{domain}}
  4. Update PR workflow

    • Remove the manual Coolify deploy trigger from pr-preview.yml
    • Coolify will auto-deploy previews via GitHub App webhooks
    • The workflow only needs to post the preview URL comment

The Coolify UI at http://159.195.68.41:8000 is only accessible via HTTP on port 8000. The domain coolify.magicomniverse.online returns 503 because no Traefik routing is configured for it. To fix: add Traefik labels to the Coolify container, or access via direct IP.

All 13 Magic repos have been configured with:

  • main branch: protected (PR required, no force push, enforce admins)
  • development branch: created from main
  • Forks (29 repos): left untouched
RepoStatus
Magic-3Ddone
Magic-Connectordone
Magic-Contactdone
Magic-Editordone
Magic-Logodone
Magic-Modaldone
Magic-Monitordone
Magic-Moodshotdone
Magic-PIMdone
Magic-Portaldone
Magic-Resizedone
Magic-Terminaldone
Magic-e-VERSEdone