Skip to content

Repository files navigation

electrical-gui

Status Python FastAPI Frontend

A modular suite for hub management, telemetry, and a modern web GUI for Hyperloop team operations. This repository contains the cloud services, Raspberry Pi hub server, web client, and related utilities used to run, test, and develop the system.

Quick links

Anyone is welcome to view the live GUI at: https://gui.cornellhyperloop.com/

Repository layout

  • cloud-services/ — FastAPI backend for authentication, websockets, hub coordination, and telemetry storage.
  • rpi-hub-server/ — Edge service that runs on every Raspberry Pi hub (same code, per-Pi config profile): USB serial boards (Arduino Uno R3/R4, Mega, Nano, STM32F407G-DISC1), flashing, and the cloud uplink. Includes a simulated-board mode for development without hardware.
  • web-client/ — React + TypeScript single-page app (Vite) for live telemetry, device control, and charting.
  • wifi-fallback-relay/ — Uplink manager for the one hub with a cellular HAT: prefers Wi-Fi, falls back to cellular, and reports the active link.

Architecture

The system is split into three primary tiers:

  • Cloud / API: central FastAPI application exposing REST endpoints and WebSocket hubs for realtime telemetry and command routing.
  • Edge / Hub: Raspberry Pi agent that manages local serial devices, performs device tasks, and streams telemetry back to the cloud.
  • Client: A TypeScript React app (Vite) that connects to the cloud WebSocket endpoints for realtime dashboards and control.

Cloud service diagram

RPI hub diagram

GUI diagram

A short video of the GUI being used to operate our team's minipod is attached here.

Technical specifics

  • Backend: FastAPI (>=0.115.0) + uvicorn for ASGI serving. WebSocket hubs use the websockets package and integrate with Pydantic models for typed messages.
  • Auth: NetID allowlist plus one shared team password (bcrypt), JWT sessions, and a view-only mode; hubs authenticate with per-hub device tokens (see cloud-services/src/auth/).
  • Data models: pydantic / pydantic-settings for config and runtime validation.
  • Edge: pyserial for serial connections, arduino-cli and OpenOCD for flashing, psutil for health metrics; components are wired in rpi-hub-server/src/runtime.py.
  • Contract: cloud-services/contracts/openapi.json (REST + WebSocket messages) is generated from the cloud models; the web client's types are generated from it (npm run gen:types).
  • Frontend: React 19 + TypeScript, built with Vite; key libs include recharts for charts and zustand for state.

Local development

Prerequisites: Python 3.11+, Node 18+ (or matching versions used by your environment), Git.

Backend (example)

  1. Create and activate a Python virtual environment in cloud-services:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
  1. Run the cloud API locally (development):
cd cloud-services
set ENV_FILE=.env.development
python -m uvicorn src.main:app --reload --host 0.0.0.0 --port 8000

Frontend

cd web-client
npm install
npm run dev

Edge / RPi

  1. Install dependencies in a venv under rpi-hub-server.
  2. Without hardware: HUB_PROFILE=dev-sim python -m src.main runs simulated boards against a local cloud-services.
  3. On a Pi: follow .claude/rpi-hub-setup.md (profiles lab-hub / cellular-hub, systemd unit in rpi-hub-server/deploy/systemd/).

The web client also has a browser-only mock: npm run dev:mock in web-client.

Setup guides

Tests & CI

  • Python: pytest and pytest-asyncio in cloud-services/tests, rpi-hub-server/tests and wifi-fallback-relay/tests; CI runs all three.
  • Frontend: TypeScript type checks, ESLint, a production build, and a check that src/types/api.gen.ts matches the cloud contract.

Assets and visuals

Project visuals and diagrams used above live in res/readme/:

License

This project is licensed under the MIT License — see LICENSE.md for details.

About

Full‑stack IoT platform spanning a FastAPI cloud backend, Raspberry Pi hub agent, TypeScript web client, and resilient Wi‑Fi fallback relay.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors