4.0.51 • Published 4 years ago

@gbaranski/types v4.0.51

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Control-Home

code-coverage status build-status website-status server-status github-stars

Home automation platform for IoT devices like ESP8266 and ESP32, most of it is built on Typescript and C++

Documentation

The documentation is divided into several sections:

  1. Components of project
  2. Communication and data transmission

Components of project

Backend infrastructure

Server and infrastructure recently had a huge refactor. Now the backend is build in microservice style, previosly monolithic. I keep working on scalability and CI/CD. The backend splits into following microservices: 1. API Server, atm used only for giving tokens to IoT devices. Built using expressJS, Node.JS, Typescript. 2. Websocket server at client side, handles communication with web and mobile(soon) communication. Built using ws library, Node.JS and typescript. 3. Websocket server at device side, communicates with IoT devices. Built using same as service above. 4. Redis, for connecting device and client microservices together, implemented with Pub-Sub pattern. 5. Docker holding all those things up.

Node.JS Server, whole code is in Typescript, main purpose of this server is handling websocket connections incoming from embedded devices and Web App and also Mobile App.

Web App

Web app made using React front-end framework, whole code is in Typescript. Currently this is the most developed part of project alongisde Node.JS Server. App has moved from Material-UI, to antd

Mobile App

Mobile app made using React-Native which is framework for mobile apps which allows to write in Typescript. It needs full refactoring, but thinking about switching to flutter.

Embedded devices

Embedded devices, microcontrollers i used were ESP8266 and ESP32, those are modules with WiFi, and they are quite powerfull. I was using Arduino framework, and C++ languague, thought about C and ESP-IDF but it would take me months. |Name|Microcontroller|Description| |---|---|---| |Alarmclock|ESP32|Just an alarmclock, but with LCD and loud siren to wake me up| |Watermixer|ESP8266|Switches a relay which activates mixing hot and cold water|

Alarmclock

Firestore database

Project is using Firestore database for storing devices, users and etc

Firebase FCM

Firebase cloud messaging, currently used only for mobile app, but in future I expect to use it also for Web App

Project types

Types for Typescript, helps a lot with planning, and having cohesion between project components.

Communication and data transmission

Most of the communication and data transmission is done by WebSocket. Previously it was fully on HTTP, but with HTTP there is one problem, I needed two-way communication to properly receive data from devices, and send to them.

FromToType
Web/Mobile ClientServerClient.Request
ServerWeb/Mobile ClientClient.Response
EmbeddedServerDevice.RequestDevice
ServerEmbeddedDevice.ResponseDevice

Security

Embedded devices security

Devices for the first step make POST HTTP Request to /api/getToken with secret key and token, to the server, that returns them signed JWT Token, with this token he sends upgrade HTTP request to server with headers that contains this JWT Token, then server veryfies that and if okay let him go.

Web/Mobile Client

Web/Mobile clients are authenticated a little bit different, clients can log in via Google/Email and if they do, they can get authenticated by generating JWT token from Firebase and then sending it with websocket handshake.

Websocket Diagram

Here will be diagram soon

4.0.51

4 years ago

4.0.50

4 years ago

4.0.49

4 years ago

4.0.48

4 years ago

4.0.47

4 years ago

4.0.46

4 years ago

4.0.45

4 years ago

4.0.44

4 years ago

4.0.43

4 years ago

4.0.42

4 years ago

4.0.41

4 years ago

4.0.40

4 years ago

4.0.39

4 years ago

4.0.38

4 years ago

4.0.36

4 years ago

4.0.35

4 years ago

4.0.34

4 years ago

4.0.33

4 years ago

4.0.32

4 years ago

4.0.31

4 years ago

4.0.30

4 years ago

4.0.29

4 years ago

4.0.27

4 years ago

4.0.26

4 years ago

4.0.28

4 years ago

4.0.23

4 years ago

4.0.25

4 years ago

4.0.24

4 years ago

4.0.22

4 years ago

4.0.21

4 years ago

4.0.19

4 years ago

4.0.20

4 years ago

4.0.18

4 years ago

4.0.17

4 years ago

4.0.16

4 years ago

4.0.14

4 years ago

4.0.13

4 years ago

4.0.12

4 years ago

4.0.11

4 years ago

4.0.10

4 years ago

4.0.9

4 years ago

4.0.8

4 years ago

4.0.7

4 years ago

4.0.6

4 years ago

4.0.5

4 years ago

4.0.4

4 years ago

4.0.3

4 years ago

4.0.2

4 years ago

3.1.10

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.1.9

4 years ago

3.1.8

4 years ago

3.0.8

4 years ago

3.0.9

4 years ago

3.1.3

4 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.1.7

4 years ago

3.1.6

4 years ago

3.1.5

4 years ago

3.1.4

4 years ago

3.0.7

4 years ago

3.0.4

4 years ago

3.0.6

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

2.2.2

4 years ago

3.0.0

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.0.10

4 years ago

2.1.0

4 years ago

2.0.9

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago