Energy Analytics

Smart Facility Management Platform

Full-stack facility management system for multi-tenant commercial buildings. Comprehensive work order management, preventive maintenance scheduling, utility billing with automated invoice generation, IoT device integration, and advanced alerting with configurable rules engine.

Project Overview

Role

Full-stack development of production facility management system. Built React frontend, Node.js backend, PostgreSQL database, automated job systems, and IoT integration.

Scale

50+ API endpoints, 40+ database tables, 1000+ tenants, 100,000+ device readings daily, automated invoice generation for 1000+ properties

Technology

React, Node.js, Express, PostgreSQL, Prisma ORM, Docker, MinIO, JWT, Nodemailer, PDFKit, TypeScript

Status

Production Live - Managing 1000+ commercial buildings with continuous operations

Key Features

Work Order Management

Create, track, and manage maintenance work orders with status lifecycle. Includes SLA tracking, cost estimation, checklist items, and activity logging.

Preventive Maintenance

Schedule and automate preventive maintenance with configurable intervals. Auto-generate work orders and track completion compliance.

Service Ticketing & SLA

Full helpdesk system with automated SLA policies, escalation workflows, multi-source intake, and customer satisfaction tracking.

Automated Billing Engine

Monthly invoice generation with multi-line billing (metered energy, fixed charges, after-hours, taxes). Supports multiple utilities.

IoT Device Integration

Real-time data ingestion from BACnet/Modbus devices. Time-series storage with threshold monitoring and alert triggers.

Rules Engine & Alerts

Configurable rules with AND/OR logic and flexible actions. Real-time and scheduled triggers for automated responses.

Technology Stack

Frontend Stack

  • React 18 with TypeScript
  • Vite (Build tool)
  • TailwindCSS + Radix UI (Components)
  • Recharts (Data Visualization)
  • jsPDF (Invoice Generation)

Backend Stack

  • Node.js + Express.js
  • Prisma ORM (Type-safe queries)
  • PostgreSQL Database (40+ tables)
  • REST APIs (50+ endpoints)

Data & Storage

  • PostgreSQL (Relational + Time-series)
  • MinIO (S3-compatible storage)
  • Document management (PDFs, invoices)

DevOps & Deployment

  • Docker Containerization
  • docker-compose (Local environment)
  • GitLab CI/CD Pipeline
  • Automated migrations (Prisma)

Architecture & Implementation

Multi-Tenant Data Isolation

Every query includes building_id and tenant_id filters to ensure complete data separation. Different facility operators see only their building's data. Implemented at database query level and API layer for defense-in-depth. Technical Challenge: Preventing data leakage while maintaining query performance across millions of records.

Automated Billing Pipeline

Scheduled cron job runs monthly to generate invoices for all active tenants. Fetches device readings from PostgreSQL, applies rate cards, calculates charges (metered + fixed + taxes), creates invoice records, generates PDFs via PDFKit, uploads to MinIO, and sends emails. Technical Challenge: Processing invoices for 1000+ tenants with thousands of readings each without timing out or blocking operations.

IoT Real-time Data Ingestion

API endpoint ingests device readings from BACnet/Modbus gateways. Validates device_id and parameters, stores in time-series PostgreSQL table, checks thresholds, and triggers alerts/rules if breached. Handles thousands of readings per minute. Technical Challenge: Ingesting and processing high-frequency device data while detecting thresholds and executing rule actions in real-time.

Rules Engine with Flexible Logic

Configurable rules evaluate conditions (AND/OR logic) against device data and events. Actions include notifications, ticket creation, work order generation, and escalations. Rules execute in real-time and on schedules. Technical Challenge: Efficiently evaluating thousands of rules against millions of data points without excessive CPU usage.

Document Management with Presigned URLs

All documents (contracts, invoices, drawings) stored in MinIO with presigned URLs for time-limited downloads. Prevents direct S3 access credentials exposure and maintains audit trails. Technical Challenge: Generating and validating presigned URLs at scale while preventing URL reuse and unauthorized access.

JWT Token Blacklisting & Session Management

On logout, JWT tokens added to blacklist table with expiry. Every API request checks if token is blacklisted before processing. Cron job cleans expired entries. Prevents token reuse after logout. Technical Challenge: Efficient token validation at high scale without slowing down API responses.

Key Technical Implementations

Multi-Tenant Database Architecture

Designed schema with building_id and tenant_id as filtering keys for all queries. Every API endpoint automatically scopes data to user's building/tenant. Prevents data leakage through accidental query misconfiguration.

Automated Monthly Billing Engine

Built node-cron job that runs monthly to generate 1000+ invoices. Aggregates device readings by utility type (energy, water, gas, HVAC), applies tenant-specific rate cards, calculates fixed charges and taxes, generates PDFs, and emails to tenants.

IoT Device Data Pipeline

Created HTTP API endpoint for BACnet/Modbus gateways to ingest device readings. Implemented validation, time-series storage, threshold checking, and automatic alert triggering. Handles thousands of readings per minute.

Flexible Rules Engine

Implemented configurable rules system with AND/OR logic for complex conditions. Rules trigger notifications, create tickets, generate work orders, or escalate alerts. Supports both real-time and scheduled execution.

Secure Document Management

Integrated MinIO (S3-compatible storage) for document storage. Implemented presigned URL generation for time-limited downloads without exposing credentials. Maintains audit trails for all document access.

JWT Token Blacklisting & Auth

Built JWT authentication with token blacklisting on logout. Tokens checked against blacklist table on every request. Automated cleanup job removes expired entries. Bcrypt hashing for password security (12 rounds).