Architecture Diagram
Three Layers
Transport Layer (Redis Streams)
As of v1.6.4, Redis Streams replace the legacy Pub/Sub channel. Spigot servers write packets withXADD; Nexus Core reads them via a consumer group using XREADGROUP and acknowledges each message with XACK after processing. This guarantees at-least-once delivery: unacknowledged messages are retained across reconnects, and consumer groups allow multiple worker instances to share the load.
Redis also serves as the shared L2 cache and publishes keyspace notifications that Nexus Core uses to keep L1 in-memory caches synchronized.
Nexus Core
The security chain runs first on every inbound packet: HMAC-SHA256 signature verification, a 5-minute timestamp window, and nonce replay detection. After validation, the AddonRegistry dispatches the request to the matching DataAddon by protocol ID. The addon consults the cache hierarchy and performs the required MongoDB operation. All MongoDB and Redis calls are wrapped in Resilience4j Circuit Breakers that trip toOPEN on high error rates, and Exponential Backoff Retry with jitter automatically retries transient failures.
Persistence Layer (Multi-Database)
As of v1.7.0, the persistence layer is abstracted behind a generic database provider interface. MongoDB remains the default adapter; PostgreSQL and MySQL are also supported out of the box. Nexus Core maintains the only connection pool to each configured data source, eliminating per-server connection overhead regardless of how many Spigot instances are running. DataAddons declare their target database and collection (or table). The framework resolves the correct adapter at request time based on the addon’s configuration and routes all serialization transparently. Multiple data sources can run simultaneously — different addons within the same Nexus Core instance can target different databases.Why This Design?
Related Topics
- Request Types — the nine packet types Nexus Core accepts and routes
- Cache Strategy — how L1 in-memory, L2 Redis, and MongoDB interact
- Security — the three-stage packet validation chain