Running ThingsBoard with Separated Frontend and Backend Services

Backend Initialization

The ThingsBoard platform is architected with a clear separation between the server-side logic and the client-side interface. The backend, responsible for telemetry processing and device management, is built using Java and Maven.

  1. Prerequisites: Verify that JDK (version 11 or newer) and Maven are configured in your system PATH.

  2. Build Process: Execute the Maven wrapper to compile the source code and generate the artifact. Skipping tests accelerates the build time.

    mvn clean package -DskipTests
    

    The output artifact (typically a .jar file) will be located in the application/target directory.

  3. Database Setup: Before launching, ensure the database schema is initialized. Depending on your OS, execute the corresponding SQL scripts or helper scripts (e.g., install_dev_db.bat for Windows or the .sh equivalent for Linux) to create tables and insert default configurations.

  4. Execution: Launch the application using the Java Runtime Environment.

    java -jar application/target/thingsboard.jar
    

Frontend Initialization

The user enterface is developed using the Angular framework. To run it independently from the backend, you must adjust the build configuration.

  1. Modify Build Configuration: In the root pom.xml, comment out or remove the module referencing the UI to prevent Maven from building the frontend alongside the backend.

  2. Navigate to UI Directory: Change your working directory to the folder containing the frontend code (e.g., ui-ngx).

  3. Dependency Installation: Install the necessary Node.js packages using Yarn or NPM.

    yarn install
    
  4. Launch Dev Server: Start the local development server. This will serve the application, usually on port 4200, with hot-reload capabilities.

    yarn start
    

Configuration Notes

  • CORS Policy: When running the frontend on a different port (e.g., 4200) and the backend on another (e.g., 8080), ensure the backend Spring Boot configuration allows Cross-Origin Resource Sharing (CORS) from the frontend's origin.
  • API Endpoint: Verify that the frontend environment configuration (often found in src/environments/environment.ts) points to the correct backend IP address and port.
  • Production Deployment: In a production scenario, the Angular application is typicallly compiled into static assets (ng build) and served via a web server like Nginx, while the backend runs as a system service.

Tags: ThingsBoard IoT Platform Backend Development Angular microservices

Posted on Sun, 30 Aug 2026 16:13:25 +0000 by loveranger