Local development

Getting started

Prepare Java and Docker, start PostgreSQL, run Spring Boot, and inspect the local API documentation.

Prerequisites

ToolRequirementPurpose
JavaJDK 21Compile and run the Spring Boot application.
MavenMaven 3.9+ or the included wrapperGenerate sources, test, package, and produce reports.
DockerCurrent Docker Desktop or Docker EngineRun PostgreSQL, Testcontainers, and the complete Compose stack.
Docker ComposeCompose v2 (docker compose)Start the database and application together.
GitCurrent stable releaseClone and work with the repository.

Confirm the active toolchain before the first build:

java -version
mvn -version
docker version
docker compose version

The repository includes mvnw and mvnw.cmd. Replace mvn with ./mvnw on Unix-like systems or .\mvnw.cmd on Windows when Maven is not installed globally.

Clone and inspect the project

git clone https://github.com/DanieleMasone/identity-service.git
cd identity-service

The main source locations are:

  • src/main/java: handwritten application, domain, persistence, and infrastructure code.
  • src/main/resources/openapi: the source OpenAPI contract.
  • src/main/resources/db/migration: versioned Flyway migrations.
  • src/test/java: unit, web-layer, repository, and integration tests.
  • docs: source files for the static dashboard and this guide.

Configure the local environment

The defaults are suitable for the repository's local PostgreSQL container:

VariableDefaultUsed by
DB_USERNAMEpostgresSpring Boot and Docker Compose
DB_PASSWORDpostgresSpring Boot and Docker Compose
SPRING_DATASOURCE_URLjdbc:postgresql://localhost:5432/identity_dbOptional Spring Boot override

Docker Compose reads an optional repository-root .env file. It is ignored by Git and must not contain shared or production credentials.

Run locally with Maven

Start PostgreSQL first, then launch the application in a second terminal:

docker compose up -d db
mvn spring-boot:run

Flyway applies pending migrations during startup and Hibernate validates the resulting schema. The application listens on http://localhost:8080/api.

Verify startup

  1. Wait for the Spring Boot log to report that IdentityServiceApplication has started.
  2. Open local Swagger UI.
  3. Use the documented v1 or v2 endpoints, or import the Postman collection.

Local runtime only: Swagger UI requires the running Spring Boot application. The public GitHub Pages site exposes generated static OpenAPI documentation instead.