The project (that I called Aurora) is based on:

React + Redux for the Front-End

for the Front-End Node.JS for the Back-End

for the Back-End Espruino for the components (based on ESP8266)

As you can see, there are three main components in this architecture:

Progressive Web App

Here I can switch on/off the lights, share nodes with other people and schedule some events for the future.

Iper-Cool web app

It’s using React and Redux to handle all the state, and this is also saved on LocalStorage. A service worker is caching all the GET requests, so after the first load the app is really fast to open and to interact. And with the last Chrome for Android, you can also install it as a normal app :)

Node.js server

The server it’s where all the information about the nodes, the users and all the interaction between them resides. It’s composed by:

an API to create nodes, set node state (switch on/off, change brightness…), add a user to a node and get info about a user. The authentication is based on a Token strategy.

to create nodes, set node state (switch on/off, change brightness…), add a user to a node and get info about a user. The authentication is based on a Token strategy. A MQTT broker (i’m using Mosca) to connect to the nodes and send/receive state changes.

(i’m using Mosca) to connect to the nodes and send/receive state changes. A Socket.io server , to send to the Web app all the state changes caused by other users or by the server (for example: a scheduled event to turn off a light)

, to send to the Web app all the state changes caused by other users or by the server (for example: a scheduled event to turn off a light) A MongoDB Database: at work i’m a Postgres guy, so I wanted to give Mongo a try :)

The server is really lightweight and I tried to use fewer possible packages and write lots of things by myself.

Nodes

Every node is based on ESP8266, a microcontroller with integrated WI-FI. I found that it is possible to program them with Javascript, using Espruino… and not only plain Javascript, also all the commands from ES2016 are supported!

For now I’m using a NodeMCU and some Sonoff, but you can also buy some other official Espruino boards from their site (I’m really tempted by Puck.js).