This is a Java 8 and Spring Boot application that provides a recommendation service for cryptocurrencies. When you start the application (and every day at midnight) the service reads prices from CSV files, calculates various statistics for each cryptocurrency, and stores that data in the H2 in-memory database. The application also exposes several endpoints for retrieving this data.
- CSV files are stored in src/main/resources directory
- If you add more CSV files with different crypto, the application will read them automatically
- If a given CSV file(s) has data of more than a month (6 months, a year), the application will process them accordingly
- If the user requests data of a crypto that is not available, the service will provide an appropriate error with 404 code
- The application is dockerized, so it can be used with Kubernetes
- The application will throw 429 Too Many Requests error if a given user exceeds this service.rate.limit
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Java 8
- Maven
- Docker (optional)
- Clone the repository
git clone https://github.com/isuru-samarasinghe/crypto-recommendation-service.git
- Navigate to the project directory
cd crypto-recommendation-service
- Build the project with Maven
mvn clean install
- Run the application
java -jar target/crypto-recommendation-service-1.0-SNAPSHOT.jar
The application will start running at http://localhost:8080/swagger-ui.html.
If you want to run the application using mvn spring-boot:run
command, makesure to copy application.properties
to the root of the project.
To run the application in a Docker container, build the Docker image and run it:
- Build the project
mvn clean install
- Build the Docker image
docker build -t crypto-recommendation-service .
- Run the Docker container
docker run -p 8080:8080 crypto-recommendation-service
The API documentation is available at http://localhost:8080/swagger-ui.html.
To run the tests, use the following Maven command:
mvn test
To generate the code coverage report, use the following Maven command:
mvn test jacoco:report
This will generate a report in target/site/jacoco/index.html
. Open this file in a web browser to view the report.
Initial coverage report.
- Java 8 - The programming language used
- Spring Boot - The web framework used
- Maven - Dependency Management
- Swagger - Used to generate the API documentation
- Isuru Samarasinghe
This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details