This repository contains the source for the backend API for the Netzgrafik-Editor frontend.
- Spring Framework with Spring Boot is used to implement the REST API.
- Data is stores in the PostgreSQL relational database.
- jOOQ is used to access the database through a database-independent SQL-Like Domain-Specific-Language. For that the jOOQ framework generates classes for every table, row, index and sequence in the database. This allows for type-save declarations of SQL queries.
- Flyway migrations are used to manage the database schema (see src/main/resources/db.migration).
- Project Lombok enhances the Java code with additional language features.
- H2 is used as an in-memory database for end-to-end integration tests.
- Java JDK 21
- Maven >= 3.9.7
- Docker and
docker-compose
-
Clone the repository:
git clone https://github.com/SchweizerischeBundesbahnen/netzgrafik-editor-backend.git cd netzgrafik-editor-backend
-
Start the local development environment (PostgreSQL, Keycloak):
docker compose up -d
-
Setup environment variables
export DB_URL=jdbc:postgresql://localhost/netzgrafikeditor export DB_USER=netzgrafikeditor export DB_PASSWORD=netzgrafikeditor export CORS_ALLOWED_ORIGINS=* export AUTH_SERVICE_NAME=fc44839c-e95f-4854-a52d-449867a9aa62
-
Start the app using maven
# run application with Flyway migration mvn spring-boot:run
The database schema is managed using Flyway. Migrations are placed under
src/main/resources/db/migration
and can be executed using maven. Automatic migrations can be disabled using-Dspring.flyway.enabled=false
(see e.g. https://www.baeldung.com/database-migrations-with-flyway)Migrations can also be run separately:
mvn flyway:migrate
This project is licensed under Apache 2.0.
This repository includes a CONTRIBUTING.md file that outlines how to contribute to the project, including how to submit bug reports, feature requests, and pull requests.
This repository includes a CODING_STANDARDS.md file that outlines the coding standards that you should follow when contributing to the project.
To ensure that your project is a welcoming and inclusive environment for all contributors, you should establish a good CODE_OF_CONDUCT.md
This repository uses release-please for CHANGELOG generation, the creation of GitHub releases, and version bumps for your projects. See CI.md for details.