Production

PPF Workshop Monitoring

Smart IoT SaaS for Paint Protection Film workshops. Monitors each pit continuously via ESP32 sensors, alerts owners when conditions go out of spec, tracks every job through its lifecycle, and lets customers follow their car's progress via a public link.

FastAPIPostgreSQLReactESP32MQTTMediaMTXDockerPlaywright
126/126 tests passingPhase 1 CompleteLive E2E VerifiedLive → ppf-monitoring.vercel.app

# Architecture

architecture.md
┌─────────────────────────────────────────────────┐
│  PPF WORKSHOP (on-site)                         │
│                                                 │
│   [ESP32 + DHT22 / BME680 / PMS5003]            │
│         │  MQTT publish (QoS 1)                 │
│         ▼                                       │
│   [Mosquitto Broker :1883]                      │
│         │  paho-mqtt subscriber                 │
│         ▼                                       │
│   [FastAPI Backend :8000] ── [PostgreSQL :5432]  │
│         │  WebSocket push                       │
│         │  REST API (/api/v1/…)                 │
│                                                 │
│   [Hikvision Camera] ─RTSP─▶ [MediaMTX :8554]  │
│                                 WebRTC / HLS    │
└─────────────────────────────────────────────────┘
          │                           │
          ▼                           ▼
   ┌─────────────────────────────────────┐
   │       React Frontend (:5173)        │
   │  Owner Dashboard · Job Management   │
   │  Customer Tracking · Live Video     │
   └─────────────────────────────────────┘

Data flow: Sensor → MQTT → Backend → DB + alerts
           → WebSocket → React UI

# What It Does

Real-time Monitoring

ESP32 sensors publish temperature, humidity, and particulate matter via MQTT (QoS 1). Backend parses readings, stores in PostgreSQL, checks thresholds, and pushes alerts via WebSocket.

Job Lifecycle

Create jobs, assign staff, track status pipeline (received → in_progress → quality_check → complete). State machine prevents invalid transitions.

Customer Tracking

Public tracking link (no login needed). Customers see their car's status, vehicle info, and ETA countdown. Generated automatically when a job is created.

Live Video

Hikvision cameras stream via RTSP to MediaMTX. Frontend connects via WebRTC WHEP (primary) or HLS (fallback). Video.js 8 player.

# Key Endpoints

MethodEndpoint
POST/api/v1/auth/login
GET/api/v1/workshops/{id}/pits
POST/api/v1/workshops/{id}/jobs
GET/api/v1/track/{token}
GET/api/v1/pits/{id}/sensors/latest
POST/api/v1/devices/{id}/command
WS/ws

# Role-Based Access

super_adminPlatform owner - all workshops, billing, audit log
ownerWorkshop manager - full job + device + staff control
staffTechnician - update job status, view sensors, acknowledge alerts
customerCar owner - public tracking link only, no account needed

# Business Model

₹16,250
Hardware/pit
₹1,500
Monthly/pit
55%
Hardware margin
47%
Subscription margin
3 workshops
Break-even
₹7.9L/yr
Year 1 target

# Full Stack

BackendFastAPI 0.115 · SQLAlchemy 2 (async) · PostgreSQL 16 · Alembic · Pydantic v2
AuthJWT HS256 · bcrypt cost-12 · role-based dependency guards
Real-timepaho-mqtt (backend) · PubSubClient (ESP32) · native WebSocket
FrontendReact 18 · Vite 5 · TypeScript 5 · Redux Toolkit 2 · Tailwind CSS v3
VideoMediaMTX · WebRTC WHEP (primary) · HLS (fallback) · Video.js 8
FirmwareArduino/ESP-IDF · PlatformIO · ArduinoJson 6 · WiFiManager
InfraDocker Compose · Mosquitto 2 · pgAdmin 4
Testingpytest 126 backend · Playwright 8 E2E · Live ESP32 demo verified