Skip to content

tennyros/make-it-healthy

Repository files navigation

Make it Healthy

CI Status Coverage Java 17 Spring Boot 3.4.4

Make It Healthy is a REST API service for tracking daily calorie intake and user diet.

Tech Stack

Component Version Purpose
Spring Boot 3.4.4 Backend framework
Hibernate ORM (Spring Data JPA) 6.6.11 ORM framework for managing Java persistence with
Maven (wrapper) 3.9.9 Project build tool
PostgreSQL 15+ Database management system
Liquibase 4.31.1 Database migrations
MapStruct 1.6.3 Object mapping (DTO/Entity)
JUnit 5 5.11.4 Test framework for unit tests
Mockito 5.14.2 Test framework for mocking in unit tests
JaCoCo 0.8.13 Test coverage reports
Springdoc OpenAPI 2.8.6 API documentation (Swagger UI for Spring)

Project Structure

Source code structure (dev branch):
src/
├── main/
│   ├── java/
│   │   └── com/github/tennyros/makeithealthy/
│   │       ├── config/      # Configurations
│   │       ├── dto/         # Data Transfer Objects
│   │       │   ├── request/     # Request DTOs
│   │       │   └── response/    # Response DTOs
│   │       │       └── reporting/    # Report DTOs
│   │       ├── entity/      # Data models
│   │       ├── exception/   # Own exceptions
│   │       ├── http/        # REST API
│   │       │   ├── advice/     # Exception Handlers
│   │       │   └── rest/       # REST Controllers
│   │       ├── mapper/      # MapStruct mappers
│   │       ├── repository/  # Data Access Objects
│   │       └── service/     # Business logic
│   └── resources/
│       ├── db/changelog/    # Liquibase migrations
│       ├── application.yml  # Main configuration
│       ├── application-dev.yml   # Development configuration
│       └── application-prod.yml  # Production configuration
├── test/
│   ├── java/
│   │   └── com/github/tennyros/makeithealthy/
│   │       └── unit/        # Unit tests
│   │           ├── controller/   # Controller layer unit tests
│   │           └── service/      # Service layer unit tests
│   └── resources/
│       └── application-test.yml  # Test configuration
├── postman/  # json Postman API test collection
pom.xml

Build artifacts:
target/
├── generated-sources/
│   ├── annotations/
│   │   └── com.github.tennyros.makeithealthy.mapper/  # Auto-generated MapStruct classes
├── reports-report/  # JaCoCo coverage reports

Quick Start

Prerequisites

  1. Java 17+
  2. PostgreSQL 15+ (local, remote or docker container instance)
  3. Maven 3.9.9 (wrapper included)

Setup

1. Clone the repository:

git clone https://github.com/tennyros/make-it-healthy.git
cd make-it-healthy

2. Copy the .env file and change the credentials if necessary:

cp .env.example .env

3. Run PostgreSQL via Docker (optional, if you don’t run own DB):

# Copy the example config (if not customized yet)  
cp docker-compose.example.yml docker-compose.yml  

# Start PostgreSQL in Docker  
docker-compose up -d

If using docker-compose, PostgreSQL will be available at 
localhost:5433 (default credentials: postgres/root).

If you already have PostgreSQL, ensure application.yml/.env matches your DB settings.

4. Application build:

./mvnw clean install -Dspring.profiles.active=dev

5. Run the application:

# Run via terminal:
./mvnw spring-boot:run -Dspring-boot.run.profiles=dev

# Run via Intellij Idea (Shift + F10):
Type dev in Active profiles Edit Configurations of main class to setup profile

Application port is 8008

After this, the API will be available at:

http://localhost:8008/swagger-ui.html

Testing

Test types:

unit/ - Unit tests

Running tests:

# All tests
./mvnw test -Dspring.profiles.active=test

# Run a specific test
./mvnw test -Dspring.profiles.active=test -Dtest=YourTestName

API Testing with Postman

You can test and explore the API using the included Postman collection.

Included File

  • make-it-healthy-app.postman_collection.json – API requests for user, meal, food intake, and reporting operations.

How to Use

  1. Install Postman – Download here.
  2. Open Postman → File > Import → Choose the make-it-healthy-app.postman_collection.json file.
  3. Click on the variable {{url}} in any request and set it to your running API base URL (e.g., http://localhost:8008).
  4. Click Send to test endpoints.

ℹ️ The collection already includes the {{url}} variable pointing to http://localhost:8008. You can edit it if needed.

CI Pipeline

The project is set up with CI to automatically build 
and test on pull requests using GitHub Actions.

Releases

No releases published

Packages

No packages published

Languages