Indoor environmental quality directly impacts the health, comfort, and cognitive performance of those who occupy these spaces, motivating the development of continuous monitoring platforms capable of overcoming the cost, interoperability, and scalability limitations of many existing IoT solutions. This article presents a modular and secure IoT architecture, hierarchically organized into three layers (Hub, Edge, and Server), that adapts to different monitoring domains without requiring infrastructure redesign. Communication is managed using MQTT and gRPC, with mutual authentication based on a public key infrastructure (PKI). It also incorporates proprietary application protocols for linking, configuration synchronization, and recovery from partial failures. As a case study, an environmental monitoring system was implemented and is currently undergoing experimental validation at the National University of San Luis.