This project covers several different technologies used in the industry: docker, docker-compose, dockerize, travis, httpd, docker-maven-plugin, JWT, Java, Microprofile, Jakarta EE, testcontainers, cucumber, nodejs, ReactJS, JSS, Javascript etc. From backend to frontend; From test to production; If you understand all of it, you are a polyglot programmer.
The /api
submodule holds the restful application that contains all the business logic for this system. It’s a standard
Jakarta EE application.
Here you will find examples of:
-
Microprofile login configuration with JWT via
@LoginConfig
; -
Microprofile system configuration via
@ConfigProperty
; -
Microprofile JWT usage via
org.eclipse.microprofile.jwt.JsonWebToken
; -
javax.ws
; -
javax.persistence
; -
Lombok:
@Data
,@EqualsAndHashCode
,@Slf4j
etc; -
Liquibase via CDI (http://www.liquibase.org/documentation/cdi.html);
-
Unit tests with PowerMockRunner.
The /api-docker
submodule is used to build a docker image with Apache TomEE for Microprofile and the restful
application created by /api
.
Here you will see the first example of usage of the docker-maven-plugin from fabric8.
This submodule contains all the thirdparty docker images that are shareable across our submodules. It currently contains
a custom docker image for dockerize
(https://github.com/jwilder/dockerize - an amazing tool for running docker processes).
/ui
is the ReactJS application that builds the user interface. It’s wrapped inside a maven module but it can still be used as
a plain nodejs application. See documentation bellow to see how this works.
/ui-docker
is the module that builds the production-ready code out of the /ui
source code and wraps it behind a
simple httpd server.
/ft
holds the functional tests for both backend and frontend. It’s a selenium
`cucumber`testcontainers
testing
framework packed in a jar file. The tests are triggered by maven, but we can also run them via the todo.ft.Main
class.
Here you will find examples of cucumber, selenium and test containers.
/ft-docker
packages the functional tests in a docker image so we can run the tests from inside a docker network
(docker-compose or kubernetes, for example). You can see this working if you run docker-compose up
from the root directory
of this project.
First start the dependencies with…
docker-compose down
docker-compose up
The production application will be available at http://localhost
Now, from another terminal, start the react application (dev mode) with…
cd ui/src/main/node
npm install
npm start
The command above will open your browser automatically on http://localhost:3000
From now on, every time you change the source code under ui/src/main/node/src
, the page at http://localhost:3000 will
be automatically updated.
In order to build the production code, run mvn clean install
again.