REST API for receiving, storing and retrieving environmental readings collected by ESP32-based devices.
This backend is responsible for:
- receiving sensor readings from devices
- storing data in a relational database
- providing endpoints for frontend consumption
- enabling local testing through simulation scripts
- Node.js
- Express
- PostgreSQL
- JavaScript
server.js→ Express API initialization and route handlingdatabase.js→ PostgreSQL connection and table initializationsimulador.js→ basic reading simulationsimulador-cenarios.js→ scenario-based simulationcontrato-api-esp32.txt→ ESP32/Gateway payload contract
- HTTP-based data ingestion from ESP32 gateway
- low-latency POST response optimized for embedded communication
- persistent PostgreSQL data storage
- historical data retrieval
- period-based filtering
- custom date range filtering
- ESP32 timestamp support
- integration-ready with frontend monitoring dashboard
GET /api/readings
GET /api/readings?period=24h
GET /api/readings?period=7d
GET /api/readings?period=30d
GET /api/readings?period=all
GET /api/readings?start=2026-04-23&end=2026-04-23POST /api/readingsGET /api/statusThis backend is currently deployed on Render and connected to a PostgreSQL cloud database.
It is designed to receive real-time readings from the ESP32 LoRa Wi-Fi gateway and serve processed historical data to the monitoring dashboard.
This project is protected under a custom license.
It is provided for viewing and educational purposes only.
Unauthorized use, copying, modification, or distribution is strictly prohibited.
See the LICENSE file for more details.
git clone https://github.com/rusilveira/mms-backend.git
cd mms-backend
npm install
node server.jsAccess the API at: http://localhost:3000