← All work
Application IoT Dashboard NDA · architecture only

Classroom Comfort Monitoring

Air quality and comfort for school classrooms: sensors report CO₂, temperature, humidity and light, an API stores every reading, and a dashboard charts them per school and room.

Role
Full stack developer
Year
2023
Stack
Express · MySQL · Next.js · Prisma · TypeScript
Links
Architecture — from sensor to chart
Schools · on site
Devices Classroom sensors
Gateway School batch upload
comfort-api
Service · core Express API
ORM Prisma client
Database MySQL
comfort-web-app
Auth Sign-in · JWT cookie
Client · Next.js Monitoring dashboard
UI Plotly chart per type
Architecture — from sensor to chart: 1. sensors → gateway: CO₂ · temp · humidity · lux; 2. gateway → api: POST batch; 3. api → prisma: validate · upsert; 4. prisma → db: unique room · time · type; 5. signin → next: session; 6. next → api: GET readings; 7. api → next: readings; 8. next → charts: split by type
01 — Problem

Thousands of small readings, a few people reading them

Each school sends batches of readings from many rooms and five sensor types, sometimes twice. Staff need one clear view per school and classroom, not raw rows.

02 — Role & team
  • Express / TypeScript API: readings, events and buildings
  • Prisma schema and MySQL data model
  • Next.js monitoring dashboard with Plotly charts
  • JWT auth on both apps
  • Jest + Supertest tests, TypeDoc docs, Vagrant dev box
03 — Stack
Front end
Next.js React Tailwind Plotly

One chart per reading type for the selected school or room.

API
Express TypeScript express-validator

A small JSON API that the gateways and the dashboard both use.

Data
Prisma MySQL

Typed queries and one schema shared in the repo.

Quality
Jest Supertest TypeDoc

Snapshot tests on the endpoints; docs built from the comments.

04 — Key decisions
D-01 One batch per school
Why

A gateway posts all its rooms and sensor types in one request, grouped by type, instead of one call per reading.

Trade-off

Large request bodies; the body limit had to be raised.

D-02 Re-sends are harmless
Why

A reading is unique by classroom, timestamp and type, so a batch sent twice doesn't create duplicates.

Trade-off

Corrections need a new timestamp or an explicit update.

D-03 API and dashboard apart
Why

The dashboard reads only through the API with a token, so gateways and UI share one set of rules.

Trade-off

Two apps to deploy and two places that check JWTs.