Skip to main content

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.

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.

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

1

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.
2

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.
3

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.
4

Sensor data flows in

The ESP32 pushes readings via POST /api/sensor-data authenticated by its device_token. The backend stores the reading and returns updated actuator control instructions in the same response.

Technology stack

LayerTechnology
BackendPHP 8.4 + Laravel 11
AuthenticationLaravel Sanctum (API tokens)
DatabaseMySQL 8.x
Cache / QueuesRedis 7.x
InfrastructureDocker + 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.

Build docs developers (and LLMs) love