SiteSwarm Central Command Center (apps/command-center)
SiteSwarm Central Command Center (apps/command-center)
Section titled βSiteSwarm Central Command Center (apps/command-center)βThe unified internal control plane and operational cockpit for SiteSwarm agency staff, platform engineers, and support teams.
apps/command-center provides a single pane of glass across multi-tenant CMS operations, synthetic fleet health, on-call incident escalation, and visitor telemetry without requiring engineers to access disparate client domains or vendor dashboards.
β‘ Architecture & Deployment
Section titled ββ‘ Architecture & DeploymentβThe application is built with Astro SSR and hosted as an edge worker isolate on Cloudflare Workers:
- Edge SSR (
output: "server"): Server-side rendered with dynamic per-request identity evaluation and zero persistent compute overhead. - Cloudflare Workers Adapter: Deployed via
@astrojs/cloudflarewithnodejs_compatcompatibility flags. - Zero Trust Perimeter: Shielded by Cloudflare Zero Trust (Access) enforcing corporate SSO (Google Workspace / GitHub OAuth) and hardware passkeys.
- Cryptographic JWT Guard: Middleware parses and validates
Cf-Access-Jwt-AssertionandCf-Access-Authenticated-User-Emailheaders, enforcing expiration windows and audience/issuer constraints. - Role-Based Access Control (RBAC): Maps authenticated email assertions and identity claims to granular roles (
admin,support,editor) following the ADR-0004 security matrix. - 0ms Service Bindings: Communicates with internal platform workers (
services/cms-service,services/synthetic-monitoring,services/leads-service) with zero public network hops.
π§© Operational Modules
Section titled βπ§© Operational Modulesβapps/command-center organizes platform operations into five core workspaces:
- Mission Control Overview (
/): Consolidated operational cockpit displaying active client fleet status, latency benchmarks, synthetic uptime, and active incidents. - CMS Fleet Studio (
/cms): Unified multi-tenant content management studio with schema form builder, instant Cache-Tag invalidation bridge, and 1-click client admin launchpad. - Fleet Health & Observability (
/health): Abstracted health gateway consuming synthetic pinger probes and streaming real-time edge exceptions from Cloudflare Tail Workers. - Incident Ops & On-Call Center (
/incidents): Live on-call roster, 1-click page triage and acknowledgment, and emergency static maintenance overrides. - Telemetry & Client Analytics (
/analytics): Fleet traffic aggregates, lead conversion pipelines, Core Web Vitals gauges, and dual-surface EmDash plugin metrics.
β¨οΈ Command Palette (Cmd + K)
Section titled ββ¨οΈ Command Palette (Cmd + K)βPressing Cmd + K (or Ctrl + K) triggers the global Command Palette modal powered by React (src/components/CommandPalette.tsx), providing instant keyboard navigation across:
- Operational navigation routes
- Client tenant workspaces (Green Leaf Bakery, Apex Labs, Precision Auto Repair, Portfolio)
- Quick actions (trigger synthetic probes, purge global cache tags)
π File Structure
Section titled βπ File Structureβapps/command-center/βββ astro.config.mjs # Astro SSR + Cloudflare adapter + React + Tailwindβββ package.json # Workspace package (@siteswarm/command-center)βββ tsconfig.json # TypeScript config extending root tsconfig.base.jsonβββ wrangler.jsonc # Cloudflare Workers configuration with nodejs_compatβββ src/β βββ env.d.ts # App.Locals typing (user identity and role context)β βββ middleware.ts # Perimeter authentication middlewareβ βββ lib/β β βββ auth.ts # JWT parsing, assertion verification, and RBAC mappingβ βββ components/β β βββ CommandPalette.tsx # React keyboard command palette (Cmd+K)β βββ layouts/β β βββ DashboardLayout.astro# Shell layout with header, navigation, and role badgeβ βββ pages/β β βββ index.astro # Mission Control overviewβ β βββ cms.astro # CMS Fleet Studioβ β βββ health.astro # Fleet Health & Observabilityβ β βββ incidents.astro # Incident Ops & On-Callβ β βββ analytics.astro # Telemetry & Analytics Explorerβ β βββ api/β β βββ health.ts # Public health check endpointβ βββ styles/β βββ global.css # Tailwind CSS v4 stylingβββ tests/ βββ auth.test.ts # JWT perimeter & RBAC test suite (23 unit tests)π§ͺ Testing & Verification
Section titled βπ§ͺ Testing & VerificationβRun tests and verification:
# Execute unit test suitepnpm --filter @siteswarm/command-center test
# Typecheck and lint Astro templatespnpm --filter @siteswarm/command-center run check
# Build serverless SSR workerpnpm --filter @siteswarm/command-center run build
# Run architectural lintersnpx tsx scripts/arch-lint.tsGoverned under ADR-0004: Central Command Center Architecture.