<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=269747997384049&amp;ev=PageView&amp;noscript=1">

AVIO Insights

Create app skeletons using Yeoman

The Problem

Often when starting a new project, a developer can have doubt on how to implement the structure, which patterns to follow or which of the many frameworks should you choose to achieve a single goal when there are hundreds out there. Many times this reason is why the kickstart is so hard.

The Solution

Use a structure/template generator for applications where you can specify or choose every piece of software that fits your needs.

Introducing Yeoman

Yeoman is an open-source development stack to help developers build applications, it runs as a command line interface written for Node.js.

It uses "generators"

Yeoman generators are created to let you define app templates to:

* Rapidly create a new project

* Create modules or packages

* Enforcing standards, best practices and style guides

* Promote new projects by letting users get started with a sample app

Besides being an open-source project they have multiple templates to start with. So instead of creating your own template, let's say you want a classic MVC java spring angular template. You can search for different types of generators in http://yeoman.io/generators/ and find the one that fits you.

Inside every generator, there's a webpage or a GitHub with the description of the structure, tools and builds included.

For instance: JHipster which is a Spring Boot + Angular

 

Once you find the generator that fit your needs you can create the whole structure from it.

Make sure you have installed yeoman with:

npm install -g yo

 

Generators are npm packages named generator-nameofthegenerator

In our case to install the JHipster we need to execute

npm install -g generator-jhipster

 

And then in the desired directory we do

yo jhipster

 

Right after the generator will ask a series of questions to customize the new project as of:

And we can check that the whole structure was created as expected.

 

Besides the great use of the generators to start projects in no time, I found this tool really helpful to start playing with webapps. When building a front-end application there are thousands of options to use and if you really want to give a try a certain configuration without getting into the full details of what the framework-library-building tool does or how the structure should look like. This is a really good approach.

 
1 minute read