Skip to content
dev-araujoPublic

About

The Bookstore API is a REST CRUD service built with Spring Boot 4.1 and Java 25, featuring AI-generated book summaries powered by Spring AI (Google Gemini).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

License Spring Boot Java Maven PostgreSQL Spring AI

Bookstore API

The Bookstore API is a REST CRUD service built with Spring Boot 4.1 and Java 25, featuring AI-generated book summaries powered by Spring AI (Google Gemini). A learning project demonstrating clean layering, explicit JPA entities, and DTO-to-entity mapping without Lombok.


Stack 🚀

Backend

  • Java 25
  • Spring Boot 4.1.1 (Web MVC, Data JPA, Validation)
  • Spring AI 2.0 — spring-ai-starter-model-google-genai
  • Maven
  • PostgreSQL (Neon) — Hibernate ddl-auto: update

AI Provider

  • Google Gemini API

Environment Configuration 🔐

Before running the project, configure your database and AI credentials:

  1. Copy .env.example and rename it to .env.

  2. Open .env and fill in your values:

    DB_URL=jdbc:postgresql://your-host/bookstore-db?sslmode=require
    DB_USER=your_user
    DB_PASSWORD=your_password
    GEMINI_API_KEY=your_gemini_key

    (The .env file is excluded from Git for security).


Running Locally ⚡️

There are two ways to run the project: manually or with Docker.

Manually ⚒️

Prerequisites: JDK 25+, Maven.

  1. Clone the repository:

    git clone https://github.com/dev-araujo/bookstore-api.git
  2. Run the application:

    mvn spring-boot:run

    Or use the Makefile shortcut:

    make run

⭐ The API will be available at http://localhost:8080.

Other commands: mvn -q verify (build & test), make build.

With Docker 🐋

Prerequisites

Make sure you have Docker and Docker Compose installed.

  1. Clone the repository:

    git clone https://github.com/dev-araujo/bookstore-api.git
  2. Copy the Docker env template and fill in your GEMINI_API_KEY:

    cp .env.example.docker .env.docker

    (Only GEMINI_API_KEY is required — database credentials use sensible defaults).

  3. Run Docker Compose to build the images and start the containers:

    docker compose --env-file .env.docker up --build

⭐ The API will be available at http://localhost:8080.

The compose spins up two services: bookstore-db (PostgreSQL 17) and bookstore-api (application). The database persists through a Docker volume (pgdata).


Architecture & Conventions 🏗️

  • Layering: controllers → services → repositories → models
  • Naming: tables tb_<plural> (e.g. tb_books), entities <Name>Model, input DTOs <Name>RecordDto
  • No Lombok — constructors, getters, and setters are handwritten
  • No field injection — @Autowired on fields is blocked by a guardrail hook
  • BeanUtils.copyProperties used for DTO → entity mapping
  • UUID identifiers for all entities

Author 👷

Adriano P Araujo

About

The Bookstore API is a REST CRUD service built with Spring Boot 4.1 and Java 25, featuring AI-generated book summaries powered by Spring AI (Google Gemini).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages