- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Authored by: Yashika Bhatia
Co-Authored by: Sonu Singh
Backstage.io is a powerful tool for building developer portals, and it offers a convenient way to create plugins that extend its capabilities. However, a common challenge when working with Backstage is that the default plugin creation process generates a monolithic structure. All plugins are created within a single repository, which leads to issues when you want to develop, build, and run plugins individually. This structure makes it difficult to scale, maintain, and test plugins in isolation, particularly when working with backend plugins that involve database interactions or proxy services. In this post, we’ll explore a solution to this problem: a Backstage template that allows you to create individual frontend and backend plugins, each with all necessary capabilities, including proxy services, database connections, and a Makefile to handle building and running them independently.
When you create a plugin in Backstage, it typically gets added to a single repository, along with all other plugins. While this approach works for small projects, it quickly becomes a burden in larger, more complex environments. The monolithic architecture has several drawbacks:
To address these challenges, we need a modular approach where each plugin can be built and run independently, yet still leverage the full power of Backstage.
The solution lies in creating a Backstage template that generates both frontend and backend plugins as independent entities, each capable of running and building separately. This approach allows developers to work on each plugin in isolation while retaining the ability to use essential Backstage features, such as the proxy service and backend integrations for handling database-related changes. With this template, every plugin will include:
The modular approach offers several key advantages over the traditional monolithic setup:
The template we’re using creates both frontend and backend plugins under a single plugin entity. Each plugin contains everything it needs to run independently while being fully integrated with Backstage. Here’s what you get in the template:
In this section, we’ll walk through the process of setting up modular plugins using predefined templates available in our Backstage instance. These templates are designed to generate the structure for both frontend and backend plugins, allowing you to quickly customize and build upon them. You’ll also be prompted to enter specific details, such as app name and repository, to create the plugins.
Our Backstage instance comes with two predefined templates:
To create a plugin, navigate to the Backstage Software Templates under /create endpoint in your instance. You’ll be prompted to select either the Frontend Plugin Template or the Backend Plugin Template depending on what you need.
After selecting the appropriate template, you will be asked to provide some necessary fields for both frontend and backend plugins:
These fields are crucial for setting up the plugin in your Backstage instance and integrating it into your overall system.
Once the plugin is generated, you will have a predefined structure for both the frontend and backend. You can now begin customizing the code to meet your specific needs. The plugin folders include:
Each plugin comes with a Makefile to simplify the build and run process. Use the following commands to build and run them independently:
To build both the frontend and backend plugins:
make build
To run both the frontend and backend plugins:
make run
By using this modular approach with a Backstage template that generates both frontend and backend plugins, you can solve the problem of monolithic plugin structures. This approach enables independent development, easier scaling, and better flexibility when dealing with backend services like databases. If you’re working on a growing Backstage instance, this solution will make it easier to manage plugins, improve your development workflow, and allow for better scaling as your project expands. With this blog, you provide a clear problem and a practical solution, making it easier for developers to adopt modular plugin development in Backstage. Let me know if you’d like to make any adjustments!