import type { TopologyRenderOccupant, TopologyRenderRelationship, } from "./renderPipeline.ts"; export interface OperationalDashboardRecord { id: string; tier: | "edge" | "delivery" | "access" | "application" | "data"; status: "healthy" | "watch" | "degraded"; eyebrow: string; title: string; subtitle: string; summary: string; meta: string[]; details: string[]; upstream: string[]; downstream: string[]; notes: string[]; } export const OPERATIONAL_DASHBOARD_NODES: TopologyRenderOccupant[] = [ { id: "internet-facing-service", label: "Internet-facing Service", subtitle: "Public entry point", icon: "internetFacingService", q: -12, r: 0, href: "#internet-facing-service", variant: "root", size: "root", active: true, selected: true, }, { id: "cdn", label: "CDN", subtitle: "Edge distribution", icon: "cdn", q: -8, r: 0, href: "#cdn", variant: "anchor", size: "lg", }, { id: "load-balancer-a", label: "Load Balancer A", subtitle: "Traffic distribution", icon: "loadBalancer", q: -4, r: -2, href: "#load-balancer-a", variant: "anchor", size: "md", }, { id: "load-balancer-b", label: "Load Balancer B", subtitle: "Traffic distribution", icon: "loadBalancer", q: -6, r: 2, href: "#load-balancer-b", variant: "anchor", size: "md", }, { id: "web-frontend", label: "Web Frontend", subtitle: "Browser surface", icon: "webFrontend", q: 0, r: -4, href: "#web-frontend", variant: "primary", size: "md", }, { id: "mobile-app", label: "Mobile App", subtitle: "Client surface", icon: "mobileApp", q: -4, r: 4, href: "#mobile-app", variant: "primary", size: "md", }, { id: "api-gateway", label: "API Gateway", subtitle: "Request orchestration", icon: "apiGateway", q: 0, r: 0, href: "#api-gateway", variant: "anchor", size: "lg", }, { id: "user-service", label: "User Service", subtitle: "Identity and profile", icon: "userService", q: 4, r: -6, href: "#user-service", variant: "entity", size: "md", }, { id: "order-service", label: "Order Service", subtitle: "Commerce flow", icon: "orderService", q: 2, r: -2, href: "#order-service", variant: "entity", size: "md", }, { id: "payment-service", label: "Payment Service", subtitle: "Transaction processing", icon: "paymentService", q: 0, r: 2, href: "#payment-service", variant: "entity", size: "md", }, { id: "notification-service", label: "Notification Service", subtitle: "Delivery and messaging", icon: "notificationService", q: -2, r: 6, href: "#notification-service", variant: "entity", size: "md", }, { id: "primary-postgresql", label: "Primary PostgreSQL", subtitle: "System of record", icon: "primaryPostgreSQL", q: 8, r: -4, href: "#primary-postgresql", variant: "data", size: "lg", }, { id: "read-only-replica", label: "Read Only Replica", subtitle: "Read scale-out", icon: "readOnlyReplica", q: 6, r: 0, href: "#read-only-replica", variant: "data", size: "md", }, { id: "redis-cache", label: "Redis Cache", subtitle: "Hot data and sessions", icon: "redisCache", q: 4, r: 4, href: "#redis-cache", variant: "reference", size: "md", }, ]; export const OPERATIONAL_DASHBOARD_EDGES: TopologyRenderRelationship[] = [ { from: "internet-facing-service", to: "cdn", active: true }, { from: "cdn", to: "load-balancer-a", active: true }, { from: "cdn", to: "load-balancer-b", active: true }, { from: "load-balancer-a", to: "web-frontend", active: true }, { from: "load-balancer-b", to: "mobile-app", active: true }, { from: "web-frontend", to: "api-gateway", active: true }, { from: "mobile-app", to: "api-gateway", active: true }, { from: "api-gateway", to: "user-service", active: true }, { from: "api-gateway", to: "order-service", active: true }, { from: "api-gateway", to: "payment-service", active: true }, { from: "api-gateway", to: "notification-service", active: true }, { from: "user-service", to: "primary-postgresql", active: true }, { from: "order-service", to: "primary-postgresql", active: true }, { from: "payment-service", to: "primary-postgresql", active: true }, { from: "notification-service", to: "primary-postgresql", active: true }, { from: "primary-postgresql", to: "read-only-replica", active: true }, { from: "user-service", to: "read-only-replica", kind: "parent", state: "idle" }, { from: "order-service", to: "read-only-replica", kind: "parent", state: "idle" }, { from: "payment-service", to: "read-only-replica", kind: "parent", state: "idle" }, { from: "notification-service", to: "read-only-replica", kind: "parent", state: "idle" }, { from: "api-gateway", to: "redis-cache", active: true }, { from: "user-service", to: "redis-cache", active: true }, { from: "order-service", to: "redis-cache", active: true }, { from: "payment-service", to: "redis-cache", active: true }, { from: "notification-service", to: "redis-cache", active: true }, { from: "load-balancer-a", to: "mobile-app", active: true}, { from: "load-balancer-b", to: "web-frontend", active: true} ]; export const OPERATIONAL_DASHBOARD_RECORDS: OperationalDashboardRecord[] = [ { id: "internet-facing-service", tier: "edge", status: "healthy", eyebrow: "Root service", title: "Internet-facing Service", subtitle: "Public entry point inside the CDN boundary", summary: "All user traffic starts here before the request chain is routed toward the delivery and application layers.", meta: ["Tier: edge", "Exposure: public", "Role: root"], details: [ "Owns the first visible surface for the platform.", "Receives traffic only after the CDN and load-balancer layers have admitted it.", "Acts as the dashboard's root node for operator orientation.", ], upstream: ["Users", "Browsers", "Mobile clients"], downstream: ["CDN"], notes: [ "Keep selection here when the operator needs the broadest context.", "This node anchors the rest of the service topology.", ], }, { id: "cdn", tier: "edge", status: "healthy", eyebrow: "Edge layer", title: "CDN", subtitle: "Cache and regional distribution", summary: "Static assets and edge caching absorb the first wave of traffic before requests reach the load balancers.", meta: ["Tier: edge", "Role: cache", "Exposure: public"], details: [ "Shortens round trips for the browser surface.", "Limits unnecessary origin traffic.", "Keeps edge performance visible in the dashboard.", ], upstream: ["Internet-facing Service"], downstream: ["Load Balancer A", "Load Balancer B"], notes: ["If edge latency rises, this is the first node to inspect."], }, { id: "load-balancer-a", tier: "delivery", status: "healthy", eyebrow: "Delivery layer", title: "Load Balancer A", subtitle: "Traffic distribution for the web path", summary: "One of the delivery gates that separates public ingress from the application surfaces.", meta: ["Tier: delivery", "Role: routing", "Exposure: shared"], details: [ "Helps split incoming traffic across application surfaces.", "Keeps the web path readable as a distinct operational node.", ], upstream: ["CDN"], downstream: ["Web Frontend"], notes: ["Used as a sibling to the mobile path balancer."], }, { id: "load-balancer-b", tier: "delivery", status: "healthy", eyebrow: "Delivery layer", title: "Load Balancer B", subtitle: "Traffic distribution for the mobile path", summary: "The matching delivery gate for mobile-facing requests and alternate ingress routes.", meta: ["Tier: delivery", "Role: routing", "Exposure: shared"], details: [ "Keeps mobile ingress independent from the web path.", "Provides a clear node for traffic shaping and failover.", ], upstream: ["CDN"], downstream: ["Mobile App"], notes: ["If mobile ingress changes, this node should stay explicit."], }, { id: "web-frontend", tier: "access", status: "healthy", eyebrow: "Experience surface", title: "Web Frontend", subtitle: "Browser application layer", summary: "The browser-facing surface that talks to the API gateway and exposes the dashboard to desktop users.", meta: ["Tier: access", "Role: frontend", "Platform: web"], details: [ "Consumes gateway APIs for the browser experience.", "Represents the desktop application node in the graph.", ], upstream: ["Load Balancer A"], downstream: ["API Gateway"], notes: ["This node carries the main browser flow."], }, { id: "mobile-app", tier: "access", status: "healthy", eyebrow: "Experience surface", title: "Mobile App", subtitle: "Client application layer", summary: "The mobile entry surface that mirrors the web path but keeps the mobile client explicit in the graph.", meta: ["Tier: access", "Role: client", "Platform: mobile"], details: [ "Uses the same gateway contract as the browser surface.", "Provides the mobile operator path in the dashboard.", ], upstream: ["Load Balancer B"], downstream: ["API Gateway"], notes: ["Keep it visible when mobile-specific issues are being traced."], }, { id: "api-gateway", tier: "application", status: "healthy", eyebrow: "Application gateway", title: "API Gateway", subtitle: "Orchestrates service requests", summary: "The control point that fans requests into the internal service layer and keeps the application graph coherent.", meta: ["Tier: application", "Role: gateway", "Fan-out: services"], details: [ "Receives calls from both the web frontend and the mobile app.", "Routes requests into business services and shared caches.", "Keeps service boundaries explicit for the dashboard.", ], upstream: ["Web Frontend", "Mobile App"], downstream: ["User Service", "Order Service", "Payment Service", "Notification Service", "Redis Cache"], notes: ["If request fan-out changes, the gateway should reflect it first."], }, { id: "user-service", tier: "application", status: "healthy", eyebrow: "Business service", title: "User Service", subtitle: "Identity and profile operations", summary: "Handles user records, profile state, and identity-related workflows.", meta: ["Tier: application", "Role: identity", "Domain: users"], details: [ "Consumes gateway traffic for user-oriented operations.", "Writes to the primary PostgreSQL service and can consult Redis for hot state.", ], upstream: ["API Gateway"], downstream: ["Primary PostgreSQL", "Redis Cache", "Read Only Replica"], notes: ["A core dependency for all authenticated flows."], }, { id: "order-service", tier: "application", status: "healthy", eyebrow: "Business service", title: "Order Service", subtitle: "Commerce workflows", summary: "Owns order creation, lifecycle transitions, and the commerce path through the system.", meta: ["Tier: application", "Role: commerce", "Domain: orders"], details: [ "Consumes gateway traffic for order placement and tracking.", "Persists transactional state into the primary database.", ], upstream: ["API Gateway"], downstream: ["Primary PostgreSQL", "Redis Cache", "Read Only Replica"], notes: ["Watch this node when fulfillment or checkout flows degrade."], }, { id: "payment-service", tier: "application", status: "watch", eyebrow: "Business service", title: "Payment Service", subtitle: "Transaction processing", summary: "Processes payment-related workflows and remains the most sensitive transactional node in the set.", meta: ["Tier: application", "Role: payments", "Domain: money"], details: [ "Receives gateway traffic for payment creation and settlement.", "Relies on the database and cache layers for transactional visibility.", ], upstream: ["API Gateway"], downstream: ["Primary PostgreSQL", "Redis Cache", "Read Only Replica"], notes: ["Flagged watch state by default because of its operational sensitivity."], }, { id: "notification-service", tier: "application", status: "healthy", eyebrow: "Business service", title: "Notification Service", subtitle: "Delivery and messaging", summary: "Handles event-driven notifications and outbound user messages.", meta: ["Tier: application", "Role: messaging", "Domain: notifications"], details: [ "Consumes application events and dispatches outbound notifications.", "Persists relevant state through the database layer when required.", ], upstream: ["API Gateway"], downstream: ["Primary PostgreSQL", "Redis Cache", "Read Only Replica"], notes: ["Useful when message delivery or alerting needs inspection."], }, { id: "primary-postgresql", tier: "data", status: "healthy", eyebrow: "Primary data", title: "Primary PostgreSQL", subtitle: "System of record", summary: "The authoritative relational data store for the platform.", meta: ["Tier: data", "Role: source of truth", "Persistence: primary"], details: [ "Stores the canonical state shared across application services.", "Feeds the read replica and anchors operational consistency.", ], upstream: ["User Service", "Order Service", "Payment Service", "Notification Service"], downstream: ["Read Only Replica"], notes: ["Should remain the clearest data node in the dashboard."], }, { id: "read-only-replica", tier: "data", status: "healthy", eyebrow: "Data replica", title: "Read Only Replica", subtitle: "Read scale-out", summary: "A replica that serves read-heavy paths without taking write traffic.", meta: ["Tier: data", "Role: replica", "Access: read only"], details: [ "Relieves pressure from the primary relational store.", "Keeps read traffic visible without obscuring the system of record.", ], upstream: [ "Primary PostgreSQL", "User Service", "Order Service", "Payment Service", "Notification Service", ], downstream: [], notes: ["Best treated as a supporting data node."], }, { id: "redis-cache", tier: "data", status: "healthy", eyebrow: "Shared cache", title: "Redis Cache", subtitle: "Hot data and sessions", summary: "The low-latency cache that absorbs hot reads, session data, and quick state checks.", meta: ["Tier: data", "Role: cache", "Access: low latency"], details: [ "Supports the gateway and services with fast lookups.", "Should stay visible whenever latency or hot-state behavior matters.", ], upstream: ["API Gateway", "User Service", "Order Service", "Payment Service", "Notification Service"], downstream: [], notes: ["A shared service worth keeping in the middle of the dashboard graph."], }, ]; export const OPERATIONAL_DASHBOARD_RECORDS_BY_ID = Object.fromEntries( OPERATIONAL_DASHBOARD_RECORDS.map((record) => [record.id, record]), ) as Record; export const OPERATIONAL_DASHBOARD_SELECTOR_GROUPS = [ { label: "Edge", options: [ { id: "internet-facing-service", label: "Internet-facing Service", subtitle: "Root entry point" }, { id: "cdn", label: "CDN", subtitle: "Edge distribution" }, ], }, { label: "Delivery", options: [ { id: "load-balancer-a", label: "Load Balancer A", subtitle: "Web ingress" }, { id: "load-balancer-b", label: "Load Balancer B", subtitle: "Mobile ingress" }, ], }, { label: "Access", options: [ { id: "web-frontend", label: "Web Frontend", subtitle: "Browser surface" }, { id: "mobile-app", label: "Mobile App", subtitle: "Client surface" }, ], }, { label: "Application", options: [ { id: "api-gateway", label: "API Gateway", subtitle: "Request fan-out" }, { id: "user-service", label: "User Service", subtitle: "Identity" }, { id: "order-service", label: "Order Service", subtitle: "Commerce" }, { id: "payment-service", label: "Payment Service", subtitle: "Transactions" }, { id: "notification-service", label: "Notification Service", subtitle: "Messaging" }, ], }, { label: "Data", options: [ { id: "primary-postgresql", label: "Primary PostgreSQL", subtitle: "System of record" }, { id: "read-only-replica", label: "Read Only Replica", subtitle: "Read scale-out" }, { id: "redis-cache", label: "Redis Cache", subtitle: "Hot data" }, ], }, ] as const;