Sample web-application to solve the "fishermen leaderboard" coding problem.
To run it, execute:
docker-compose up
Then, open your browser and browse to http://localhost/.
fishermen-leaderboard
is composed of 3 components, built and started as docker containers:
ui
, which is a NextJS front-end application, binding on port3000
api
, which is a Java 11 web application, based on Spring Boot and built with maven, binding on port8080
proxy
, which is an Nginx instance, acting as a reverse proxy to other components (/api
forapi
, fallback toui
on all other locations), binding on port80
Links between containers are through host ports in order to be fully supported on Docker Desktop (eg: on MacOS).
See TODO to follow development steps.
As we have two APIs to be consumed and correlated (fishermen
and recollections
), this would not be possible in real-time. So, the main goal of api
component is preparing ready-to-use content, for ui
component. This is achieved by in-memory pre loading content, and a scheduled "refresh" on a given interval (1h by default). See:
RefreshingStorage
and its@Scheduled
annotationapplication.schedule.refreshing-storage.minutes
in application.properties configuration file.
APIs integration is using an API-KEY, which is not exposed to clients. Both API-KEY and base URL can be configured in application.properties as application.ogyre.api-key
and application.ogyre.base-uri
.
ui
component is basically a NextJS starter application, reusing its default template. Decoupling from data fetching and presentation is achieved by leveraging on useFishermen.tsx custom hook. Please note: no configuration is available at the moment for its base URL, as it's hard-coded in the hook code (and being set to work on its docker-based setup).
Two reusable ui
components are availbale in components folder, to present FishermanCard
on homepage, and RecollectionDetails
on detail page.
In order to test the end-to-end build and deployment setup, few additional resources have been prepared:
- build.sh, building and publishing docker images to Github Packages
- deploy.sh, deploying to an
AWS
ECS
cluster, with yoke. Please, seedeployment
folder for related resources
Feel free to provide any feedback!