Microservices Explained



The figure below shows the main components composing Lelylan.


Request Life Cycle

Follow the request life cycle describing what happens when a user applies an action (e.g. turns on a light, opens a car, unlocks a bike) from the mobile app.

API Block

The API block takes the HTTP request and forwards it to the correct microservice.


  • 1) The Web App fires an HTTP request (API call).
  • 2) The API proxy receives the HTTP request.
  • 3) The API proxy forwards the request to the Devices API.
  • 4) The "device update" event is added to the Event Bus.

The device is now pending (waiting for the physical world to apply the desired changes).

Physical Block

The Physical block takes the "device update" event and forwards it to the physical device.


  • 5) The Physical Proxy is notified about the "device update" event.
  • 6) The Physical Proxy forwards the request to the MQTT Node.
  • 7) The MQTT Node sends a MQTT message to the physical device.
  • 8) The physical device apply the desired changes and sends back a confirmation message.
  • 9) The MQTT node add the "physical device update" event to the Event Bus.

At this point the device is not pending anymore and the request is satisfied (the light is on).

notice In this example we used MQTT as communication protocol, but any existing device (e.g. Nest, Lifx ) can talk with Lelylan by adding a specific Node.

Realtime Block

The realtime block notifies the web about the physical world changes.


  • 10) The WebSockets and WebHooksmicroservices are notified in realtime about the "physical device update" event.
  • 11) The Websocket notifies the web app about the action being successfully applied.
  • 12) The Webhooks notifies third party services about the action being successfully applied.

At this point the physical device changed its status and a notification is sent to the web app.

Why Microservices

Successful Internet of Things applications grow more complex over time, and that complexity creates many challenges in development. A monolith application that becomes larger, a single code base that contains all of application logic, where all programmers are involved and where over time it’s difficult for larger team to operate.This approach is perhaps the most natural as a single codebase reduces distribution complexities, but in the long complexities raise up and decreasing software quality and making prices and time to market higher.

Microservices architecture is not a new style for building large scale enterprise applications. Companies like Netflix and Amazon have implemented microservices architecture to deliver successful products over the last few years. Lelylan brings these ideas into the Internet of Things.