Skip to content
This repository was archived by the owner on Mar 25, 2026. It is now read-only.

NotHydra/smart-med-guard

Repository files navigation

SmartMedGuard: Modular Innovation for IoT-Based Patient Room Monitoring in Community Health Centers and Regional General Hospitals

Indonesian Title

SmartMedGuard: Inovasi Modular untuk Pemantauan Ruang Rawat Berbasis IoT di Puskesmas dan RSUD

SmartMedGuard is an IoT-based hospital ward monitoring system designed to address the lack of real-time environmental data in community health centers and Class C/D hospitals across Indonesia. The system employs ESP32 microcontrollers equipped with temperature, humidity, and occupancy sensors to continuously monitor ward conditions. Data is transmitted over MQTT to a local Raspberry Pi 5 server, where readings are stored in a PostgreSQL database and streamed to a live web dashboard in real-time, all without requiring internet connectivity.

SmartMedGuard is developed at Kalimantan's Institute of Technology, funded by BIMA and Kemdiktisaintek, and has advanced its Technology Readiness Level from 3 to 4 through validated laboratory testing.

Tech Stack

ESP32 Raspberry Pi PlatformIO TailwindCSS Next.js Socket.io MQTT Mosquitto NestJS Prisma PostgreSQL PNPM C++ TypeScript Node.js Docker

Folder Structure

smart-med-guard # IoT hospital ward monitoring system
├── iot-device # ESP32 firmware for sensors and MQTT communication
├── mqtt # MQTT broker (Mosquitto) configuration
├── server # NestJS REST API and WebSocket server with Prisma ORM
├── website # NextJS web dashboard for real-time monitoring
├── mqtt-test # MQTT publish/subscribe testing utilities
└── web-socket-test # WebSocket connection testing



Docker Deployment

1. Prerequisites

Ensure you have the following installed on your system:

2. Configure Environment Variables

Create a .env file in the project root with the required variables:

$ cp .env.example .env

Configure the following variables:

  • SERVER_URL: Your server API endpoint
  • SERVER_WEBSOCKET_URL: Your WebSocket server endpoint
  • SERVER_API_KEY: API key for authentication
  • DATABASE_URL: PostgreSQL connection string
  • WEBSITE_PORT: Port for the website (default: 3000)

3. Run Development Stack

Start all services in development mode with hot-reload enabled:

$ docker-compose --profile development up --build

This will start:

  • MQTT Broker (Mosquitto) on port 1883 and 9001
  • Database (PostgreSQL) on port 5432
  • Server (NestJS API) on port 3001
  • Website (NextJS Dashboard) on port 3000

4. Run Production Stack

Build and deploy all services for production:

$ docker-compose --profile production up --build

Services will automatically start with proper networking, data volumes, and health checks configured.

5. View Logs

Monitor service logs in real-time:

# All services
$ docker-compose logs -f

# Specific service
$ docker-compose logs -f server
$ docker-compose logs -f website

6. Stop Services

$ docker-compose down

To also remove volumes (warning: data will be deleted):

$ docker-compose down -v

About

SmartMedGuard: Modular Innovation for IoT-Based Patient Room Monitoring in Community Health Centers and Regional General Hospitals | SmartMedGuard: Inovasi Modular untuk Pemantauan Ruang Rawat Berbasis IoT di Puskesmas dan RSUD

Topics

Resources

Stars

Watchers

Forks

Contributors