CalorieX is a Spring Boot RESTful API for calorie tracking.
- REST API with
/apiprefix - Swagger UI at
/swagger-ui - PostgreSQL integration
- Profiles:
dev(includes test dataset preload)
You can choose one of the following:
-
Docker Desktop
Recommended for most platforms. It includes both Docker Engine and Docker Compose. -
Docker Engine + Docker Compose
Install separately, typically on Linux servers.
✅ Java, Maven, and PostgreSQL are not required when running via Docker Compose.
- Java 21
- Maven 3.9+
- PostgreSQL installed locally or in Docker
-
Create a
.envfile with:DB_USER=your_user DB_PASSWORD=your_password
-
Build and run:
docker-compose up --build
-
Access the API:
- API root: http://localhost:8080/api
- Swagger UI: http://localhost:8080/swagger-ui
-
Set up PostgreSQL locally and create a
caloriex_dbdatabase. -
Create
src/main/resources/secret/secret.properties (replace port5432if your PostgreSQL uses a different one):DB_URL=localhost:5432/caloriex_db DB_USER=your_user DB_PASSWORD=your_password
-
Run with Maven:
-
Standard launch
mvn spring-boot:run
-
Launch with
devprofile (preloads test dataset)mvn spring-boot:run -Dspring-boot.run.profiles=dev
-
-
Alternatively, build and run the JAR:
-
Build the JAR
mvn clean package
-
Run (default profile)
java -jar target/CalorieX-0.0.1-SNAPSHOT.jar
-
Run with
devprofile (preloads test dataset)java -jar target/CalorieX-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev
-
- The application architecture is simplified for demonstration purposes.
- Additional features like improved and expanded business logic and Spring Security (e.g. JWT-based authorization) can be added if needed.
- Swagger docs:
/v1/api-docs - Swagger UI:
/swagger-ui - API base:
/api
To run unit tests, use:
mvn test -P unitTo run integration tests, use:
mvn test -P integrationTo run all tests (unit and integration), use:
mvn testNote: RestAssured tests are currently under development.
Apache 2.0
Defined by @project.version@ in Maven.