Overview
The architecture behind RaspiBuddy is simple. When a user registers a Raspberry Pi, an API, developed in Golang (perfomance reasons mostly), is automatically installed on your Raspberry Pi. Since both your phone and Raspberry Pi are in the same WIFI network, the first can now communicate with the latter via HTTP requests.
Each device is saved in a database in the cloud, thus allowing you retrieve your devices if something happens to your phone (lost, stolen, broken).
Under the hood
The API is composed of multiple end-points that have specific functions. A call on these end-points either retrieves information or execute an action on your device. For instance, the end-point /processes
provide you with the list of actives processes running on your Pi.
[
{
"id": 1,
"name": "systemd",
"cpuPercent": 0.013712795078409872,
"memPercent": 2.114147
},
{
"id": 2,
"name": "kthreadd",
"cpuPercent": 0.00014557106085142873,
"memPercent": 0
},
...
{
"id": 1000,
"name": "mm_percpu_wq",
"cpuPercent": 0,
"memPercent": 0
},
{
"id": 9999,
"name": "ksoftirqd/0",
"cpuPercent": 0.08760465253236992,
"memPercent": 0
}
]
This information is displayed that way in the app: