Skip to content

NikolaiT1986/CalorieX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CalorieX REST API

CalorieX is a Spring Boot RESTful API for calorie tracking.


⚡ Features

  • REST API with /api prefix
  • Swagger UI at /swagger-ui
  • PostgreSQL integration
  • Profiles: dev (includes test dataset preload)

⚙ Requirements

For Docker Compose

You can choose one of the following:

✅ Java, Maven, and PostgreSQL are not required when running via Docker Compose.

For Local Development (without Docker)

  • Java 21
  • Maven 3.9+
  • PostgreSQL installed locally or in Docker

🚀 Run with Docker Compose

  1. Create a .env file with:

    DB_USER=your_user
    DB_PASSWORD=your_password
  2. Build and run:

    docker-compose up --build
  3. Access the API:


🪖 Run locally (without Docker)

  1. Set up PostgreSQL locally and create a caloriex_db database.

  2. Create src/main/resources/secret/secret.properties (replace port 5432 if your PostgreSQL uses a different one):

    DB_URL=localhost:5432/caloriex_db
    DB_USER=your_user
    DB_PASSWORD=your_password
  3. Run with Maven:

    • Standard launch

      mvn spring-boot:run
    • Launch with dev profile (preloads test dataset)

      mvn spring-boot:run -Dspring-boot.run.profiles=dev
  4. 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 dev profile (preloads test dataset)

      java -jar target/CalorieX-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev  

✍ Notes

  • 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.

📄 Useful Paths

  • Swagger docs: /v1/api-docs
  • Swagger UI: /swagger-ui
  • API base: /api

🧪 Testing

To run unit tests, use:

  mvn test -P unit

To run integration tests, use:

  mvn test -P integration

To run all tests (unit and integration), use:

  mvn test

Note: RestAssured tests are currently under development.


⚖ License

Apache 2.0


📊 Version

Defined by @project.version@ in Maven.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors