Boost Your Enterprise Java Development with Quarkus Backstage
Streamline Project Creation and Management with Software Templates
In the world of software development, efficiency and consistency are key. Platform engineering is a way to achieve this, offering developers self-service tools and streamlined workflows. Software templates are a crucial part of this, acting as blueprints for new projects and reducing the need to write repetitive code. This allows developers to focus on what matters most: building high-quality applications.
This article introduces the Quarkus Backstage extension, a tool that simplifies the process of integrating Quarkus applications with Backstage, an open-source platform for building developer portals. I’ll explore how this extension uses software templates to improve developer productivity and make development processes smoother.
What is Platform Engineering?
Platform engineering focuses on improving the developer experience by providing a clear path for building, deploying, and managing applications. It involves creating and maintaining an internal platform that offers self-service tools, reusable components, and standardized workflows. This platform helps developers avoid getting bogged down in infrastructure and configuration details, allowing them to concentrate on delivering value.
The Importance of Software Templates
Software templates are essential in platform engineering because they provide pre-defined project structures, configurations, and best practices. They eliminate the need for developers to start from scratch, saving time and effort while ensuring consistency across projects. Templates can include boilerplate code, build configurations, deployment scripts, and even security policies, enabling developers to quickly bootstrap new applications that adhere to organizational standards.
Backstage and the Quarkus Extension
Backstage, initially developed by Spotify, is an open-source platform for building developer portals. It provides a central hub for managing software development resources, including documentation, services, and tools. Backstage's software templates feature allows developers to create and manage reusable project templates, further enhancing the platform's capabilities.
Backstage's templating system follows a structured process:
Input Form: This form gathers the necessary information from the developer to customize the template, such as project name, description, and desired features.
Scaffolder: The scaffolder takes the input from the form and uses it to generate the project structure, files, and configurations.
Steps: These are individual actions within the scaffolding process, such as fetching template files, replacing placeholders, and publishing the generated code to a repository.
The Quarkus Backstage extension seamlessly integrates Quarkus applications with Backstage, simplifying the creation and management of software templates. It offers several key features:
Backstage Client: A Java API for interacting with the Backstage backend, enabling developers to manage Backstage entities programmatically.
Catalog Info Generation: Automatically generates the
catalog-info.yaml
file required for registering Quarkus applications in the Backstage catalog.Template Generation: Reverse engineers a Backstage template from an existing Quarkus application, simplifying template creation.
Command-Line Interface: Provides a CLI for managing Backstage entities and templates, streamlining common tasks.
Dev Service and DevUI: Offers a development environment for Backstage with out-of-the-box integration with Gitea, a lightweight Git server.
A unique advantage of this extension is its ability to automate the alignment of other Quarkus extensions, such as those for Kubernetes, Helm, and ArgoCD. This automation streamlines configuration and deployment processes, allowing developers to easily incorporate these technologies into their projects.
Further Features
1. Exposing Endpoints as Template Parameters
The Quarkus Backstage extension allows developers to expose specific endpoints, such as health checks, metrics, and information endpoints, as configurable parameters within the template. This enables greater flexibility and customization when generating new projects. For example, a developer can choose to include or exclude these endpoints based on the specific requirements of the application.
To enable this feature, configure the desired endpoints in your application.properties
file:
quarkus.backstage.template.parameters.endpoints.health.enabled=true
quarkus.backstage.template.parameters.endpoints.metrics.enabled=true
quarkus.backstage.template.parameters.endpoints.info.enabled=true
2. Exposing Helm Values as Template Parameters
When using Helm charts for deployment, the Quarkus Backstage extension can expose Helm values as parameters in the generated template. This allows developers to customize the deployment configuration directly from the template input form. By mapping Helm values to template parameters, developers can easily modify settings such as resource allocation, replica count, and service definitions without manually editing the Helm chart.
3. ArgoCD Integration
The extension supports integration with ArgoCD, a popular continuous deployment tool. This integration enables automated deployment of generated projects to Kubernetes clusters managed by ArgoCD. By including an ArgoCD step in the generated template, developers can trigger deployments directly from Backstage, streamlining the deployment process and reducing manual intervention.
4. Generating the catalog-info.yaml using the CLI
The Quarkus Backstage extension provides a command-line interface (CLI) for interacting with Backstage. This CLI offers a command for generating the catalog-info.yaml
file without requiring the extension to be added to the project. This requires adding the quarkus-backstage
CLI plugin to the Quarkus CLI.
To generate the catalog-info.yaml
file, use the following command:
quarkus backstage entities generate
5. Dev Service and DevUI
The Quarkus Backstage extension provides a development environment for Backstage with out-of-the-box integration with Gitea, a lightweight Git server. This allows developers to quickly test and iterate on their Backstage templates without having to set up a full Backstage instance.
The Dev Service also automatically registers the catalog-info.yaml
in the Backstage Dev Service and provides a Dev version of templates that publish to Gitea instead of the actual remote repository.
6. Bring your own Templates
The Quarkus Backstage extension allows developers to bring their own templates and automatically install them in the Dev Service. This provides a convenient way to test and manage custom templates.
Managing Backstage with the CLI
The Quarkus Backstage extension provides a command-line interface (CLI) for interacting with Backstage. This CLI offers several commands for managing entities and templates:
generate: Generates Backstage entities or templates. For example,
quarkus backstage entities generate
creates acatalog-info.yaml
file for your application.list: Lists available Backstage entities or templates.
install: Installs a Backstage template.
uninstall: Uninstalls a Backstage template.
These commands simplify common Backstage tasks, providing a convenient way to manage your Backstage environment from the command line.
Using the Quarkus Backstage Extension
Let's look at some concrete examples of how to use the Quarkus Backstage extension.
Generating a Backstage Template
To generate a template from an existing Quarkus application, add the quarkus-backstage
extension to your project:
<dependency>
<groupId>io.quarkiverse.backstage</groupId>
<artifactId>quarkus-backstage</artifactId>
<version>${quarkus-backstage.version}</version>
</dependency>
Then, enable template generation in your application.properties
:
quarkus.backstage.template.generation.enabled=true
This will generate a Backstage template in the .backstage/templates
directory of your project.
Using the Backstage Client
The Backstage client allows you to interact with the Backstage backend programmatically. Here's an example of how to instantiate the client and fetch a component from the catalog:
BackstageClient client = BackstageClient(url, token);
Entity entity = client.catalog().get("component:default/my-component").getEntity();
This code snippet retrieves a component with the ID component:default/my-component
from the Backstage catalog.
Benefits of Using the Quarkus Backstage Extension
The Quarkus Backstage extension offers several benefits:
Increased Developer Productivity: By automating repetitive tasks and providing a standardized starting point for new projects, the extension frees developers to focus on writing code and delivering value. For example, the automated generation of
catalog-info.yaml
files and Backstage templates eliminates manual configuration and reduces the risk of errors.Reduced Errors: The extension promotes consistency in project structure and configuration, minimizing the risk of inconsistencies and errors that can arise from manual setup. This standardization also helps to enforce best practices and ensure that projects adhere to organizational standards.
Improved Collaboration: Backstage itself provides a centralized platform for managing software development resources, fostering collaboration among teams. The Quarkus Backstage extension enhances this by seamlessly integrating Quarkus applications into this ecosystem.
Software Templates for Java Developers
If you want to learn even more tips and tricks around software templates for Java developers make sure to take a look at my DevNexus 2025 presentation that I uploaded to Slideshare.
Conclusion
The Quarkus Backstage extension is a valuable tool for Java developers seeking to use platform engineering and software templates. By simplifying the integration of Quarkus applications with Backstage, it allows developers to create and manage projects more efficiently, leading to faster development cycles and higher-quality software.
The extension offers several key benefits, including increased developer productivity, reduced errors, and streamlined workflows. With features like automated template generation, a convenient CLI, and a built-in development environment, the Quarkus Backstage extension simplifies the adoption of Backstage and accelerates the development process.
To find out more about the Quarkus Backstage extension, check out the following links:
Quarkus Backstage Website: https://docs.quarkiverse.io/quarkus-backstage/dev/index.html
GitHub Repository: https://github.com/quarkiverse/quarkus-backstage
By using the Quarkus Backstage extension, you can take full advantage of Backstage and streamline your development workflows, ultimately delivering better software faster.