Smart Enviro Backend is a REST API built with Laravel 11 that powers IoT-based environmental monitoring systems. It handles device registration, sensor telemetry ingestion from ESP32 microcontrollers, bidirectional command delivery, and a mobile-app-facing control surface — all secured with Laravel Sanctum token authentication.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/GaelCeballos/Smart_Enviro_Backend/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart
Get the API running locally in minutes with Docker and Laravel Sail.
API Reference
Browse all endpoints — authentication, devices, and sensor data.
ESP32 Integration
Connect your hardware: sync commands and push sensor readings.
Architecture
Understand how devices, sensors, and users fit together.
What you can build
Smart Enviro Backend provides the server-side foundation for IoT applications that need to:- Receive continuous sensor readings (temperature, humidity, soil moisture, light levels) from ESP32 devices
- Send real-time ON/OFF/STANDBY commands back to actuators on the next device sync cycle
- Let mobile or web clients discover, claim, and configure IoT devices registered on the network
- Query historical sensor data aggregated by hour, day, or month for dashboards and charts
How it works
Register a user account
Mobile app or web client calls
POST /api/register to create a user, then POST /api/login to receive a Sanctum bearer token.Discover and claim a device
The client fetches
GET /api/devices/available to list unclaimed ESP32 devices on the network, then calls POST /api/devices/{id}/add to assign one to the authenticated user.ESP32 syncs on boot
On power-up and periodically, the ESP32 calls
GET /api/device/sync with its device_token. The backend returns the current command (ON, OFF, or STANDBY) and configuration properties.Technology stack
| Layer | Technology |
|---|---|
| Backend | PHP 8.4 + Laravel 11 |
| Authentication | Laravel Sanctum (API tokens) |
| Database | MySQL 8.x |
| Cache / Queues | Redis 7.x |
| Infrastructure | Docker + Laravel Sail |
Deployment Guide
Deploy with Docker, configure environment variables, and run migrations.
Data Model
Explore the database schema: devices, sensor types, readings, and logs.
Device Properties
Configure per-device thresholds, automation settings, and capabilities.
Sensor History
Query averaged sensor data for hourly, weekly, and monthly charts.