This is a simple API that allows you to read quotes. All quotes are stored in a database and can be accessed through the API. The API is written in Java 17 and uses the Spring Boot framework. The database is a simple Postgresql database.
The data is provided by Kaggle and contains 500k quotes.
This project was created for learning purposes.
- Java 21 & Maven
- Spring Boot
- Swagger & OpenAPI
- Postgresql
- Docker & Docker Compose
The following environment variables are required to run the API:
POSTGRES_USER
: The username for the databasePOSTGRES_PASSWORD
: The password for the database
You need to set these variables in the docker-compose.yml
file or create a .env
file in the root directory.
Spring boot also requires this environment variables, they are set in the application.properties
file.
The easiest way to run the API is to use Docker.
- Clone the repository
- Create a
.env
file in the root directory and set the environment variables - Change the
localhost
in theapplication.properties
file todb
- Run
docker-compose up
in the root directory - The API is now running on port 8080
If you don't want to use Docker, you can also run the API manually.
- Clone the repository
- Create a Postgresql database
- Set the environment variables
- Run
mvn spring-boot:run
in the root directory - The API is now running on port 8080
If you want to get the data from Kaggle, you need to download the data and import it into the database. (The data is not included in this repository because it is too large) In SQL folder you can find the SQL file to create the table and import the data.
The API documentation is available at /swagger-ui/index.html
when the API is running.
This project is licensed under the MIT License. See the LICENSE file for more information.