Introduction to Scaffander

Scaffander is a handy tool which allows you to build generators for your codebase and maintain the code in automated way. Now you can keep your project definition as a code, not as the mix of documentation, know-how and code-snippets anymore.

What are your typical tasks when you start development of new application?

  • I bet you always reuse your favorite libraries, include configuration files for editors, configure build tools, deployment scripts, prepare basic source code structure to simplify development startup etc. Doing always the same when starting a new project is very time consuming process and can lead to errors.

  • You have some predefined standards in your company, so when you start with a new project, codebase setup is always the same. You must include the same artifacts, scripts, configurations, even some basic code like authentication setup, etc.

  • You want to quickly start a new project by combining multiple technologies, for example Dockerfile + Maven wrapper + Spring project or AWS deployment script + Angular project.

Now you can set everything up with Scaffander and parametrize your code template. Once you decide to start a new project, just provide project parameters and Scaffander will generate entire codebase for you. Scaffander community offers also public templates for generators, which can be combined into meaningful technology stack. Of course, you can also combine public and your own templates.

Need to maintain multiple git repositories at once?

Generated sources can remain linked with Scaffander if you decide to do so. Once you update the template source, Scaffander can reflect this change into all underlying projects like a magic. It will simplify maintenance of your project significantly in the situations when you need to apply the same change for all your git repositories. This is especially helpful in microservices archirecture, where number of maintained git repositories is very high and propagating some change into all your projects one by one is a nighmare.

In the next sections we will explain the basic concepts of Scaffander - generators, templates and managed repositories.

Generators and templates

Generator is composition of code templates stored in git repositiories. Code template contains template files, folders and optionally a template definition, which can specify input variables of the template and other template features. Scaffander can dynamically render inut form to gather variables before project generation.

In the scheme below, you can see file and folder structure of 3 templates: Maven Wrapper, Dockerfile and Spring. All 3 are combined into signle generator for Spring projects. As you can see, Scaffander uses metadata from .scf folder to generate input forms, which allow the user to parametrize generated project. Since Docker template in our example does not contain .scf folder, its input form is empty. This means Docker template files are just “static” and will be copied from the template to generated project “as is”.

Microservice file list

Since templates are physically git repositories, you can reuse existing templates provided by community or create custom ones.

Once you execute generator, Scaffander will use template parameters to evaluate placeholders, template expressions and directives in all template files. Scaffander will do this for each generator template separately and then merges output into final generated project.

Managed repositiories

Managed repositories are links to the projects git repositories generated by Scaffander. Using managed repositories, you can propagate changes made in template into all the managed repositories which use given template. For example, you have generated 10 projects, all are based on the same template for Docker. Then you decide to increment dependency version in Dockerfile to the most recent one.

Normally, you would have to do the change for all your projects one by one. But with Scaffander, you can update only the template and Scaffander can propagate the change to all your projects automatically!

You could even change the project files locally, Scaffander algorithms are intellignet enough to find the exact place where the update have to be applied.