Backend Development
This page covers the local development environment setup, module structure, and extension development of the FastBee open-source backend.
Page Guide
Environment Setup
Before you start, confirm that JDK 8, Maven, MySQL 5.7+, and Redis are installed locally; see System Deployment for component installation.
1. Clone the Source Code
git clone https://gitee.com/beecue/fastbee.git2. Import into IDEA
Open the springboot directory with IntelliJ IDEA and wait for the Maven dependencies to finish downloading.
3. Initialize the Database
mysql -uroot -p -e "CREATE DATABASE fastbee DEFAULT CHARSET utf8 COLLATE utf8_unicode_ci;"
mysql -uroot -p fastbee < sql/fastbee.sql4. Edit the Configuration
Edit springboot/fastbee-admin/src/main/resources/application-dev.yml; both the datasource and Redis configuration live in this file.
spring:
datasource:
dynamic:
datasource:
master:
url: jdbc:mysql://localhost:3306/fastbee?...
username: root
password: your_password
redis:
host: localhost
port: 6379
password: your_password5. Start
Run the FastBeeApplication.main() method.
6. Verify the Startup
After a successful start, confirm:
- No exceptions in the console output
- The backend API port 8080, MQTT TCP port 1883, and MQTT WebSocket port 8083 are all listening
- Visiting
http://localhost:8080/swagger-ui.htmlin a browser opens the Swagger API documentation
Module Overview
| Module | Role |
|---|---|
| fastbee-admin | Startup entry point, configuration files |
| fastbee-common | Utilities, constants, exceptions, entity base classes |
| fastbee-framework | Spring Security integration, JWT authentication, RuoYi framework |
| fastbee-open-api | 37 REST Controllers |
| fastbee-service | IoT and system business Service layer |
| fastbee-server | Netty MQTT Broker + SIP Server |
| fastbee-protocol | Protocol encoding/decoding |
| fastbee-plugs | Extension plugins |
API Controller Layer
The fastbee-open-api module contains the following API controllers:
| Category | Controller | Description |
|---|---|---|
| IoT | ProductController | Product management |
| IoT | DeviceController | Device management |
| IoT | ThingsModelController | Thing model |
| IoT | SceneController | Scene linkage |
| IoT | ScriptController | Rule scripts |
| IoT | GroupController | Device grouping |
| Video | SipDeviceController | SIP devices |
| Video | PlayerController | Video playback |
| Video | PtzController | PTZ control |
| System | DashBoardController | Dashboard |
| System | DataCenterController | Data center |
Extension Development
Add a New Endpoint
- Create a Controller in
fastbee-open-api - Create the Service and Mapper in
fastbee-service - Add the corresponding SQL and database tables
Add a New Protocol
- Implement the protocol codec in
fastbee-protocol - Register the protocol handler in
fastbee-server
FAQ
Database connection failure on startup?
Check that the url, username, and password in application-dev.yml are correct, and confirm that sql/fastbee.sql has been executed to initialize the database.
Redis connection failure on startup?
Check the host, port, and password under redis in application-dev.yml and the Redis service status; if Redis has a password set, it must be filled in the configuration.
Startup fails because a port is in use?
Confirm that ports 8080, 1883, and 8083 are not occupied by other processes; if there is a conflict, change the corresponding configuration and restart.


