- Rust
- Tauri (windowing and backend)
- Typescript (Frontend)
- Solidjs (Frontend framework)
- Tailwindcss (Styling)
- Vite (Bundler)
- Zustand (State management)
- Biome (Linter, formatter)
- pnpm (Package manager)
Tauri and Rust were used for the application due to their combined strengths in building high-performance, secure, and cross-platform desktop applications. We can build our application for Windows, Mac and Linux
Tauri lets developers use web technoglogies to build frontend, which is extremely helpful since we can create beautiful and accessible designs and iterative over changes extremely fast.
Tauri lets developers use Rust to perform native functionality in an easy, safe and performant way.
The application has two processes running
- The Solidjs frontend
- The Rust backend
Both processes communicate with each other using two different ways
The application uses a combination of both of the them to communicate with serial ports.
Whenever the /protected/weight-service/
route is opened in the application. The frontend invokes a command in the backend (emit_weight_on_port
) with the port and baud rate saved in the application settings store. The backend tries to open a connection with that port and baud rate
if it fails, it returns with the error back to the frontend.
if it succeeds,
- Creates a var
run
of typeArc<Mutex<boolean>>
in the function scope. - Creates a event listener (
weight-close
) which will set the aboverun
var to false when invoked. - Also spawns a thread which reads data from the serial port and emit a event (
weight-read
) with the weight data with a delay of300ms
as long asrun
var is true. - Returns unit.
Then on the frontend we create a event listener which listens for weight-read
events and updates the bell_weight
field.
Make sure you have the following installed
In root directory first install the dependencies
pnpm install
then
to open the tauri application.
pnpm tauri dev
or to open only the web application
pnpm dev
or to build for production
pnpm tauri build