Sagooiot
SagooIOT是一个基于golang开发的开源的企业级物联网基础开发平台。负责设备管理和协议数据管理,支持跨平台的物联网接入及管理方案,平台实现了物联网开发相关的基础功能,基于该功能可以快速的搭建起一整套的IOT相关的业务系统。旨在通过可复用的组件,减少开发工作,简化和加速物联网开发交付。适配多种接入协议(TCP,MQTT,UDP,CoAP,HTTP,GRPC,RPC等)
Install / Use
/learn @sagoo-cloud/SagooiotREADME
Sagoo IOT Community V2
<div align="center"> <img width="120px" src="https://raw.githubusercontent.com/sagoo-cloud/.github/main/profile/logo.svg"> </div>English | 简体中文
🚀 Quick Navigation
| 📖 Documentation | 💻 Frontend | 💬 Community | 🐛 Feedback | |-----------------|-----------|------------|-----------| | Official Docs | UI Source | QQ Group: 686637608 | Issues |
💡 Welcome to click ⭐Star⭐ in the upper right corner to support us!
📝 Copyright Notice
Open source software is not the same as free. SagooIOT is released under the GPL-3.0 open source license and provides technical exchange and learning. However, according to this license, modified or derived code from SagooIOT may not be released or sold as closed-source commercial software. If you need to use SagooIOT for any commercial purposes locally, please contact the project manager for commercial licensing to ensure your use complies with the GPL license.
📋 About SagooIOT
SagooIOT is a lightweight enterprise-grade IoT platform developed in Go. It provides complete IoT access, management, analysis and application solutions, supporting cross-platform standalone or distributed deployment. You can quickly build a complete IoT business system with device management, data processing, alert notifications, rule engine, video monitoring, edge computing and other functions.
🎯 Core Values
- 🚀 Fast Deployment - Out-of-the-box, start a complete IoT platform in minutes
- 📱 Full Stack Separation - GoFrame 2.9 backend + Vue 3 frontend, clear and maintainable architecture
- 🔌 Flexible Access - Support TCP, UDP, HTTP, Websocket, MQTT, CoAP, OPC UA, Modbus, SNMP, IEC104, JT808, GB212 and other protocols
- 🧩 Plugin-Driven - Unique hot-pluggable plugin system supporting C/C++, Python, Go multi-language development
- ⚡ High-Performance Data Processing - Integrated TDengine time-series database supporting million-level data points at second-level processing
- 🏭 Edge-Friendly - Support offline deployment, local rule execution, automatic alerts suitable for edge computing scenarios
📌 Quick Information
| Item | Info | |------|------| | Frontend Project | sagooiot-ui | | Official Documentation | http://iotdoc.sagoo.cn/ | | Tech Community | QQ Group: 686637608 | | Default Account | admin / admin123456 | | Open Source License | GPL-3.0 |
⚙️ System Requirements
Minimum Configuration
- Operating System - Linux, macOS, Windows
- Go Version - 1.23.0 or higher
- Memory - 4GB (Recommended 8GB+)
- Disk Space - 20GB (Recommended 50GB+)
- Network - Stable network connection
Core Dependencies
| Component | Version | Purpose | |-----------|---------|---------| | MySQL | 5.7+ / 8.0+ | Relational database for business data storage | | PostgreSQL | 16.x | Relational database for business data storage (Optional) | | Redis | 6.0+ | Cache and message queue | | TDengine | 3.0+ | Time-series database (Optional, for efficient device time-series data storage) | | InfluxDB | 2.x | Time-series database (Optional, for efficient device time-series data storage) | | MQTT Broker | - | Message middleware (Optional, Mosquitto or cloud service recommended) | | MinIO | - | Object storage (Optional, for file management) |
🚀 Quick Start
Method One: Direct Run
1. Prerequisites
# Clone the project
git clone https://github.com/sagoo-cloud/sagooiot.git
cd sagooiot
# Create necessary directories
mkdir -p resource/log
# Initialize database (refer to manifest/sql/)
# Need to import database initialization script in MySQL
2. Configure Environment Variables
Create .env file in project root or modify manifest/config/config.dev.yaml:
# Database configuration
database:
mysql:
host: localhost
port: 3306
name: sagooiot
user: root
password: your_password
# Redis configuration
redis:
host: localhost
port: 6379
password: ''
# MQTT configuration (if needed)
mqtt:
broker: mqtt://localhost:1883
3. Start Application
# Download dependencies
go mod download
# Run application
go run main.go
# Application will start at http://localhost:8000
Method Two: Docker Compose One-Click Start
1. Prepare Docker Environment
# Ensure Docker and Docker Compose are installed
docker --version
docker-compose --version
2. Start Complete Stack
cd manifest/docker-compose
# Use docker-compose to start all services (MySQL, Redis, SagooIOT, etc.)
docker-compose -f docker-compose.yml up -d
# View logs
docker-compose logs -f sagooiot
# Stop services
docker-compose down
3. First Access
- Web UI - http://localhost:8000
- API - http://localhost:8000/api
- Default Account - admin / admin123456
⚠️ Strongly recommended to change default password after first login!
🏗️ Platform Architecture
Overall Architecture Design
┌────────────────────────────────────────────────────────────┐
│ Frontend Layer (Web UI) │
│ Vue 3 + Element Plus + TypeScript │
└────────────────────────────────────────────────────────────┘
↓
┌────────────────────────────────────────────────────────────┐
│ GoFrame 2.9 Application Service Layer │
│ ┌──────────────┬──────────────┬──────────────────────────┐ │
│ │Device Manager│Data Processing│ Alert & Notification │ │
│ │Thing Model │Rule Engine │ Data Analysis │ │
│ │Permission │Data Center │ Real-time Push │ │
│ │System Mgmt │Task Scheduler │ Other Modules │ │
│ └──────────────┴──────────────┴──────────────────────────┘ │
└────────────────────────────────────────────────────────────┘
↓
┌────────────────────────────────────────────────────────────┐
│ Protocol Access Layer (Multi-Protocol) │
│ TCP │ MQTT │ UDP │ CoAP │ HTTP │ Websocket │ RPC │
│ ↓ │
│ Plugin System (C/C++/Python/Go) │
│ Modbus TCP/RTU/ASCII │ IEC61850 │ OPC UA │ Canopen │
└────────────────────────────────────────────────────────────┘
↓
┌────────────────────────────────────────────────────────────┐
│ Storage & Message Middleware Layer │
│ ┌──────────┬──────────┬──────────┬──────────┐ │
│ │ MySQL │ Redis │ TDengine │ MinIO │ │
│ │Relational│Cache/Queue│TimeSeries│File Store │ │
│ └──────────┴──────────┴──────────┴──────────┘ │
│ MQTT Broker │ Elasticsearch │ Other Storage Components │
└────────────────────────────────────────────────────────────┘
Core Modules Explanation
| Module | Location | Function | Description |
|--------|----------|----------|-------------|
| Controller | internal/controller/ | API Routing Layer | Receive and respond HTTP requests |
| Service | internal/service/ | Business Logic Layer | Implement business rules and processes |
| DAO | internal/dao/ | Data Access Layer | Database operations and queries |
| Model | internal/model/ | Data Model | Define data structures |
| Network | network/core/ | Protocol Access Core | Multi-protocol adaptation and processing |
| MQTT | internal/mqtt/ | MQTT Message Processing | MQTT pub/sub management |
| Tasks | internal/tasks/ | Background Tasks | Scheduled tasks, async tasks |
| Workers | internal/workers/ | Worker Thread Management | High-concurrency processing and queues |
| Pkg | pkg/ | Tool Library | Cache, MQTT, Plugin, OAuth, etc. |
Data Flow
Device → Protocol Access → Protocol Parse → Data Validation → Business Process → Data Storage
↓
Real-time Push → WebSocket → Frontend Display
↓
Rule Engine → Alert Judgment → Notification Send
↓
Data Analysis → Visualization Report
✨ Feature Modules
A. Device & IoT Core Capabilities
- Thing Model Management - Define device properties, events, services, support JSON format import, flexible adaptation for various devices
- Product Management - Unified management of device type products, support product version, batch operations, product classification
- Device Management - Complete device lifecycle management: registration, configuration, online/offline, activation, disable, delete
- Device Tree - Tree-view display of device relationships and grouping, support multi-dimensional classification and permission control
- Device Tags - Flexible tag system for easy device classification, query, and permission isolation
- Real-time Data - Device real-time status display, historical data query, data export (Excel/CSV)
