Skip to content

ippontech/iroco2-backend

IroCO2 Backend

This project is part of IroCO2. You are not in the principal repository. For any general information about the project, please refer to the principal repository.

This is the backend of the IroCO2 application. Developed using Java 21 and Spring Boot 3.2.4.


πŸš€ Getting Started

Prerequisites

  • Java 21 (tested with Eclipse Temurin 21)
  • Maven 3.8+
  • Docker & Docker Compose (for local development and database)
  • PostgreSQL (local or via Docker)

Installation

  1. Clone the repository:
    git clone https://github.com/ippontech/iroco2-backend.git
    cd iroco2-backend
  2. Build the project:
    mvn clean install

Run in development

With Docker Compose (recommended)

  1. Start the database and tools:
    docker compose -f docker/local.docker-compose.yml up -d
  2. Run the backend (in another terminal):
    mvn spring-boot:run

Without Docker

  • Make sure a PostgreSQL instance is running and accessible (see docker/local.docker-compose.yml for env vars).
  • Update the application.properties or use environment variables as needed.
  • Run:
    mvn spring-boot:run

πŸ“¦ Project Structure

  • domain/ : Domain model and business rules
  • infrastructure/ : Infrastructure layer with Main Spring Boot application (external services, adapters)
  • docker/ : Dockerfile, local development and CI tools (compose, scripts)
  • docs/ : Backend documentation
  • tf/ : Terraform infrastructure as code

πŸ§ͺ Testing

  • Unit and integration tests via Maven:
    mvn test
  • Cucumber BDD tests included
  • Testcontainers used for integration tests (PostgreSQL, Localstack)

πŸ›‘οΈ Security & Auth

  • Spring Security + JWT (see configuration in infrastructure module)
  • OAuth2 test support via spring-addons-oauth2-test

🧹 Code Formatting with Prettier (Java)

We use Prettier Java to ensure consistent code formatting for Java files.

Setup (one-time)

  1. Install Node modules:
    npm ci
  2. (Recommended) Install the File Watchers plugin in your IDE and configure it as follows:
    • Name: Prettier Java
    • File Type: Java
    • Program: npx
    • Arguments: prettier --write $FilePath$
    • Output path to refresh: $FilePath$
    • Trigger the watcher on external changes: checked
    • Autosave edited files to trigger the watcher: checked

Format all Java files

npx prettier --write "**/*.java"

Git LF/CRLF configuration

By default, Git on Windows may convert line endings (LF β†’ CRLF). Our Prettier config enforces LF. To avoid unwanted conversions, run one of the following:

git config --system core.autocrlf false  # per-system
git config --global core.autocrlf false  # per-user
git config --local core.autocrlf false   # per-project

🧭 Local SonarQube Usage

We use SonarQube for static code analysis and code quality.

Start SonarQube locally

docker compose -f docker/local.docker-compose.yml up

Configuration

  • Access SonarQube at http://localhost:9001
  • Login: admin / admin (change the password after first login)
  • Create a new project named iroco-backend with default branch develop
  • Choose "locally" analysis mode and generate a new token
  • Export the token as an environment variable:
    export LOCAL_SONAR_TOKEN=your_token_here
  • Run analysis:
    mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify sonar:sonar \
      -Dsonar.projectKey=iroco-backend \
      -Dsonar.host.url=http://localhost:9001 \
      -Dsonar.login=$LOCAL_SONAR_TOKEN

πŸš€ Deploy

After building the Java application, you will need to build and push the docker image to your repository. Use the Dockerfilek in the docker/ directory.

Then you can deploy the application using Terraform.

WIP: More docs to come.

πŸ“ License

Distributed under the Apache 2.0 License. See LICENSE for more information.


πŸ“„ Documentation

See docs/ for technical documentation.

For ADRs and workflow documentation, see the [principal repository](https://github.com/ippontech/iroco2/blob/main/contribute/adr/ and https://github.com/ippontech/iroco2/tree/main/contribute/workflows).

🀝 Contributing

See CONTRIBUTING.md

About

Backend API for the IroCO2 project

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •