From 2554f5aa0397111fc786a04f87c8e084f06a05da Mon Sep 17 00:00:00 2001 From: sindrelm Date: Thu, 30 Apr 2026 15:02:44 +0200 Subject: [PATCH 1/2] Add readME Signed-off-by: sindrelm --- README.md | 53 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 0387ef0b..1e8758ac 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,46 @@ -# Nettdetektivene backend +# Nettdetektivene Backend -## Local configuration +This is the backend for Nettdetektivene. It is a Kotlin + Spring Boot application that provides the API used by the frontend. -Spring loads optional local config from `.env` and `.env.dev` in the project root. +To run this properly, check out the full `nettdetektivene` repository. Tests and local development are expected to be run from the main repo, together with Docker. -- `.env`: shared local defaults for the team -- `.env.dev`: machine-specific developer overrides -- `src/test/resources/application.properties`: isolated test-only config +## Architecture -The application code does not contain environment-specific secrets or URLs. Runtime values come from configuration only, and startup fails if required security config is missing. +The backend is mostly organized by feature. -Both files use standard `KEY=value` property lines. Start by copying: +- `app` and `app/config`: application setup and shared Spring configuration +- `iam`: authentication, registration, JWT, and security-related logic +- `classroom`: classroom management for teachers and pupils +- `game`: game flow, map stops, tasks, and pupil progress +- `mystery`: mystery content and teacher mystery management +- `notification`: inbox, delivery, and notification events +- `notebook`, `leaderboard`, `medals`, `moderation`, `users`, `xp`: feature-specific domains and APIs +- `shared`: shared utilities and events -```bash -cp .env.example .env -cp .env.dev.example .env.dev -``` +Most features follow roughly the same structure: -## Environment model +- `api`: controllers and request/response DTOs +- `application`: service-layer logic +- `domain`: entities and core domain models +- `infrastructure`: repositories and persistence details -- Dev: `.env` plus optional `.env.dev` -- CI: GitHub Actions secrets / environment variables -- Docker or prod: container environment variables or a secret manager mounted as env +## Tests -The same property keys are used in every environment, so you do not need to change Kotlin code when moving from local development to CI or production. +Run backend tests from the main `nettdetektivene` setup with Docker, not from this folder in isolation. + +The backend has a mix of: + +- unit and service-level tests for business logic +- integration tests for controllers, persistence, and API behavior +- Spring Boot test coverage for full application flows + +The test suite uses JUnit 5 with Spring Boot test support. There is also JaCoCo coverage reporting configured in Gradle. ## Formatting -The project now enforces one shared code style for Kotlin and Gradle files through Gradle and CI. +Formatting is enforced through Spotless. -- Check formatting: `./gradlew spotlessCheck` -- Apply the project format: `./gradlew spotlessApply` +- `spotlessCheck`: checks that Kotlin and Gradle files follow the project format +- `spotlessApply`: applies the project format automatically -`./gradlew check` also runs the formatting check, and GitHub Actions will fail if pushed code does not match the checked-in style. +Formatting is also part of the Gradle `check` flow, so CI will fail if the code style does not match. From c5cfb6109761f6df01d6ba535c73845d09f40677 Mon Sep 17 00:00:00 2001 From: sindrelm Date: Thu, 30 Apr 2026 15:05:14 +0200 Subject: [PATCH 2/2] Update readme Signed-off-by: sindrelm --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1e8758ac..fe5f8ecf 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ To run this properly, check out the full `nettdetektivene` repository. Tests and ## Architecture -The backend is mostly organized by feature. +The backend is organized by feature. - `app` and `app/config`: application setup and shared Spring configuration - `iam`: authentication, registration, JWT, and security-related logic @@ -17,7 +17,7 @@ The backend is mostly organized by feature. - `notebook`, `leaderboard`, `medals`, `moderation`, `users`, `xp`: feature-specific domains and APIs - `shared`: shared utilities and events -Most features follow roughly the same structure: +Features follow the same structure: - `api`: controllers and request/response DTOs - `application`: service-layer logic