O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Full Stack Development with JHipster

Book Description

Discover the world of Full Stack Development with real-world examples.

About This Book

  • Leverage the full power of the JHipster platform to build complex web applications
  • Create microservices from scratch and convert JHipster monolith apps into microservices
  • Build and deploy applications locally, in Docker and on various cloud platforms.

Who This Book Is For

This book will appeal to developers who would like to build modern web applications quickly. A basic knowledge of the Spring ecosystem would be an added advantage.

What You Will Learn

  • Build business logic by creating and developing entity models us the JHipster Domain Language
  • Customize web applications with Angular, Bootstrap and Spring
  • Tests and Continuous Integration with Jenkins
  • Utilize the JHipster microservice stack, which includes Netflix Eureka, Spring Cloud config, HashiCorp Consul, and so on.
  • Understand advanced microservice concepts such as API rout, load balancing, rate limit, circuit break, centralized configuration server, JWT authentication, and more
  • Run microservices locally using Docker and Kubernetes (in production)

In Detail

JHipster is a development platform to generate, develop, and deploy Spring Boot and Angular/React applications and Spring microservices. It provides you with a variety of tools that will help you quickly build modern web applications. This book will be your guide to building full stack applications with Spring and Angular using the JHipster tool set.

You will begin by understanding what JHipster is and the various tools and technologies associated with it. You will learn the essentials of a full stack developer before getting hands-on and building a monolithic web application with JHipster. From here you will learn the JHipster Domain Language with entity modeling and entity creation using JDL and JDL studio. Moving on, you will be introduced to client side technologies such as Angular and Bootstrap and will delve into technologies such as Spring Security, Spring MVC, and Spring Data. You will learn to build and package apps for production with various deployment options such as Heroku and more. During the course of the book, you will be introduced to microservice server-side technologies and how to break your monolithic application with a database of your choice. Next, the book takes you through cloud deployment with microservices on Docker and Kubernetes. Going forward, you will learn to build your client side with React and master JHipster best practices.

By the end of the book, you will be able to leverage the power of the best tools available to build modern web applications.

Style and approach

This comprehensive guide builds a complex production-ready Spring Boot + Angular web application using JHipster platform

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Full Stack Development with JHipster
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  5. Foreword
  6. Contributors
    1. About the authors
    2. About the reviewers
    3. Packt is searching for authors like you
  7. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Conventions used
    4. Get in touch
      1. Reviews
  8. Introduction to Modern Web Application Development
    1. Modern full-stack web development
    2. Web architecture patterns
      1. Monolithic web architecture
      2. Microservice architecture
    3. Choosing the right pattern
      1. When to choose a monolithic architecture
      2. When to choose a microservice architecture
    4. Summary
  9. Getting Started with JHipster
    1. Why JHipster?
    2. Goal and adoption of JHipster
    3. Introduction to technologies available
      1. Client-side technologies
        1. HTML5 and CSS3
          1. HTML5
          2. CSS3
        2. Sass
        3. Bootstrap
        4. MVVM framework
          1. Angular
          2. React
        5. Build tools
          1. Webpack
          2. BrowserSync
        6. Testing tools
          1. Karma
          2. Protractor
        7. Internationalization
      2. Server-side technologies
        1. Spring Framework
          1. Spring Boot
          2. Spring Security
          3. Spring MVC
          4. Spring data
        2. Security
          1. JWT
          2. Session
          3. OAuth2
        3. Build tools
          1. Maven
          2. Gradle
        4. Hibernate
        5. Liquibase
        6. Caching
          1. Ehcache
          2. Hazelcast
          3. Infinispan
        7. Swagger
        8. Thymeleaf
        9. Dropwizard metrics
        10. WebSocket
        11. Kafka
        12. Testing frameworks
          1. JUnit
          2. Gatling
          3. Cucumber
      3. Introduction to database options
        1. SQL databases
          1. H2
          2. MySQL
          3. MariaDB
          4. PostgreSQL
          5. MS SQL
          6. Oracle
        2. NoSQL databases
          1. MongoDB
          2. Cassandra
          3. Elasticsearch
    4. Installation and setup
      1. Prerequisites
        1. Tools required
        2. Installation procedure
          1. Java 8
          2. Git
          3. Node.js
          4. Yarn
          5. Docker
        3. IDE configuration
        4. System setup
      2. Installation of JHipster
    5. Summary
  10. Building Monolithic Web Applications with JHipster
    1. Application generation
      1. Step 1 –  preparing the workspace
      2. Step 2 – generating code using JHipster
        1. Server-side options
        2. Client-side options
        3. Internationalization options
        4. Testing
        5. Modules
    2. Code walkthrough
      1. File structure
      2. Server-side source code
        1. Java source
        2. Resources
      3. client-side source code
    3. Starting the application
    4. Application modules
      1. Home and Login modules
      2. Account modules
        1. Settings
        2. Password
        3. Registration
      3. Admin module
        1. User management
        2. Metrics
        3. Health
        4. Configuration
        5. Audits
        6. Logs
        7. API
    5. Running generated tests
      1. Server-side tests
      2. Client-side tests
    6. Summary
  11. Entity Modeling with JHipster Domain Language
    1. Introduction to JDL
      1. DSL grammar for JDL
        1. Entity modeling with JDL
        2. Relationship management
        3. DTO, service, and pagination options
      2. JDL Studio
      3. Use case entity model with explanation
        1. Entities
        2. Relationships
        3. Options for entities
    2. Entity generation with JHipster
      1. Generated code walkthrough
        1. Server-side source code
          1. Domain class for the entity
          2. Repository interface for the entity
          3. Service class for the entity
          4. Resource class for the entity
        2. Client side
          1. TypeScript model class for the entity
          2. Angular services for the entity
          3. Angular components of the entity
          4. Angular route for the entity
          5. Angular module for the entity
    3. Generated pages
    4. Running generated tests
    5. Summary
  12. Customization and Further Development
    1. Live reload for development
      1. Spring Boot DevTools
      2. Webpack dev server and BrowserSync
      3. Setting up live reload for an application
    2. Customizing the Angular frontend for an entity
    3. Editing an entity using the JHipster entity sub-generator
    4. Changing the look and feel of the application
    5. Adding a new i18n language
    6. Authorization with Spring Security
      1. Limiting access to entities
      2. Limiting access to create/edit/delete entities
      3. Limiting access to data of other users
    7. Summary
  13. Testing and Continuous Integration
    1. Fixing and running tests
    2. Continuous integration
    3. CI/CD tools
      1. Jenkins
      2. Travis CI
      3. GitLab CI
      4. CircleCI 
    4. Setting up Jenkins
    5. Creating a Jenkins pipeline using JHipster
      1. The Jenkinsfile and its stages
      2. Setting up the Jenkinsfile in a Jenkins server
    6. Summary
  14. Going into Production
    1. An Introduction to Docker
      1. Docker containers
      2. The Dockerfile
      3. The Docker Hub
      4. Docker compose
    2. Starting the production database with Docker
    3. An introduction to Spring profiles
    4. Packaging the application for local deployment
      1. Building and deploying using Docker
      2. Building and deploying an executable archive
    5. Upgrading to the newest version of JHipster
    6. An introduction to deployment options supported by JHipster
      1. Heroku
      2. Cloud Foundry
      3. Amazon Web Services
    7. Production deployment to Heroku cloud
    8. Summary
  15. Introduction to Microservice Server-Side Technologies
    1. Microservice applications versus monoliths
      1. Building blocks of a microservice architecture
        1. Service registry
        2. Service discovery
        3. Health check
        4. Dynamic routing and resiliency
        5. Security
        6. Fault tolerance and failover
      2. JHipster Registry
        1. Netflix Eureka server
        2. Spring cloud config server
      3. HashiCorp Consul
        1. Service discovery
        2. Health discovery
        3. K/V store
        4. Multiple data centers
      4. JHipster Gateway
        1. Netflix Zuul
        2. Hystrix
      5. JHipster Console
        1. Elasticsearch
        2. Logstash
        3. Kibana
        4. Zipkin
      6. Prometheus
      7. JHipster UAA server
    2. Summary
  16. Building Microservices with JHipster
    1. Application architecture
    2. Gateway application generation
      1. Converting a monolithic application to a microservice gateway
      2. Application generation
        1. Generating a new Gateway
      3. Gateway configuration
      4. JWT authentication
        1. How JWT works
    3. Microservice application -  Invoice Service with MySQL database
      1. Application generation
      2. Microservice configuration
    4. Microservice application - notification service with NoSQL database
      1. Application generation
      2. Microservice configuration
    5. Summary
  17. Working with Microservices
    1. Setting up JHipster Registry locally
      1. Using a pre-packaged WAR file
        1. Building from source
        2. Docker mode
    2. Running a generated application locally
      1. Gateway application pages
      2. JHipster Registry pages
        1. System status
          1. Below renew threshold
        2. Instances registered
        3. General info and health
        4. Application listing page
        5. Metrics page
        6. Health page
        7. Configuration page
        8. Logs page
        9. Swagger API endpoints
      3. Running invoice and notification applications locally
    3.  Modeling entities in JDL 
    4. Entity generation on microservices
      1. Explaining the generated  code
        1. Gateway application
      2. Explaining the generated pages
    5. Summary
  18. Deploying with Docker Compose
    1. Introducing microservice deployment options
      1. A short introduction to Docker Compose
      2. Kickstarting Kubernetes
      3. Introducing OpenShift
      4. Explaining Rancher
    2. Generated Docker Compose files
      1. Walking through the generated files
      2. Building and deploying everything to Docker locally
    3. Generating docker-compose files for microservices
      1. Features of the deployed application
      2. JHipster console demo
      3. Scaling up with Docker Swarm
    4. Summary
  19. Deploying to the Cloud with Kubernetes
    1. Generating Kubernetes configuration files with JHipster
    2. Walking through the generated files
    3. Deploying the application to Google Cloud with Kubernetes
    4. Summary
  20. Using React for the Client-Side
    1. Generating an application with React client side
    2. Technical stack and source code
      1. Technical stacks
        1. Using TypeScript
        2. State management with Redux and friends
        3. Routing with React Router
        4. HTTP requests using Axios
        5. Bootstrap components using Reactstrap
        6. Unit testing setup
      2. Generating source code
    3. Generating an entity with React client side
    4. Summary
  21. Best Practices with JHipster
    1. The next steps to pursue
      1. Adding a shopping cart for the application
      2. Improving end-to-end tests
      3. Improving the CI/CD pipeline
      4. Building a JHipster module
    2. Best practices to keep in mind
      1. Choosing a client-side framework
      2. Choosing a database option
      3. Architecture considerations
      4. Security considerations
      5. Deployment and maintenance
      6. General best practices
    3. Using JHipster modules
    4. Contributing to JHipster
    5. Summary
  22. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think