This Java application, built with Java 17 and Quarkus, provides a RESTful API for managing favorite recipes.
- The application is developed using Java 17.
- Quarkus is used as the underlying framework for building the application.
- The application allows users to add, update, remove, and fetch recipes.
- Users can filter recipes based on the following criteria:
- Whether the dish is vegetarian.
- The number of servings.
- Specific ingredients (include or exclude).
- Text search within the instructions.
The project follows a standard Maven project structure. Key files and directories include:
src/main
: Contains the main application code.src/test
: Contains unit and integration tests.pom.xml
: Maven Project Object Model file with project configuration.
The project includes the following dependencies managed by Quarkus:
- Quarkus Container Image Docker
- Quarkus RestEasy Reactive Jackson
- Quarkus Arc
- Quarkus Hibernate ORM Panache
- Quarkus Hibernate Validator
- Quarkus Liquibase
- Quarkus JDBC PostgreSQL
- Quarkus Config YAML
- Quarkus HAL
- Quarkus Hibernate Search ORM Elasticsearch
- Quarkus JUnit 5
Additionally, the following test dependencies are included:
- Testcontainers
- PostgreSQL (Testcontainers)
- Rest Assured
You can build the project and run the application using Docker:
sh ./build-demo.sh // Or chmod +x ./build-demo.sh && ./build-demo.sh
Use the provided docker-compose file to quickly deploy the application
docker compose up -d
Make sure to provide Postgresql and elasticsearch passwords in a .env file
POSTGRES_USER=recipesdb
POSTGRES_PASSWORD=<postgres_password>
ELASTIC_PASSWORD=<elastic_password>
The application includes three independent endpoints:
- The main 'Recipe' endpoint (/recipes) that manage recipes properties and dependencies
- A secondary 'Ingredient' endpoint (/ingredients) that manage ingredients so that they can be shared among different recipes
- A third 'Tag' endpoint (/tags) that allow the creation of recipes' tags making the retrieval of vegetarian recipes easy and allows to extend to any possible tag (for instance 'Asian cuisine', 'Gluten-free' ...)
In addition, comes a search endpoint (/search) to perform full text search based on the recipe and ingredients properties, it uses an Elasticsearch reverse index to index Recipes and ingredient properties.