Skip to main content

Custom Module Overview

Mango provides a rich set of features out of the box, but sometimes you need functionality tailored to a specific project -- connecting to an external API, sending events to external services, implementing a custom data source, or storing project-specific data. For these cases, you can build a custom Java module and install it like any other Mango module.

What You Will Build

In this tutorial series, you will build a custom module called "Energy Metering" that stores energy metering device data in the Mango database and exposes REST endpoints for frontend operations. By the end of the series, you will have a fully functional module with:

  • A custom database table for storing device records
  • REST API endpoints for creating, reading, querying, and deleting devices
  • RQL (Resource Query Language) support for filtering and pagination
  • Permission-based access control
  • Automated API tests
  • An AngularJS frontend page integrated into the Mango UI

Tutorial Series

The series is structured as follows, with each article building on the previous one:

  1. Setup Development Environment -- Configure your IDE, clone the required repositories, and set up the Maven build so you can compile and install modules.

  2. Module Configuration -- Create translation files, module properties, SQL table definitions, the jOOQ table definition class, and the database schema definition.

  3. Creating Your First Endpoint -- Build the complete stack from Value Object (VO) through DAO, Service, Model, and REST Controller to expose GET and POST endpoints.

  4. Testing Module Endpoints -- Write automated Mocha tests that run against a live Mango instance to verify your endpoints work correctly.

  5. Querying Devices with RQL -- Add RQL query support to your list endpoint so clients can filter, sort, and paginate device records.

  6. Adding an AngularJS Frontend -- Create an AngularJS module with webpack bundling, register a page component, and add a menu item to the Mango UI.

Prerequisites

Before starting, make sure you have the following installed:

  • JDK -- JDK 17+ runtime, JDK 25 for building (Azul Zulu JDK recommended)
  • Maven -- Latest stable version (Apache Maven)
  • IntelliJ IDEA -- Community or Ultimate edition (JetBrains)
  • A running Mango instance -- For testing your module during development

You should also be comfortable with Java development, Spring Framework basics, and have a general understanding of REST APIs.