How to create your first code-generator with Wupiter

David Kiss
3 min readJun 24, 2021
https://wupiter.com

Why create a code generator in the first place?

Starting a new coding project from scratch can be quite time consuming and with the help of a code generator we can speed up the process of laying the groundwork and automate generating some of the boilerplate code.

Good examples to this are Spring Initializr, Micronaut Launch and the Quarkus code generator. These are web based code generators that help developers create a skeleton project for Spring, Micronaut and Quarkus frameworks.

Custom in-house built code generators can also be useful to generate code tailored to the company’s infrastructure, tools and developer environment and also to share best practices across different dev teams.

The more these code generators can automate (including CI/CD processes), the faster teams can release new code to production.

What is Wupiter?

Wupiter is a new web-based code generator tool where anyone can create code-generators (Accelerators) either from scratch or from an existing sample project.

How does Wupiter work?

Wupiter integrates with git and let’s developers keep the Accelerators files with their company’s trusted git service provider and use version control for these files.

In order to create an Accelerator developers only need to provide the files used to generate the code (either static files or handlesbarjs template files for dynamically generated output files), and a wupiter.json descriptor file where they can configure:

  • the input parameters of their code generator
  • the folder structure of the files used for generating code
  • instructions on how the files should be used to generate code (ie: dynamic destination paths based on input parameters, etc.)

See here for a sample code generator and documentation on how to configure the wupiter.json file.

When an Accelerator is created in Wupiter, we only need to provide the git repo’s url to Wupiter, and it will automatically find and parse the wupiter.json file.

Creating an Accelerator (code generator)

Once the file is successfully parsed, Wupiter will show a read-only view of the configurations.

Note that edits are only possible via git commits (outside of Wupiter).

At this stage, the Accelerator is saved in Wupiter and ready to use.

Clicking on the Try It button will take us to the code generator page.

Generate page for sample Accelerator

When a user clicks on the Generate button, Wupiter will start the code generation and provide the output in a zip file that can be downloaded.

Wupiter also offers a preview option where users can view the generated files within the browser before downloading the zip file.

Wupiter Spring Boot Accelerator

For a more complex code generator check out the Wupiter Spring Boot Accelerator in action here.

This Accelerator can generate a ready-to-use sample project using Java, Spring Boot, Spring Data JPA, Liquibase, Docker and postgres / mysql / mariadb.

Conclusion

As discussed above, Wupiter, a web-based tool, similar to other code generators can help saving time and automate coding tasks when creating new projects.

Click here to create your own code-generator with Wupiter today.

--

--