mosenioring/back001
oskar e5f7c3ee19 Add unit tests for core service modules and update build dependencies for testing
- Added unit tests for `AuditService`, `BaseEntity`, `MedicationPlanService`, and `MessageService`.
- Updated Gradle test dependencies across modules to include `mockito-core` and `mockito-kotlin`.
2026-01-12 23:22:00 +01:00
..
app works 2026-01-12 22:26:08 +01:00
common Add unit tests for core service modules and update build dependencies for testing 2026-01-12 23:22:00 +01:00
docker/keycloak doesnt work 2026-01-12 18:38:15 +01:00
gradle/wrapper init backend 2026-01-09 18:35:06 +01:00
modules Add unit tests for core service modules and update build dependencies for testing 2026-01-12 23:22:00 +01:00
workers/notification-worker init backend 2026-01-09 18:35:06 +01:00
.gitignore init backend 2026-01-09 18:35:06 +01:00
build.gradle.kts init backend 2026-01-09 18:35:06 +01:00
docker-compose.yml codex auto review 2026-01-09 18:40:59 +01:00
gradle.properties init backend 2026-01-09 18:35:06 +01:00
gradlew init backend 2026-01-09 18:35:06 +01:00
gradlew.bat init backend 2026-01-09 18:35:06 +01:00
README.md Improved README.md with restructured sections, better formatting, and added examples for local development, testing, and architecture overview. 2026-01-12 22:50:15 +01:00
requests.http init backend 2026-01-09 18:35:06 +01:00
settings.gradle.kts init backend 2026-01-09 18:35:06 +01:00

Mosenioring Backend

Production-ready Kotlin/Spring Boot 3 modular monolith skeleton for patient-caregiver-doctor coordination.

🏛 Architecture

This project follows a Modular Monolith architecture:

  • app: Main entry point, configuration, and shared controllers.
  • common: Cross-cutting concerns (security, tenant handling, outbox pattern).
  • modules/*: Independent business modules (Clinical, Identity, Messaging, etc.).
  • workers/*: Background event consumers/processors.

🛠 Requirements

  • Java 21
  • Docker + Docker Compose

🚀 Local Run

1. Start Dependencies

docker compose up -d

2. Run the API

Choose a profile:

Local Development (with mock auth):

SPRING_PROFILES_ACTIVE=local ALLOW_LOCAL_AUTH=true ./gradlew :app:bootRun

Allows bypassing Keycloak using X-Local-* headers.

Dev Mode (with Keycloak):

SPRING_PROFILES_ACTIVE=dev ./gradlew :app:bootRun

3. Run the Worker (Optional)

./gradlew :workers:notification-worker:bootRun

🧪 Testing

Run all tests:

./gradlew test

🔐 Auth & Multi-tenancy

  • JWT Resource Server: Uses Keycloak by default.
  • Multi-tenancy: Enforced via X-Tenant-Id header (local) or tenant_id JWT claim.
  • Local Auth Headers (only when ALLOW_LOCAL_AUTH=true):
    • X-Local-Email: User identity.
    • X-Local-Roles: e.g., ADMIN, DOCTOR, CAREGIVER.
    • X-Tenant-Id: Target tenant.

📝 Notes

  • Outbox Pattern: Medication plans publish events to an outbox table for reliable messaging.
  • Idempotency: Workers use Redis to ensure events are processed only once.