Enterprise Real-Time Microservices Architecture
A high-availability, zero-trust, multi-cluster real-time application ecosystem designed for fault tolerance, sub-second telemetry streaming, and defense-in-depth security.
1. Core End-to-End System Components
The core application stack provides bidirectional communication between desktop endpoints and a real-time web portal, handling data ingestion, local caching, state distribution, and persistent relational storage[cite: 1].

- WPF Desktop Client (.NET 8 C#): Binds to local network adapters (`192.168.x.x`) to poll peripheral status[cite: 1]. Maintains an outbound Secure WebSocket connection bypassing NAT/firewalls[cite: 1]. Utilizes an embedded LiteDB/SQLite buffer for offline message retention and Serilog for local structured JSON logging[cite: 1].
- WSS & Nginx Edge Proxy Cluster: Handles full-duplex WSS communication with exponential backoff with randomized jitter to prevent thundering herd socket overload[cite: 1]. Nginx manages TLS 1.3 termination, rate-limiting, and `Upgrade: websocket` HTTP header proxies[cite: 1].
- Node.js Gateway & Distributed Adapter: Uses Socket.io backended by `@socket.io/redis-adapter` over Redis Sentinel to sync realtime events across Kubernetes pods[cite: 1]. All incoming payloads are validated via strict Zod schemas and JWT cryptographic signatures[cite: 1].
- MS SQL Server 2022 Schema Strategy: Stores normalized metadata combined with `NVARCHAR(MAX)` JSON columns for dynamic time-series telemetry[cite: 1]. Core tables include `dbo.Devices`, `dbo.DeviceTelemetry`, `dbo.CommandsQueue`, `dbo.ServiceLogs`, `dbo.UserSessions`, and `dbo.SystemAuditLogs`[cite: 1].
- Next.js 14 Web Portal: Serves as the administrative UI, providing live device tracking dashboards, remote socket command dispatches, and integrated cross-service log inspection[cite: 1].
2. Infrastructure, DevOps & Unified Logging
The platform utilizes GitOps, automated container supply chain security, and centralized log aggregation to ensure predictable deployments and rapid incident diagnostics[cite: 1].

Automated CI/CD & GitOps
Pipelines enforce automated security scans via Trivy/Snyk, sign Docker images, run SSDT database schema migrations, and sync state via ArgoCD[cite: 1]. Secrets are injected dynamically using HashiCorp Vault[cite: 1].
Distributed Logging Pipeline
Combines Serilog, Filebeat, Winston, and SQL Extended Events through Vector into Grafana Loki, giving engineers unified single-click lookup via shared `TraceID` tokens[cite: 1].
Container Monitoring Stack
Minimal Alpine-based Docker containers running on K8s with HPA[cite: 1]. Scraped continuously by Prometheus with custom Grafana Alertmanager triggers for queries exceeding 500ms or memory spikes[cite: 1].
3. High-Availability Multi-Cluster Topology
Designed for active-active redundancy across two independent geographic regions to eliminate single points of failure[cite: 1].

| Component | Region A Execution | Region B Execution |
|---|---|---|
| Traffic Routing | Global Anycast DNS routes client connections dynamically based on health and lowest latency[cite: 1]. | |
| Compute & Mesh | Active Kubernetes Cluster running Node.js microservices under Istio service mesh[cite: 1]. | Active Kubernetes Cluster running identical Node.js deployments ready for instant failover traffic[cite: 1]. |
| MS SQL AlwaysOn AG | Primary Replica handling synchronous write operations[cite: 1]. | Read-Scale Secondary Replica synced via Distributed Availability Groups (RPO=0, RTO < 10s)[cite: 1]. |
4. Multi-Layer Security & Defense-in-Depth Model
Security is enforced across 5 distinct boundary zones to safeguard client devices, transport networks, runtime microservices, and persistent storage[cite: 1].

Zone 1: Global Edge WAF & DDoS Protection
Absorbs volumetric SYN/UDP floods at L3/L4 and enforces L7 WAF rules against SQLi, XSS, and payload tampering[cite: 1].
Zone 2: DMZ Gateway & Rate Limiting
Enforces geographic access limits, IP whitelists, and connection creation caps to mitigate socket exhaustion attacks[cite: 1].
Zone 3: Microservice & Service Mesh Security
Mandates mutual TLS (mTLS) for pod-to-pod network traffic using Istio/Cilium alongside strict K8s Network Policies[cite: 1].
Zone 4: Data Persistence Encryption
Secures storage with Transparent Data Encryption (TDE) on MS SQL 2022 and mandates TLS 1.3 for active driver connection pools[cite: 1].
Zone 5: SIEM Auditing & Endpoint Security
Streams security traces directly to SIEM systems (e.g., Azure Sentinel) and protects client machines via active EDR agent monitoring[cite: 1].
This project demonstrates an enterprise solution for mission-critical real-time applications where zero downtime, rapid telemetry response times, and high security are core requirements.