Skip to content

JL-SH/AIFit-Backend

Repository files navigation

AIFit-Backend

English · Español

Java Spring Boot PostgreSQL

Companion repository: this project is the REST API backend for AIFit. The Android client lives in a separate repository.

The mobile app consumes this API for authentication, AI plan generation, chat, vision, and data persistence.


Description

AIFit API is a Spring Boot 3 service that powers the AIFit fitness and nutrition platform. It exposes a versioned REST API (/api/v1/), persists data in PostgreSQL, orchestrates Google Gemini for personalized plans and coaching, and integrates Cloudinary for profile images.

The backend follows hexagonal architecture (ports & adapters): domain rules are isolated from Spring Web, JPA, and external AI providers.

This repository is part of the author's Final Degree Project (TFG).


Documentation

Extended documentation lives under docs/ in English and Spanish (.es.md suffix).

English Español Purpose
docs/ARCHITECTURE.md docs/ARCHITECTURE.es.md Hexagonal architecture, layers, and ports
docs/API_REFERENCE.md docs/API_REFERENCE.es.md All REST endpoints
docs/SETUP.md docs/SETUP.es.md Local setup and run
docs/DATABASE.md docs/DATABASE.es.md Schema, Flyway migrations, entities
docs/AI_INTEGRATION.md docs/AI_INTEGRATION.es.md Gemini AI adapters and prompts
docs/DEPLOYMENT.md docs/DEPLOYMENT.es.md Docker and Railway deployment
docs/TESTING.md docs/TESTING.es.md Testing strategy and commands

Interactive API docs: Swagger UI when running locally.


Tech stack

Technology Purpose
Java 21 Language runtime
Spring Boot 3.4 Web, security, validation, actuator
Spring Data JPA Persistence
PostgreSQL 16 Primary database
Flyway Schema migrations (V1V37)
Spring Security + JWT Stateless authentication
Google Gemini AI plans, coach, vision, education
Cloudinary Profile photo storage
MapStruct + Lombok DTO/entity mapping
springdoc-openapi Swagger / OpenAPI
Testcontainers Integration tests with real Postgres
JaCoCo Coverage (80% minimum on configured packages)

Quick start

git clone https://github.com/JL-SH/AIFit-API.git
cd AIFit-API
cp .env.example .env   # if available; otherwise create .env (see SETUP.md)
docker compose up -d

API base URL: http://localhost:8080/api/v1/

See docs/SETUP.md for environment variables, Gradle run, and Google/Gemini keys.


Project structure

AIFit-Backend/
├── src/main/java/com/jslh/aifit/
│   ├── domain/           # Models, ports (in/out), domain services
│   ├── application/      # Use case implementations
│   ├── infrastructure/   # JPA, Gemini, security, Cloudinary
│   └── presentation/     # REST controllers, requests, responses
├── src/main/resources/
│   ├── application.properties
│   └── db/migration/     # Flyway SQL (V1–V37)
├── src/test/
├── Dockerfile
├── docker-compose.yml
├── docs/
├── README.md
└── README.es.md

Prerequisites

Requirement Version
JDK 21
Docker For local Postgres + app (recommended)
Gemini API key Required for AI features
PostgreSQL 16 (via Docker or native)

License

This project is released under the MIT License. See LICENSE for the full text.

About

Spring Boot 3 REST API for the AIFit platform. Built with Java 21, Hexagonal Architecture, PostgreSQL, and Google Gemini AI integration.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages