A comprehensive web-based Building Management System designed for monitoring and controlling building infrastructure, including rooms, devices, sensors, and automated scheduling. Built as a full-stack application with a modern React frontend and Node.js backend.
This is a Swinburne University Database Design course project that implements a Building Management System. The system provides real-time monitoring of room conditions (temperature & humidity), device management, automated scheduling, maintenance tracking, and room booking capabilities.
- Real-Time Monitoring: Track temperature and humidity across multiple rooms with live sensor data
- Device Management: View and control active/inactive devices with state management
- Automated Scheduling: Schedule device operations with cron-based automation
- Notifications & Alerts: Receive real-time notifications and alerts for system events
- System Logs: Comprehensive logging of all system activities for audit trails
- Room Bookings: Manage and view room availability and bookings
- Worker Management: Track maintenance workers and assignments
- User Authentication: Secure login system with role-based access control
- Historical Data: Access sensor historical data and trends with visualization
- React 19 - UI library
- Vite - Fast build tool and dev server
- TailwindCSS - Utility-first CSS framework
- Material-UI - Pre-built UI components
- Recharts - Data visualization library
- React Router - Client-side routing
- Supabase JS Client - Backend integration
- Node.js - Runtime environment
- Express 5.x - Web framework
- Supabase - Backend-as-a-Service (Database, Authentication)
- Node-cron - Job scheduling
- CORS - Cross-origin resource sharing
- PostgreSQL - Relational database (via Supabase)
- Sensor readings and device state management
- User and worker information
- System logs and notifications
Smart-Home-Management-System/
βββ Backend/ # Node.js Express API server
β βββ index.js # Main server entry point
β βββ package.json # Backend dependencies
β βββ functions/
β βββ get/ # GET endpoints for data retrieval
β β βββ getAllDevices.js
β β βββ getAllSensors.js
β β βββ getCurrentData.js # Real-time sensor data
β β βββ getSchedules.js
β β βββ getNotifications.js
β β βββ getSystemLogs.js
β β βββ getMaintenance.js
β β βββ ... (other get functions)
β βββ insert/ # POST endpoints for data creation
β β βββ insertSchedule.js
β β βββ insertBooking.js
β βββ update/ # PUT endpoints for data updates
β β βββ updateDeviceState.js
β β βββ updateSchedules.js
β βββ delete/ # DELETE endpoints
β βββ deleteSchedule.js
βββ Frontend/ # React Vite application
β βββ index.html # Main HTML template
β βββ indexlogin.html # Login page
β βββ package.json # Frontend dependencies
β βββ vite.config.js # Vite configuration
β βββ tailwind.config.js # TailwindCSS configuration
β βββ src/
β βββ main/
β β βββ App.jsx # Main app component with routing
β β βββ main.jsx # Entry point
β β βββ index.css # Global styles
β βββ pages/ # Page components
β β βββ DashboardPage.jsx # Main dashboard
β β βββ Logs.jsx # System logs viewer
β β βββ Notifications.jsx # Notifications page
β β βββ Login.jsx # Login page
β β βββ RoomComponents/ # Room-related pages
β β β βββ SystemOverview.jsx
β β β βββ RoomDetails.jsx
β β β βββ SensorHistorical.jsx
β β βββ BookingComponents/ # Booking-related pages
β β βββ Booking.jsx
β β βββ MakeBooking.jsx
β βββ components/ # Reusable components
β β βββ Header.jsx
β β βββ Sidebar.jsx
β β βββ Layout.jsx
β β βββ ProtectedRoute.jsx
β βββ hooks/ # Custom React hooks
β β βββ getApiData.jsx # API data fetching
β β βββ getDetailData.jsx
β β βββ useTheme.jsx
β βββ assets/ # Images and fonts
βββ ScheduleJob.sql # PostgreSQL scheduled jobs
βββ README.md # This file
- Node.js (v16 or higher)
- npm or yarn
- Supabase account and project credentials
- Environment variables configured
git clone <repository-url>
cd Smart-Home-Management-SystemNavigate to the backend directory and install dependencies:
cd Backend
npm installCreate a .env file in the Backend directory with your Supabase credentials:
PORT=8000
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
Start the backend server:
# Development mode with auto-reload
npm run dev
# Production mode
npm startThe backend will run on http://localhost:8000
Navigate to the frontend directory and install dependencies:
cd Frontend
npm install Create a .env.local file in the Frontend directory:
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_KEY=your_supabase_key
VITE_API_URL=http://localhost:8000
Start the development server:
npm run devThe frontend will run on http://localhost:5173
GET /- Welcome messageGET /rooms-sensors- Get all rooms with their sensorsGET /rooms-devices- Get all rooms with their devicesGET /notifications- Get all notificationsGET /alerts- Get all alertsGET /schedules- Get all device schedulesGET /device/:deviceid- Get specific device details
PUT /devices/:id- Update device statePUT /schedules- Update device schedulesPUT /schedules/manual/:id- Manually update specific schedule
POST /schedules- Create new schedulePOST /login- User loginPOST /booking- Create room booking
DELETE /schedules/:id- Delete schedule
The backend includes a cron job that runs every minute to:
- Check and execute scheduled device operations
- Update device states based on schedules
- Monitor sensor readings
- Generate system alerts
| Name | Role | Responsibilities |
|---|---|---|
| Do Gia Huy | Supporter | Database Designer, Full-stack Developer |
| Huynh Trung Chien | Leader | Database Designer, Full-stack Developer |
| Tran Nguyen Khai Nghi | Member | IoT Engineer |
| Le Pham Tu Quynh | Member | Technical Writer |
Key tables in the PostgreSQL database:
- users - User authentication and profiles
- device - Device information and states
- sensor - Sensor configurations per device
- sensorreading - Historical sensor data (temperature, humidity)
- temphumsensor - Temperature and humidity specific readings
- notification - System notifications and alerts
- schedule - Device operation schedules
- booking - Room booking records
- systemlog - Audit and system operation logs
- User authentication with secure login
- Protected routes for authenticated users only
- CORS enabled for secure cross-origin requests
- Role-based access control
- Environment variables for sensitive credentials
This project is part of COS20031 - Database Design at Swinburne University.