project
Street Lighting Control Platform
Freelance full-stack IoT platform for smart street lighting with real-time monitoring, MQTT field control, map visualization, and reporting.
Domain / Industry: Smart City
Full-Stack Developer (Freelance) · Feb 2025 – Jun 2026 · ~1 yr 4 mo
Problem
Utility companies and municipal services face significant challenges in managing distributed street lighting infrastructure. The need for centralized control over assets like electrical cabinets, power lines, and individual poles is critical. Operators require real-time visibility into the status of these assets, the ability to respond swiftly to faults, remotely adjust lighting parameters, and generate comprehensive consumption and error reports without cumbersome manual data collection.
Approach
As a freelance full-stack developer, I was tasked with building a robust, production-ready web platform to address these challenges. My approach involved:
- Real-time Architecture: Implementing a system capable of handling live telemetry from field devices and pushing instant updates to the operator dashboard using WebSockets.
- Comprehensive Control: Developing features for remote control of individual LED poles, managing complex lighting scenarios, and automating schedules based on astronomical data.
- Intuitive Interface: Designing a user-friendly React dashboard with integrated mapping capabilities (Google Maps) to visualize assets and streamline operational workflows.
- Robust Backend: Building a scalable NestJS API with MongoDB for data persistence and Redis for caching and real-time data handling.
- Secure Deployment: Ensuring a secure and performant production environment on AWS Lightsail, addressing common deployment challenges like CORS, mixed content, and security headers.
- Quality Assurance: Integrating unit and end-to-end testing to maintain code quality and reliability.
Outcomes
The Street Lighting Control (SLC) platform successfully delivers a comprehensive solution for smart street lighting management, enabling efficient operations and significant cost savings for the client.
Key Deliverables:
- Real-time Operations Dashboard:
- A production-ready React 18 + TypeScript dashboard providing live monitoring of cabinets, electrical lines, and individual poles.
- Real-time telemetry and status updates delivered via Socket.IO WebSockets.
- Role-based access control (Administrator, Servicer, Operator) to tailor functionality for different user types.
- Advanced pole management features, including support for GPS coordinates from field devices.
- Remote Control & Automation:
- Precision LED power control for individual light bulbs.
- Flexible lighting scenario management, allowing for workday patterns, all-on/all-off modes, and custom LED combinations.
- Astronomical automation calculates and applies lighting schedules based on local sunrise/sunset times.
- MQTT messaging for seamless communication between the NestJS backend and field hardware controllers.
- Map & Visualization:
- Integrated Google Maps displaying the geographical distribution of cabinets, poles, and facilitating maintenance workflows.
- Interactive map tools for configuring lighting scenarios and gaining a quick overview of asset status.
- Comprehensive Reporting:
- Detailed consumption and fault reporting with extensive filtering options (cabinet, line, date range, phase, scenario).
- PDF and Excel export capabilities for operational analysis and audit trails.
- Client-side PDF generation for on-demand reports of cabinet and line details.
- Backend & Infrastructure:
- A high-performance NestJS REST API leveraging MongoDB for primary data storage and Redis for caching and Pub/Sub.
- Secure JWT authentication and robust role-based authorization.
- The NestJS backend efficiently serves the production frontend build, ensuring a same-origin API and WebSocket connection.
- Configurable environment settings for seamless transitions between development and production.
- Production & Security Hardening:
- Successful deployment and ongoing management on AWS Lightsail at urban-lumi.com.
- Proactive resolution of CORS and mixed-content issues to ensure secure HTTPS production.
- Implementation of critical security headers via Helmet (CSP, HSTS, X-Frame-Options) to enhance application security.
- Quality & Maintainability:
- Extensive unit tests using Vitest and Testing Library, alongside E2E tests with Playwright, ensure high code quality and prevent regressions.
- Comprehensive technical documentation covering deployment, environment setup, and security guidelines to facilitate future maintenance and onboarding.
Architecture (high level)
Field controllers ←→ MQTT ←→ NestJS API ←→ MongoDB / Redis
↓
WebSocket (Socket.IO)
↓
React dashboard (urban-lumi.com)
The system is designed with a real-time data flow. Field controllers communicate via MQTT to the NestJS backend. The backend processes this data, persists it in MongoDB and Redis, and pushes relevant updates to the React dashboard via Socket.IO WebSockets. The frontend, built with Vite, is served as static assets by the NestJS backend, ensuring that the API, WebSocket, and UI operate from the same origin in the production environment.
Technology Stack
Frontend: React 18, TypeScript, Vite, Tailwind CSS, DaisyUI, React Router, Socket.IO client, Google Maps API
Backend: NestJS, Node.js, JWT, REST, MQTT
Data: MongoDB, Redis
Testing: Vitest, Testing Library, Playwright
DevOps: AWS Lightsail, pnpm, Git
My Contribution
As the freelance full-stack developer on this project, I was responsible for the entire development lifecycle, from conceptualization to deployment and ongoing maintenance. My key contributions included:
- Designing and implementing core features of the dashboard and comprehensive reporting system.
- Integrating real-time updates and map-based workflows to enhance operational efficiency.
- Developing and maintaining the backend API, including all MQTT-related integrations with field hardware.
- Managing the production deployment, configuring the environment, and establishing robust security measures on AWS Lightsail.
- Ensuring high code quality through extensive test coverage and promoting maintainability of the codebase.
An update...
A new AI assistant layer is in active development on a dedicated feature branch. The goal is conversational system guidance, live state awareness, on-demand reports, and human-approved actions such as cabinet scenario configuration. Longer term, the design extends toward autonomous and semi-autonomous agents across most platform segments, with mandatory user authorization for critical actions.