Saturday, March 28, 2015

Javascript oddities #1

var func = function() {}
console.log(func.prototype.constructor == func); // return true

Thursday, March 12, 2015

JHipster: A code generator with a truck load of tech for AngularJS and Spring Boot based projects

I recently came across a JHipster - a Yeoman-based generator, which generates a based project which includes a truck load of technologies (taken directly from JHipster's Technology Stack page):

Technology stack on the client side

Single Web page application:

  • Responsive Web Design
  • HTML5 Boilerplate
  • Twitter Bootstrap
  • AngularJS
  • Full internationalization support with Angular Translate
  • Optional Compass / Sass support for CSS design
  • Optional WebSocket support with Spring Websocket

With the great Yeoman development workflow:

  • Easy installation of new JavaScript libraries with Bower
  • Build, optimization and live reload with Grunt or Gulp.js
  • Testing with Karma and PhantomJS

And what if a single Web page application isn't enough for your needs?

  • Support for the Thymeleaf template engine, to generate Web pages on the server side

Technology stack on the server side

A complete Spring application:

  • Spring Boot for easy application configuration
  • Maven or Gradle configuration for building, testing and running the application
  • "development" and "production" profiles (both for Maven and Gradle)
  • Spring Security
  • Spring MVC REST + Jackson
  • Optional WebSocket support with Spring Websocket
  • Spring Data JPA + Bean Validation
  • Database updates with Liquibase
  • MongoDB support if you'd rather use a document-oriented NoSQL database instead of JPA
  • Cassandra support if you'd rather use a column-oriented NoSQL database instead of JPA

Ready to go into production:

  • Monitoring with Metrics
  • Caching with ehcache (local cache) or hazelcast (distributed cache)
  • Optional HTTP session clustering with hazelcast
  • Optimized static resources (gzip filter, HTTP cache headers)
  • Log management with Logback, configurable at runtime
  • Connection pooling with HikariCP for optimum performance
  • Builds a standard WAR file or an executable JAR file
Although I did not use it for any of my projects (yet), it is a great reference to see how to setup a project which truly separate the front and back development. What I meant by that is the project is setup where the front-end can be served via 'grunt serve', i.e. NodeJS, decoupled from the back-end Spring Boot server. Yet, we all these goodies, you can still easily call 'mvn package' to build a complete Spring Boot powered executable JAR.

It is a great project to get a glimpse of all these technologies and how they can integrate together. More importantly, it set up a viable project which separates but integrated workflow for front-end and back-end. After working with it for a bit, I do have some reservations and comments, but that for another post.

Have you used JHipster in your projects? In a production setting? If so, I love to hear your comments.