Skip to content

JeroenAdam/ta3lim

Repository files navigation

ta3lim

Spring Boot production ready web application with 10 JPA entities and REST API's. Oauth 2.0 + Elasticsearch integration.

This application was generated using JHipster 7.9.2, you can find documentation and help at https://www.jhipster.tech/documentation-archive/v7.9.2.

Project Structure

Node is required for generation and recommended for development. package.json is always generated for a better development experience with prettier, commit hooks, scripts and so on.

In the project root, JHipster generates configuration files for tools like git, prettier, eslint, husky, and others that are well known and you can find references in the web.

/src/* structure follows default Java structure.

  • .yo-rc.json - Yeoman configuration file JHipster configuration is stored in this file at generator-jhipster key. You may find generator-jhipster-* for specific blueprints configuration.

  • .yo-resolve (optional) - Yeoman conflict resolver Allows to use a specific action when conflicts are found skipping prompts for files that matches a pattern. Each line should match [pattern] [action] with pattern been a Minimatch pattern and action been one of skip (default if ommited) or force. Lines starting with # are considered comments and are ignored.

  • .jhipster/*.json - JHipster entity configuration files

  • npmw - wrapper to use locally installed npm. JHipster installs Node and npm locally using the build tool by default. This wrapper makes sure npm is installed locally and uses it avoiding some differences different versions can cause. By using ./npmw instead of the traditional npm you can configure a Node-less environment to develop or test your application.

  • /src/main/docker - Docker configurations for the application and services that the application depends on

Development

Before you can build this project, you must install and configure the following dependencies on your machine:

  1. [Node.js][]: We use Node to run a development web server and build the project. Depending on your system, you can install Node either from source or as a pre-packaged bundle.

After installing Node, you should be able to run the following command to install development tools. You will only need to run this command when dependencies change in package.json.

npm install

We use npm scripts and [Webpack][] as our build system.

Run the following commands in two separate terminals to create a blissful development experience where your browser auto-refreshes when files change on your hard drive.

./mvnw
npm start

Npm is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by specifying a newer version in package.json. You can also run npm update and npm install to manage dependencies. Add the help flag on any command to see how you can use it. For example, npm help update.

The npm run command will list all of the scripts available to run for this project.

OAuth 2.0 / OpenID Connect

You'll need to have Keycloak up and running.

Building for production with Docker Jib

To build the Docker image, run:

./mvnw package -Pprod -DskipTests jib:build

This requires adding the jib-maven-plugin to pom.xml and having an image path (eg. docker.io) ready for use.

Testing

To launch your application's tests, run:

./mvnw verify

Client tests

Unit tests are run by [Jest][]. They're located in src/test/javascript/ and can be run with:

npm test

UI end-to-end tests are powered by [Cypress][]. They're located in src/test/javascript/cypress and can be run by starting Spring Boot in one terminal (./mvnw spring-boot:run) and running the tests (npm run e2e) in a second one.

Lighthouse audits

You can execute automated [lighthouse audits][https://developers.google.com/web/tools/lighthouse/] with [cypress audits][https://github.com/mfrachet/cypress-audit] by running npm run e2e:cypress:audits. You should only run the audits when your application is packaged with the production profile. The lighthouse report is created in target/cypress/lhreport.html

For more information, refer to the [Running tests page][].

Code quality

Sonar is used to analyse code quality. You can start a local Sonar server (accessible on http://localhost:9001) with: For more information, refer to the [Code quality page][].

Continuous Integration (optional)

To configure CI for your project, run the ci-cd sub-generator (jhipster ci-cd), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information.