DEV Community

Cover image for A fast, persistent Meshtastic web app - part 1
Solve Computer Science
Solve Computer Science

Posted on

A fast, persistent Meshtastic web app - part 1

🤔 Intro

I love picking up new things and using what I learn to solve real-world problems. If you don't know Meshtastic, it is a LoRa (Long Range) radio messaging system that uses inexpensive boards (ESP32, nRF52, etc...). It's all license free so you don't have to be ham radio operator to use it. Messages are all packet-based and can travel several km (even hundreds) depending on antennas, terrain conditions, etc... all with tiny output power involved.

LoRa topology

Note: the picture is directly taken from their docs, GPLv3 license

Like the name implies, the network created is a mesh type. Each element in the network is called a node, and what they can also do is to relay messages, i.e. re-transmit them. This extends the packet range a lot. I think this picture will give you a good idea on how it works:

Max hops

Note: the picture is directly taken from their docs, GPLv3 license

There are public and private channels determined by crypto keys.

Lots of other things could be said about Meshtastic but I want to concentrate this post on what the title states.

📱 Apps

Meshtastic has an Android and iOS app, a web UI, APIs, etc. The Android app works quite well. The web UI is different: it's ephemeral, which means that if you refresh the page you are going to lose the messages which have already been downloaded from the board. The boards, in-fact, can only store a certain number of messages due to their limited memory and once the limit is reached it's overwritten. I like to think of this as a circular array.

Anyway, I have to say this app is improving lately and there are alternatives, but I wanted to learn more about Meshtastic, FastAPI, Svelte and SQLModel, so I am trying to implement one myself.

🖥️ fastmeshapi

fastmeshapi is a project that involves several components:

Dependency name Notes
Meshtastic has a Python API
FastAPI it is the core component
SQLModel a database ORM based on SQLAlchemy
Svelte provides the JavaScript frontend
SvelteStrap provides Bootstrap elements as convenient Svelte components

There are also other minor dependencies which I'm importing along the way but these are the most important ones.

A subset of the API endpoints

A subset of the API endpoints. There are 43 at the moment of writing this post.

The purpose is to build a persistent, high performance Meshtastic web app that provides a REST API as well.

This first video shows you the initial version of the dashboard and some of the FastAPI endpoints.

Subscribe on YouTube

Let me know in the comments if you already know Meshtastic or if you'd like to try it in the future.

Top comments (0)