TODO: Describe implemented use cases.
./gradlew clean build -x test && docker compose up --build
API documentation will be available at http://localhost:8090.
curl -i http://localhost:8080/api/v1/authors
curl -i http://localhost:8080/api/v1/authors/espFx31ogpynhXHNJ2TW72
curl -i http://localhost:8080/api/v1/articles
curl -i http://localhost:8080/api/v1/articles/5hAthjCg7vobqEgG6WDruY
By author ID:
curl -i 'http://localhost:8080/api/v1/articles?authorId=espFx31ogpynhXHNJ2TW72'
By topics:
curl -i 'http://localhost:8080/api/v1/articles?tags=motorcycling'
By date range:
curl -i "http://localhost:8080/api/v1/articles?publicationDateStart=$(date +%Y-%m-%d)"
curl -i http://localhost:8080/api/v1/articles \
-H 'Authorization: Basic YWRtaW46cEA1NXcwcmQ=' \
-H 'Content-Type: application/json' \
--data '{
"title": "The Motorcycle Gangs: Losers and Outsiders",
"description": "Reflections and insights into the Hell'\''s Angels motorcycle club and their engagement in criminal activities.",
"body": "Some fancy text goes here.",
"tags": ["california", "criminal"],
"authors": ["espFx31ogpynhXHNJ2TW72"]
}'
curl -i http://localhost:8080/api/v1/articles/5hAthjCg7vobqEgG6WDruY \
-X PUT \
-H 'Authorization: Basic YWRtaW46cEA1NXcwcmQ=' \
-H 'Content-Type: application/json' \
--data '{
"description": "Here goes a better description."
}'
curl -i http://localhost:8080/api/v1/articles/5hAthjCg7vobqEgG6WDruY \
-H 'Authorization: Basic YWRtaW46cEA1NXcwcmQ=' \
-X DELETE
This project is not perfect and could be improved in certain areas.
- Build the app and run tests with Docker Compose
- Split the pipeline into multiple jobs
- Configure parallelism
- Scan project dependencies for vulnerabilities
- Create a Helm chart to deploy the app in K8s
Ideally, we'd use OAuth 2 with Keycloak. Given the time constraint, however, some endpoints require Basic
authentication instead.
(In-memory user credentials: admin:p@55sw0rd
.)
Rate limiting is out of the scope of this project, but it's something that we'd definitely need in a production environment.
Once published, news articles rarely change. It makes sense to cache them for improved performance.
There's none š¤· Consider extending PagingAndSortingRepository
.
-
Write app logs as JSON - Configure log collection (e.g., Fluentd)
-
Expose Prometheus metrics at http://localhost:8080/metrics - Set up a RED dashboard with Grafana
-
Configure tracing and trace collection
-
Configure DB connection pool -
Validate@RequestBody
payloads
This project is licensed under the terms of the MIT license. See the LICENSE file for details.