Customizing JHipster

Another approach that has been introduced in release 2.26.0 (mid december 2015) is to build your own modules, see documentation.

Later on in release 5.0.0 (mid 2018), JHipster has introduced a more powerful tool: blueprints, although it requires more effort than creating a module. With a blueprint, you can even replace the language/framework of the generated project, it has been successfully used for Kotlin, NodeJS and VueJS.


Here's the approach in general:

  1. First, we created a blank project with all standard JHipster stack. DBMS used is Postgres. We outlined the basic data structure with jhipster entity generation tool, creating the most important relations etc. We also defined the basic user roles and permissions within standard JHipster options. At this phase we didn't pay very much attention to the details such as complex unique constraints, business restrictions, user management, JPA errors handling and presentation etc. Just created a sort of backbone to start with. CRUD pages are all standart.
  2. We introduced some domain-specific business logic. Basic frontend customization was performed: branding, styles, some custom views (still used bootstrap classes extensively) etc. Jhipster-generated frame was kept in place but extended. We changed authorization logic a little bit on both backend and frontend, it's token-based with certain token validation rules. User-friendly error handling was introduced, allowing user to understand what business restrictions show up in various conditions. We started to write more complex unit tests to meet the business logic implemented recently. Entities are mostly (~80%) crafted manually at this stage, because we got used to the data structure offered by JHipster, and we had too much customization in CRUD REST controllers, pages and tests covering all that. Liquibase changelogs were generated with liquibase:diff and edited manually. We don't add such entities to .jhipster folder.
  3. Because of demands for interface design growing high and strict, it was decided to introduce separate frontend layer for end-user interaction. It partially shares REST interfaces with jhipster-generated frontend, but is absolutely independent in terms of project structure. We decided to use Angular for new frontend layer as well. In fact, it is a subfolder with separate index.html, bower.json, Gruntfile.js etc. At the same time we continued to improve business logic, refine db structure, increase code coverage, introduce new user roles etc.
  4. ...

So we have slightly customized "old" JHipster frontend for administration and data mangement purposes. And an independent "new" frontend with custom design to deal with end users. Please note: it IS possible to keep an original interface, customize it to some limit and preserve the possibility to generate entities, and it worked well in our project as far as it was justified.

Some notes:

  • Component versions in pom.xml were constantly updated by hand;
  • Maven dependencies were manually added to pom.xml;
  • JS dependencies were manually added to index.html/bower.json/app.js;
  • If you have complex frontend scripting, dealing with JS uglification for production profile may be tricky;
  • Another difficult thing is to keep liquibase scripts working for both DBMS used by spring-boot and H2 which is used for tests;
  • You'll probably face some problems with configuration tuning depending on domain logic specific for your project.

I hope it helps.

Tags:

Jhipster