Skip to content

simul49/AI-Smart-Home-System

Repository files navigation

AI Smart Home System

An intelligent web-based home automation platform for centralized smart device management, sensor monitoring, energy optimization, and AI-driven automation.

Tech Stack

Layer Technology
Frontend Vue.js 3, Vite, Pinia, Vue Router, Axios, Tailwind CSS
Backend Java 21, Spring Boot 3, Spring Security, Spring Data JPA, JWT
Database MySQL 8.x
Tools Maven, Swagger OpenAPI, Lombok

Project Structure

AI-Smart-Home-System/
├── backend/                          # Spring Boot backend
│   ├── src/main/java/com/paradox/aismarthome/
│   │   ├── controller/               # REST API controllers
│   │   │   ├── AuthController.java
│   │   │   ├── UserController.java
│   │   │   ├── DeviceController.java
│   │   │   ├── SensorController.java
│   │   │   ├── AlertController.java
│   │   │   ├── EnergyUsageController.java
│   │   │   └── AIController.java
│   │   ├── service/                  # Business logic
│   │   │   ├── AuthService.java
│   │   │   ├── UserService.java
│   │   │   ├── DeviceService.java
│   │   │   ├── SensorService.java
│   │   │   ├── AlertService.java
│   │   │   ├── EnergyUsageService.java
│   │   │   └── AIService.java
│   │   ├── repository/               # JPA repositories
│   │   ├── entity/                   # JPA entities (User, Device, Sensor, Alert, EnergyUsage)
│   │   ├── dto/                      # Data transfer objects
│   │   ├── security/                 # JWT & Spring Security
│   │   ├── config/                   # App configuration
│   │   └── exception/                # Global exception handling
│   └── src/main/resources/
│       └── application.properties
├── frontend/                         # Vue.js frontend
│   ├── src/
│   │   ├── views/                    # Page components
│   │   ├── components/               # Reusable UI components
│   │   ├── stores/                   # Pinia state stores
│   │   ├── services/                 # Axios API services
│   │   ├── layouts/                  # Main & Auth layouts
│   │   └── router/                   # Vue Router config
│   ├── index.html
│   ├── vite.config.js
│   └── tailwind.config.js
├── database/
│   └── schema.sql                    # MySQL schema
└── docs/                             # Design documentation

Features

Core Modules

  • Authentication - JWT-based login/register with role-based access control
  • Device Management - Add, update, delete, and toggle smart devices
  • Sensor Monitoring - Real-time temperature, humidity, motion, light monitoring
  • Alert System - Automatic alerts with severity classification (LOW/MEDIUM/HIGH)
  • Energy Monitoring - Daily, weekly, monthly consumption tracking & reports
  • AI Automation - Security Mode, Comfort Mode, and Energy Saving Mode

User Roles

  • USER - Manage devices, view sensors, receive alerts, track energy
  • ADMIN - User management, system statistics, full access

Quick Start

Prerequisites

  • Java 21+
  • Node.js 18+
  • MySQL 8.x
  • Maven 3.9+

1. Database Setup

mysql -u root -p < database/schema.sql

2. Backend Setup

cd backend
mvn clean install
mvn spring-boot:run

Backend runs on: http://localhost:8080 Swagger UI: http://localhost:8080/swagger-ui.html

3. Frontend Setup

cd frontend
npm install
npm run dev

Frontend runs on: http://localhost:5173

4. Default Credentials

Register a new account at http://localhost:5173/register

  • First registered user should be manually set to ADMIN role in the database if needed.

API Endpoints

Method Endpoint Description
POST /api/auth/register Register new user
POST /api/auth/login Login, returns JWT
GET /api/users/profile Get user profile
PUT /api/users/profile Update profile
GET /api/devices List user devices
POST /api/devices Add new device
PUT /api/devices/{id} Update device status
DELETE /api/devices/{id} Remove device
GET /api/sensors List all sensors
GET /api/alerts List user alerts
POST /api/alerts Create alert
DELETE /api/alerts/{id} Remove alert
GET /api/energy List energy records
GET /api/energy/daily Daily report
GET /api/energy/monthly Monthly report
POST /api/ai/security Run Security Mode
POST /api/ai/comfort Run Comfort Mode
POST /api/ai/energy-saving Run Energy Saving Mode

Architecture

Vue.js 3 Frontend → REST API → Spring Boot MVC
    ↓ Controller Layer
    ↓ Service Layer (Business Logic)
    ↓ Repository Layer (JPA)
    ↓ MySQL Database

Security: Spring Security + JWT + BCrypt + Role-Based Access Control

About

AI Smart Home System - Full-stack IoT automation platform using Spring Boot + Vue.js + MySQL with AI-driven device control, real-time sensor monitoring, alert management, and LLM integration (DeepSeek/Qwen/Hunyuan). OOSAD course project.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors