How gaesty/biketrack works
Project type and purpose
• BikeTrack is a full-stack, cross-platform monitoring and security system for motorcycles, combining
an embedded IoT device (LilyGO A7670E), a cloud proxy service, a Supabase backend, and a Flutter mobile/web/desktop client.
• Purpose: collect telemetry (GPS, accelerometer, battery), detect events (theft, fall), store and serve data, notify users in real time.
Main components
a. IoT Firmware
– Arduino code (CodeFonctionnel/*.ino, utilities.h) running on an ESP32 module with 4G, GPS, MPU9250 IMU.
– Responsibilities: sensor initialization, data collection, 4G HTTPS POST to Proxy, SMS emergency.
b. Proxy Cloud
– Node.js/Express server (Proxy/proxy.js) hosted on Google Cloud.
– Responsibilities: receive compact JSON from device, transform to Supabase schema, forward via Supabase REST API, handle errors.
c. Backend / Database
– Supabase (PostgreSQL + Auth).
– Tables: users, sensor_data.
– Supabase Auth for sign-in/up, session management.
d. Mobile & Web Client
– Flutter app (lib/, android/, ios/, web/, linux/, macos/, windows/).
– UI screens (home, history, alerts, safety, settings, login, signup).
– Services layer (password_service, password_service_impl_*.dart) uses supabase_flutter for auth and data queries.
– Features: real-time map (flutter_map + OpenStreetMap), push notifications, historical route display, settings management.
e. External services
– OpenStreetMap tile server for maps.
– Supabase realtime channels or REST API for live updates.
Component interactions and data flows
• IoT Device → Proxy Cloud: HTTPS POST compact JSON payload
• Proxy Cloud → Supabase: REST API call to insert transformed data into sensor_data table
• Flutter Client → Supabase:
– Auth flows (sign-up, sign-in via supabase_flutter)
– Query sensor_data for history and real-time updates
– Subscribe to real-time events or poll for new alert records
• Flutter Client → OpenStreetMap: fetch map tiles
• (Optional) Proxy Cloud or Supabase → SMS/Push notifications: trigger on threshold events
Architectural patterns and design principles
• Separation of concerns:
– Embedded firmware only handles hardware and network transmission
– Proxy service isolates device-specific payload formats from backend schema
– Backend handles data storage, auth, security
– Client handles presentation, user interaction, notifications
• Client-server pattern with RESTful interactions
• Event-driven notifications (real-time updates via Supabase realtime or push)
• Layered architecture: hardware layer, transport layer (proxy), data layer (database), presentation layer (Flutter)
Detailed capture of essential elements
• Firmware modules: GPS, IMU, battery monitor, GSM module
• Proxy’s transformation logic (compact → extended schema)
• UI screens grouping (map view, history view, alerts view) to show client module boundaries