htt-generators

setup

This repo contains two yeoman based generators, one for spring boot and the other for generating angular back-office applications. To be able to use these generators you need to install yeoman generator cli using this command "npm install --save yeoman-generator", then you clone the repository and "cd folder" that you wanna be able to use and run following command yo generator name, ie: cd generator-htt-springboot; npm link;

A little talk

These generators are just a simple help to setup spring-boot and angular backoffice web apps fast, you can change the used templates to adapt it more to your needs. Generated angular backoffice apps are still having some bugs bc of some relationships that should be filtered during the generation process.

Structure

I will try to explain the structure of generated projects.

Spring-boot

The spring boot generated app structure is as simple as possible, it contains controllers, services, repositories, models, enumerations, DTOs and mappers alongside with liquibase sql tables schemas creation. Controllers and services contains basic CRUD operations that are: findAll, findById, Save, Update and Delete.

Angular

The angular backoffice generated app contains a module for each entity which contains a table view using Ag-Grid community and a form for (ADD, UPDATE and READ). Also each entity has a generated service that contains CRUD using same paths in the spring boot generated app.

Usage

ie: yo htt-springboot /path/to/model.json

Model structure

The model structure is a json file that contains a specific structure to provide to the generator to be able to generate the desired app. Here is an example of the model:

{
    "entities": [
        {
            "name": "Entity",
            "fields": [
                {
                    "name": "field",
                    "type": "FieldType"
                }
            ]
        }
    ],
    "enumerations": [
        {
            "name": "UserRole",
            "values": ["ADMIN", "USER"]
        }
    ],
    "relationships":{
        "manytoone": [
            {
                "from": "Entity",
                "to": "AppUser",
                "fk_name": "owner"
            },
            {
                "from": "Entity",
                "to": "OtherEntity",
                "fk_name": "otherEntity"
            }
        ]
    }
}

The exmaple above shows the structure of the model, you can add as many entities, fields, enumerations and manytoone relationships as needed. The FieldType should be a Java data type or an enumeration. PS: The User entity is generated by default so no need to specify it and when you want to add it in relationship you should call it AppUser. the fk_name is the name of the field to add in the referencing entity.

Feel free to reach out for any suggestions, ideas or anything.