Skip to main content

Magistrala features in detail

Magistrala (SuperMQ) uses a microservices architecture designed for scalability and layered security. The following sections describe its core components and how they work.

1. User​

New Magistrala users do not automatically have access to domains. Access is managed as follows:

  • Invitations: A domain administrator invites users and assigns their roles. Common roles include Administrator, Editor, Viewer, and Member.
  • Invitees: Administrators can invite existing Magistrala users or new users by email.
  • Acceptance: After creating an account, users can accept a domain invitation.
  • Domain creation: Every Magistrala user can create a domain.
  • Default permissions: The creator becomes that domain's Administrator.

Note: There is currently no default way to limit how many domains, channels, or clients a user creates. The billing service may limit channels and clients within a domain, but this feature is incomplete and has no API yet.

2. Domain​

A domain is the highest level of the multi-tenant architecture. It creates an isolated boundary for data and resources.

  • Purpose: Separates customers or large projects. All clients, channels, and groups within a domain belong to that domain.
  • Scale: A SuperMQ system can host thousands of domains without mixing their data.

3. Member & Role​

This layer manages users and permissions.

  • Domain member: A user assigned to a domain. One user can belong to multiple domains.
  • Role: Defines permissions through SpiceDB using relationship-based access control.
    • Administrator: Full domain management permissions.
    • Editor/Viewer: More limited edit or read permissions. The default system currently centers on the admin role; editor and viewer require additional customization.

Note: Permissions can be set at both the domain and group levels. Domain roles have the broadest control over devices. Group roles are currently less clearly defined because domain roles cover most actions.

4. Invitation​

Invitations provide a controlled way to add domain members.

  • Purpose: An administrator sends an invitation, usually by email or token, to another user.
  • Process: Invitations have states such as Pending, Accepted, and Rescinded. Once accepted, the system creates the SpiceDB relationship that grants domain access.

5. Group​

Groups organize clients and channels by hierarchy or business purpose.

  • Purpose: Group devices by location, such as floors, or by function, such as sensors and actuators.
  • Permissions: A user can be given access to one group instead of the entire domain.

Note: A group can contain many clients and channels, but a client or channel can belong to only one group at a time. Direct sharing between groups is unavailable; the rule engine can forward data between them.

6. Client​

In Magistrala, a Client (formerly called a Thing) represents any entity connected to the system.

  • Purpose: It may be a hardware device, such as a sensor, or a software application.
  • Identity: Each client has a unique ID and Key for authentication over MQTT, HTTP, or CoAP.

7. Channel​

A channel carries messages between clients.

  • Purpose: Connects clients. To exchange messages, the clients involved must be connected to the same channel.
  • Security: A valid client key alone is insufficient; messages are blocked if the client is not connected to the channel.

8. Message​

A message is the raw data moving through the system.

  • Format: Often follows SenML to normalize data from different sensor types.
  • Flow: Client -> Adapter (MQTT/HTTP) -> Message Broker (NATS/RabbitMQ) -> Writer (Postgres/InfluxDB).

Note: To store and query message data, create a rule that writes channel data to the internal database. Queries can filter by field, time, device, protocol, data name, and more.

9. Alarm & Report​

This layer processes stored data.

  • Alarm: Monitors live data. For example, a temperature above 50°C can trigger an alarm state.
  • Report: Aggregates Postgres or InfluxDB data by day, week, or month and exports charts or PDF/CSV files for trend analysis.

10. Rule Engine​

The rule engine automates responses to events.

  • Purpose: Defines “if–then” logic.
  • Example: If a temperature sensor exceeds 30°C, send an air-conditioning command to a control channel.
  • Structure: Usually includes a Source (incoming message), Filter/Logic (condition), and Action (such as sending email, calling a webhook, or publishing an MQTT message).