Skip to content

yannic-md/olympia-website-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

74 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‘ Olympia Website (API) ~ Spring Boot REST-API

This project provides the complete functionality required to process database queries from the frontend and deliver data to it via HTTP requests.

Showcase img

πŸ“‘ Table of Contents


πŸ—―οΈ Introduction

β€Ί This project handles all REST API requests sent by the frontend (olympia-website). Based on these requests, database queries are executed using Spring Boot and JPA Hibernate, and the corresponding responses are returned.

The project is well documented and was created as part of an assignment during training as an IT specialist for application development.

πŸ’ β€Ί It was developed by Yannic Drews, Yanic Doepner, and Nils Sievers. The project follows best practices and, thanks to its clear documentation, can be easily extended.

πŸͺ› Features

β€Ί The project implemented all features that were required within the scope of the requirements specification and functional specification. These include the following features (that the backend needs to do):

  • 🌐 REST API for Frontend Communication: The backend provides a RESTful API that processes all HTTP requests sent by the olympia-website frontend and returns structured JSON responses.

  • πŸ—„οΈ Database Integration with JPA & Hibernate: The application uses JPA with Hibernate to interact with the MySQL database, enabling efficient object-relational mapping and structured data persistence.

  • πŸ“Š Competition Data Management: The API manages the core Olympic tournament entities such as athletes, countries, and competition results.

  • ✏️ Full CRUD Operations: The backend supports Create, Read, Update, and Delete operations for all relevant entities, allowing judges to maintain competition data easily.

  • πŸ” Secure Authentication System: Judges can register and log in through dedicated API endpoints, ensuring that only authenticated users are able to modify competition data.

  • 🧩 Layered Architecture: The application follows a clean layered architecture (Controller β†’ Service β†’ Repository), which separates responsibilities and improves maintainability and scalability.

  • πŸ“¦ DTO Pattern: Data Transfer Objects are used to separate internal database models from API responses, improving security, maintainability, and API clarity.

  • ⚑ Spring Boot Caching: Frequently requested data is cached using Spring Boot’s caching mechanism, improving performance and reducing unnecessary database queries.

  • πŸ“₯ Excel Data Import: The backend supports importing structured Excel files to quickly populate or update competition datasets.

  • 🐳 Easy Setup with Docker: The entire backend environment can be started with a single Docker command, making the setup process fast and beginner-friendly.

  • πŸ“š Well Documented & Extendable: The project follows best practices and is clearly documented, making it easy for developers to understand, maintain, and extend.

πŸ”¨ How can i run the project?

Requirements

β€Ί You need to have Docker Desktop installed and started.

Default Login-Data:

  • Judge1: judge1 / judge1pwd
  • Judge2: judge2 / judge2pwd

Start the project

  1. Clone the repository by using git clone https://github.com/yannic-md/olympia-website-api.git
  2. Switch to the correct folder: cd olympia-website-api
  3. Run docker compose up --build and wait a few minutes.
  4. Run the Angular Frontend (More Details here)
  5. The API is now listening for HTTP requests on http://localhost:8080.

You only need to do that once. From now on, you can start/stop the project in the "Docker Desktop" application.

βš™οΈ Explanation of the Code-Structure

1. General

  • The code is located in the package de.olympia.main.example (in the get-started branch).
  • Every subpackage of de.olympia.main is automatically loaded when the project starts; a manual definition in MainApplication is not required.
  • The structure follows a classic layered architecture (Controller, Service, Repository, Entity).

2. Flyway

  • Flyway is used to manage database migrations.
  • The scripts for creating and updating the database can be found in src/main/resources/db/migration.
  • On every application start, the migrations are executed automatically if necessary.

3. Entity

  • Contains the JPA entities that represent the database tables.
  • In the example, the table countries is represented by the Country class.
  • Each entity is annotated with @Entity so that Hibernate can detect it.
  • @Table(name = "countries") ensures that the exact existing table is used.
  • The primary key is defined using @Id and @GeneratedValue.

4. Repository

  • Contains interfaces for database access.
  • CountryRepository extends JpaRepository.
  • Standard methods such as findAll, findById, and save are automatically available.

5. Service

  • Contains the business logic of the application.
  • Encapsulates access to one or more repositories.
  • Provides methods that are used by controllers.

6. Controller

  • Provides the REST endpoints of the application.
  • Annotated with @RestController.
  • Processes HTTP requests and returns JSON responses.
  • http://localhost:8080/api/countries returns a list of all countries from the database.

About

πŸ“‘ This project provides the complete functionality required to process database queries from the frontend and deliver data to it via HTTP requests.

Topics

Resources

Stars

Watchers

Forks

Contributors