> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Coreflux MQTT Broker

> Introduction to the Coreflux MQTT Broker - the core component of your IoT platform.

## Why Use the Coreflux MQTT Broker?

Your IoT devices need to communicate with each other and with your applications. Without a central hub, you'd need to manage complex point-to-point connections between every device—impossible to scale and maintain.

<Tip>
  **Think of the broker as a smart post office.** Devices "mail" messages to topics (like addresses), and the broker delivers them to everyone who "subscribed" to that address. No device needs to know who else is listening.
</Tip>

The Coreflux MQTT Broker solves this by providing:

* **Reliable message delivery** between any number of devices
* **Built-in data processing** with LoT (Language of Things)
* **Security and access control** without external services
* **Edge computing** that reduces cloud dependency

***

## How Does an MQTT Broker Work?

An MQTT broker sits at the center of all communication. Instead of devices talking directly to each other, they all talk to the broker—and the broker handles delivery.

```mermaid theme={null}
flowchart TB
    subgraph Publishers
        A[Temperature Sensor]
        B[Pressure Sensor]
        C[Motion Detector]
    end
    subgraph Broker
        D[Coreflux MQTT Broker]
    end
    subgraph Subscribers
        E[Dashboard App]
        F[Alert System]
        G[Database Logger]
    end
    A -->|"PUBLISH sensors/temp"| D
    B -->|"PUBLISH sensors/pressure"| D
    C -->|"PUBLISH sensors/motion"| D
    D -->|"DELIVER"| E
    D -->|"DELIVER"| F
    D -->|"DELIVER"| G
```

### The Publish-Subscribe Pattern

MQTT uses a **publish-subscribe** (pub/sub) model:

1. **Publishers** send messages to **topics** (like `sensors/temperature`)
2. **Subscribers** register interest in topics they care about
3. The **broker** receives all messages and delivers them to matching subscribers

This decouples senders from receivers—a sensor doesn't need to know (or care) who's listening to its data.

### What the Broker Handles

| Function                  | What It Does                                                               |
| ------------------------- | -------------------------------------------------------------------------- |
| **Message Routing**       | Receives messages from publishers, matches topics, delivers to subscribers |
| **Connection Management** | Maintains client connections, handles reconnects, manages session state    |
| **Quality of Service**    | Ensures delivery guarantees (at-most-once, at-least-once, exactly-once)    |
| **Message Retention**     | Optionally stores the last message on a topic for new subscribers          |
| **Security**              | Authenticates clients and enforces access permissions                      |

***

## The Coreflux Advantage

Standard MQTT brokers route messages—that's it. The Coreflux MQTT Broker goes further with **built-in intelligence** using the LoT (Language of Things) runtime:

### Beyond Message Routing

* **[LoT Actions](/lot-language/actions/overview)** — React to messages automatically. When a temperature exceeds a threshold, trigger an alert without external code.

* **[LoT Models](/lot-language/models/overview)** — Transform and structure data in real-time. Convert raw sensor values into formatted JSON with timestamps and metadata.

* **[LoT Routes](/lot-language/routes/overview)** — Connect to external systems. Bridge to other brokers, store data in databases, call REST APIs—all configured in LoT.

* **[LoT Rules](/lot-language/rules/overview)** — Control access with fine-grained permissions. Define who can publish, subscribe, or manage the broker.

### Processing at the Edge

Instead of sending all data to the cloud for processing, the Coreflux broker processes data **where it's generated**:

* **Lower latency** — Local actions execute in milliseconds, no round-trip to the cloud
* **Reduced bandwidth** — Only filtered or aggregated data leaves the edge
* **Offline resilience** — Critical logic keeps running even if the internet drops
* **Stronger privacy** — Sensitive data stays on-premises by default

***

## Key Benefits

<AccordionGroup>
  <Accordion title="Efficient Communication" icon="gauge-high">
    MQTT's lightweight protocol is designed for constrained devices and limited bandwidth. The Coreflux broker optimizes message delivery for challenging network conditions—perfect for industrial environments, remote sites, or battery-powered devices.

    **Coreflux enhancement:** Built-in message compression and intelligent batching reduce bandwidth by up to 70% compared to raw MQTT.
  </Accordion>

  <Accordion title="Security and Access Control" icon="shield-halved">
    IoT security is non-negotiable. The Coreflux broker includes TLS encryption, certificate-based authentication, and username/password auth out of the box.

    **Coreflux enhancement:** LoT Rules provide fine-grained access control—define exactly who can publish, subscribe, or manage each topic pattern.
  </Accordion>

  <Accordion title="Intelligent Data Processing" icon="microchip">
    Raw sensor data is rarely useful as-is. It needs filtering, transformation, and enrichment before applications can use it.

    **Coreflux enhancement:** LoT Models and Actions process data in real-time at the edge. No external ETL pipelines or stream processors required.
  </Accordion>

  <Accordion title="System Integration" icon="plug">
    IoT systems don't exist in isolation. They connect to databases, APIs, dashboards, and other brokers.

    **Coreflux enhancement:** LoT Routes provide native integration with SQL databases, REST APIs, industrial protocols (Modbus, OPC-UA, S7), and other MQTT brokers.
  </Accordion>
</AccordionGroup>

***

## Coreflux MQTT Broker as a Platform

The Coreflux MQTT Broker is more than a message router — it is a complete IoT platform running at the edge:

| Layer              | What You Get                                                                                                     |
| ------------------ | ---------------------------------------------------------------------------------------------------------------- |
| **MQTT Messaging** | Reliable pub/sub communication with QoS guarantees, session management, and retained messages                    |
| **Security**       | TLS encryption, client authentication, and fine-grained topic-level access control via LoT Rules                 |
| **LoT Runtime**    | Built-in automation, data transformation, external integrations, and access policies — no external code required |
| **Administration** | Configuration, logging, metrics, and maintenance through MQTT-native management topics                           |

***

## Next Steps

<CardGroup cols={2}>
  <Card title="MQTT Protocol" icon="book" href="/mqtt-broker/protocol">
    Learn the fundamentals of MQTT messaging.
  </Card>

  <Card title="Installation Guide" icon="rocket" href="/quick-start/installation">
    Install and configure your Coreflux broker.
  </Card>
</CardGroup>
