Skip to Content
MessageX
02 · Architecture

System architecture

The major services, responsibilities, and communication paths in MessageX.

MessageX is a self-hosted platform composed of a TCP broker, an HTTP management surface, a React dashboard, PostgreSQL persistence, a Node.js SDK, and a Docker launcher.

The broker owns the message path. Application SDKs communicate with it over TCP. The dashboard communicates with the broker's HTTP API. PostgreSQL stores durable broker state and message records.

MessageX system map

Follow each lane from client traffic to persistence and operations.

Interactive · zoom · drag

Conceptual map of the current implementation. Use the linked source files in each guide for exact validation rules and runtime behavior.

Components

ComponentLocation in repositoryResponsibility
TCP serverapps/broker/src/server/tcp.server.tsAccept sockets and route validated commands
Connection layerapps/broker/src/connectionTrack client connections and connection lifecycle
Protocol layerapps/broker/src/protocolFrame encoding/decoding, parsing, schema validation
Command handlersapps/broker/src/commandsCONNECT, AUTH, queue, exchange, publish, consume, ACK/NACK and cancellation
Exchange routingapps/broker/src/routing/routing.tsMatch bindings and select destination queues
Message repositoryapps/broker/src/messages/message.repository.tsPersist, claim, acknowledge, release and recover messages
Consumer managerapps/broker/src/consumers/consumer.manager.tsSubscriptions, dispatch, prefetch and consumer recovery
HTTP serverapps/broker/src/server/http.server.tsDashboard-facing management and health endpoints
Dashboardapps/dashboardBrowser-based broker administration
JavaScript SDKpackages/javascript-sdkNode.js client for the MessageX TCP protocol
Launchermessagex-launcherDocker-based provisioning and service lifecycle

Runtime startup order

The broker entry point in apps/broker/src/server/index.ts:

  1. Connects to PostgreSQL.
  2. Runs database migrations.
  3. Reads host and port configuration.
  4. Starts the HTTP server.
  5. Starts the TCP server.
  6. Schedules periodic expired-delivery recovery.
  7. On shutdown, closes HTTP and TCP listeners, waits for connection cleanup, then closes PostgreSQL.

The Compose deployment sets the broker host to 0.0.0.0 inside its container. The broker source defaults to 127.0.0.1 when HOST is not supplied.

Communication paths

Application messaging

Application → messagex-client → TCP → frame decoder → protocol parser → command handler → routing / queue / consumer logic → PostgreSQL

Broker responses are correlated by requestId. Deliveries are emitted as protocol events.

Dashboard management

Browser → Dashboard → Broker HTTP API

The dashboard is not the TCP client SDK. It uses the broker's HTTP management surface.

Deployment

The launcher manages the container stack through Docker. The repository's Compose file is a separate local-build workflow that defines PostgreSQL, broker, dashboard, and one-shot admin initialization services.

Explore internals

On this page