- on app startup will get
app.client.migration.ids
properties and migrate the OpenMovie's to Movie DB- after that it's not necessary to get Movie from external API
- just for simulate some external dependency, when
critics
are requested will get them from OpenMovie's API (for getting updated votes & califications)- a circuit breaker was implemented in order to avoid cascade failures
- TODO: add cache in order to avoid too may requests
-
start a MongoDB instance
docker-compose up
-
package app
./mvnw package
-
run app (let's suppose the key is "88888")
java -jar -Dapp.client.key=88888 infra/target/infra-0.0.1-SNAPSHOT.jar
-
check swagger page
http://localhost:8080/swagger-ui/
The application architectue tried to accomplish (basically) the Uncle's Bob clean architecture:
I usually build a multimodule project divided in two parts:
in domain layer all the business entities, interfaces (repositories, clients, events) are abstracted, so we can work in the Actions, pure business logic.
in infra layer all interfaces details are implemented (mongo repository, http client, circuit breaker, etc). there we can decide to use Springboot or another framework like Micronaut.
'cause I like Railway Oriented Programming https://fsharpforfunandprofit.com/rop/ I like to design solutions using Either just to avoid complexity.
- Add MockMvc tests in order to get nice coverage
- Add cache for API requests (evaluating to use https://github.com/konrad-kaminski/spring-kotlin-coroutine for @Cacheable annotation on coroutines)
- add JWT validation & role access for API endpoints
- improve swagger doc w/model examples, error returns
- Add repositories tests