TL;DR: A commercial or industrial IoT system has five layers: devices that sense and act, gateways that bridge local protocols to the network, a message broker (very often MQTT), cloud or on-premises services that store and process the data, and the dashboards and applications people actually use. Most failures are not in the sensors. They come from weak device identity, no reliable way to update firmware, flat networks, unclear data models and running costs nobody modelled. Use a unique credential per device, plan over-the-air (OTA) updates from day one, segment the network, and check your product against recognised baselines such as ETSI EN 303 645, NIST IR 8259A and, for industrial control systems, IEC 62443. If you sell connected products in the EU, the Cyber Resilience Act's reporting obligations already apply from 11 September 2026.
The reference architecture
Whatever the use case, from cold-chain monitoring to machine utilisation or building energy, the same layers appear.
1. Devices
Sensors and actuators, usually on a microcontroller or a small Linux board. They measure (temperature, vibration, current, position) or act (open a valve, switch a relay). Constraints shape everything: power budget, memory, radio range and the environment they must survive. Decide early which devices are battery-powered, because that dictates how often they can transmit and how updates can be delivered.
2. Gateways and the edge
Many field devices do not speak internet protocols. They use fieldbuses and local protocols such as Modbus, BACnet or short-range radio. A gateway collects their data, translates it, buffers it when the uplink drops and forwards it upstream. Gateways are also where local processing happens: filtering, aggregation, and increasingly running AI models close to the machine (see our guide to edge AI and computer vision).
3. Messaging: why MQTT is the default
MQTT is an OASIS standard messaging protocol for IoT, described by its maintainers as an extremely lightweight publish/subscribe transport for connecting remote devices with a small code footprint and minimal network bandwidth. MQTT 5.0 was approved as an OASIS Standard on 7 March 2019. Devices publish messages to named topics on a broker; applications subscribe to the topics they care about. Neither side needs to know about the other, which is what makes the architecture scale.
Features worth understanding before you design topics:
- Quality of Service. The specification defines three levels: at most once (QoS 0), at least once (QoS 1) and exactly once (QoS 2). Higher levels add round trips. Many telemetry streams are fine at QoS 0 or 1; commands and billing-relevant events usually deserve more care, and "at least once" means your consumers must handle duplicates.
- Retained messages let a new subscriber immediately receive the last known value on a topic, which is useful for device state.
- Will messages let the broker announce that a device disconnected unexpectedly.
- Session expiry and shared subscriptions (MQTT 5.0) help with intermittent devices and with spreading load across several consumers.
- Ports. IANA registers port 1883 for MQTT and 8883 for secure MQTT (MQTT over TLS). Use 8883, with TLS, for anything that leaves a trusted network.
MQTT deliberately does not dictate topic names or payload formats. In industrial settings, the Eclipse Foundation's Sparkplug specification fills that gap with a defined topic namespace, payload encoding and device state management on top of MQTT; Sparkplug 3.0 was published as the international standard ISO/IEC 20237:2023. Whether or not you adopt Sparkplug, write down your topic hierarchy and payload schema before the first device ships. Renaming topics across a deployed fleet is painful.
If your application tier is Laravel, our open-source Laravel MQTT package provides publish/subscribe messaging between your backend and devices.
4. Ingestion, storage and processing
Behind the broker, a service validates incoming messages, maps them to known devices and stores them. Telemetry is time-series data, so plan for a store that handles high write rates and time-range queries well, plus a relational database for devices, sites, customers and configuration. Rules and alerts run here: thresholds, missing-data detection, escalation. Keep raw data for a defined period so you can reprocess it when your logic changes.
5. Dashboards and applications
This is the layer users judge the whole system by: live views, history, alerts, reports and maintenance workflows, on web and mobile. Design it around decisions ("which freezer needs attention now?") rather than around every sensor value you collect. When the data model is good, a digital twin can later be built on the same plumbing.
Security: the three things that matter most
Recognised baselines agree on the essentials. ETSI EN 303 645 (V3.1.3, September 2024), the European baseline for consumer IoT, opens with "No universal default passwords", "Implement a means to manage reports of vulnerabilities" and "Keep software updated". NIST's IR 8259A sets out a core baseline of six device capabilities: device identification, device configuration, data protection, logical access to interfaces, software update and cybersecurity state awareness. Commercial and industrial deployments should treat these as a minimum.
Device identity
Every device needs its own identity and credential. Shared passwords or a single key baked into all firmware mean that one extracted device compromises the fleet. X.509 client certificates with mutual TLS are the common pattern. AWS's IoT documentation, for example, recommends giving each device a unique certificate so that individual devices can be managed and revoked, and notes that with certificates the private key never has to leave the device. Plan how certificates are provisioned at manufacture or installation, how they are rotated before expiry, and how a lost or stolen device is revoked.
Over-the-air updates
You will ship firmware with bugs and vulnerabilities; the question is whether you can fix them. A sound OTA design includes signed firmware images verified by the device before installation, a way to roll back if the new image fails to boot, staged rollouts (a few devices first), and reporting of which version each device runs. ETSI EN 303 645 also requires manufacturers to publish the defined support period during which updates will be provided, a commitment worth deciding consciously rather than by default.
Network segmentation
Devices should not sit on the same flat network as office laptops and servers. Put them in their own segments, allow only the connections they need (typically outbound to the broker), and block everything else. For industrial automation and control systems, IEC 62443-3-2 formalises this as partitioning the system into zones and conduits, assessing risk for each, and setting a target security level per zone. Even if you never certify against it, the zone-and-conduit way of thinking is a good discipline.
The rest of the baseline
- Encrypt data in transit (TLS) and protect secrets stored on the device.
- Disable debug interfaces and unused services before shipping.
- Validate every input, including messages from your own devices.
- Monitor for anomalies: devices that suddenly send far more data, connect at odd times or report unexpected firmware versions.
- Publish a vulnerability disclosure contact and process.
Regulation: the EU Cyber Resilience Act
If you place connected hardware or software on the EU market, the Cyber Resilience Act (Regulation (EU) 2024/2847) applies. It entered into force on 10 December 2024; its reporting obligations apply from 11 September 2026 and its main obligations from 11 December 2027. It requires security to be addressed from design through maintenance, and vulnerabilities to be handled over the product's lifetime. Check with legal counsel how it applies to your product.
Costs and how to think about them
Prices vary too much by region, volume and vendor for a generic figure to be useful, so model your own. The cost lines that are most often underestimated:
- Connectivity, per device per month, multiplied by fleet size and lifetime. Message frequency and payload size drive it.
- Cloud services: broker connections and messages, storage that grows every day, and query costs on dashboards.
- Installation and maintenance: site visits, battery replacements, broken sensors, recalibration.
- Software maintenance: firmware updates, security patches, certificate rotation and dashboard changes for the whole support period you commit to.
- Integration with ERP, maintenance and billing systems, which is often where the business value is actually realised.
Run the numbers for the fleet you expect in year three, not the pilot. A design that is cheap for 50 devices can be expensive for 5,000 if every device reports every second.
Common pitfalls
- Pilot purgatory. A proof of concept that works on a bench but has no plan for provisioning, updates or support at scale.
- No data model. Topics and payloads invented per device type, with units and timestamps that disagree.
- Clock and timezone errors. Use UTC timestamps from a synchronised source, and record when the device measured, not only when the server received.
- Ignoring offline behaviour. Decide what devices and gateways do when the network drops: buffer, how much, and in what order to send when it returns.
- Collecting everything. More data means more cost and more to protect. Collect what supports a decision.
- Security as a phase. Identity, updates and segmentation are expensive to add after devices are in the field.
How ApexlyTech can help
We build the software side of IoT end to end: device messaging and MQTT integration, ingestion and storage, alerting, dashboards and mobile apps, and integration with the systems you already run. See our IoT solutions and cloud solutions services, explore the Smart Health Ecosystem for an example of edge telemetry connected to mobile response, or contact us to discuss your project.
Frequently asked questions
Why is MQTT so widely used for IoT?
It is a lightweight, open OASIS standard built on publish/subscribe, so devices with little memory and bandwidth can send data to a broker without knowing who consumes it. It also supports quality-of-service levels, retained messages and last-will notifications that suit unreliable networks.
Which MQTT QoS level should I use?
QoS 0 (at most once) is often enough for frequent telemetry where a lost reading does not matter. QoS 1 (at least once) suits most important events, provided consumers handle duplicates. QoS 2 (exactly once) adds the most overhead and is worth it only where duplicates or losses are genuinely unacceptable.
What is the minimum security baseline for an IoT device?
No shared default passwords, a unique identity per device, encrypted communication, a secure way to update software, minimal exposed interfaces and a process for receiving vulnerability reports. ETSI EN 303 645 and NIST IR 8259A both describe this baseline in more detail.
Do I need a gateway, or can devices connect directly to the cloud?
Devices with IP connectivity and enough resources for TLS can connect directly. You need a gateway when devices use local protocols such as Modbus or BACnet, when you need local buffering or processing, or when you want to keep field devices off the internet entirely.
Does the EU Cyber Resilience Act apply to my IoT product?
It applies to products with digital elements placed on the EU market, with reporting obligations from 11 September 2026 and main obligations from 11 December 2027. Scope and exemptions are specific, so confirm your position with legal advice.
Sources