2026-01-09 18:35:06 +01:00
|
|
|
# Mosenioring Backend
|
|
|
|
|
|
|
|
|
|
Production-ready Kotlin/Spring Boot 3 modular monolith skeleton for patient-caregiver-doctor coordination.
|
|
|
|
|
|
|
|
|
|
## Requirements
|
|
|
|
|
- Java 21
|
|
|
|
|
- Docker + Docker Compose
|
|
|
|
|
|
2026-01-12 18:38:15 +01:00
|
|
|
## Local run
|
2026-01-09 18:35:06 +01:00
|
|
|
1) Start dependencies:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
docker compose up -d
|
|
|
|
|
```
|
|
|
|
|
|
2026-01-12 18:38:15 +01:00
|
|
|
2) Run the API (local profile, local auth enabled):
|
2026-01-09 18:35:06 +01:00
|
|
|
|
|
|
|
|
```bash
|
2026-01-12 18:38:15 +01:00
|
|
|
SPRING_PROFILES_ACTIVE=local \
|
|
|
|
|
ALLOW_LOCAL_AUTH=true \
|
|
|
|
|
./gradlew :app:bootRun
|
2026-01-09 18:35:06 +01:00
|
|
|
```
|
|
|
|
|
|
2026-01-12 18:38:15 +01:00
|
|
|
```bash
|
|
|
|
|
SPRING_PROFILES_ACTIVE=dev \
|
|
|
|
|
ALLOW_LOCAL_AUTH=false \
|
|
|
|
|
./gradlew :app:bootRun
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
3) (Optional) Run the worker:
|
2026-01-09 18:35:06 +01:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
./gradlew :workers:notification-worker:bootRun
|
|
|
|
|
```
|
|
|
|
|
|
2026-01-12 18:38:15 +01:00
|
|
|
Required env flags (local/dev):
|
|
|
|
|
- `SPRING_PROFILES_ACTIVE=local`
|
|
|
|
|
- `ALLOW_LOCAL_AUTH=true` (enables local auth headers)
|
|
|
|
|
- `KEYCLOAK_ISSUER_URI=http://localhost:8081/realms/mosenioring` (if using Keycloak)
|
|
|
|
|
- Frontend should set `USE_LOCAL_AUTH=true` when using local auth headers.
|
|
|
|
|
|
2026-01-09 19:47:24 +01:00
|
|
|
## Auth
|
|
|
|
|
- The backend is a JWT resource server and does not handle user passwords.
|
|
|
|
|
- Local auth shortcut is available only when `SPRING_PROFILES_ACTIVE=local`
|
|
|
|
|
and `ALLOW_LOCAL_AUTH=true`.
|
|
|
|
|
|
|
|
|
|
Local headers (dev only):
|
|
|
|
|
- `X-Local-Email`: user id/email
|
2026-01-09 18:35:06 +01:00
|
|
|
- `X-Local-Roles`: comma-separated roles (ADMIN, DOCTOR, CAREGIVER)
|
2026-01-09 19:47:24 +01:00
|
|
|
- `X-Tenant-Id`: tenant id
|
2026-01-09 18:35:06 +01:00
|
|
|
|
|
|
|
|
## OpenAPI
|
|
|
|
|
- http://localhost:8080/swagger-ui/index.html
|
2026-01-09 19:47:24 +01:00
|
|
|
## Health
|
|
|
|
|
- http://localhost:8080/health
|
2026-01-09 18:35:06 +01:00
|
|
|
|
|
|
|
|
## Key services
|
|
|
|
|
- Postgres: localhost:5432 (mosenioring/mosenioring)
|
|
|
|
|
- Keycloak: http://localhost:8081 (admin/admin)
|
|
|
|
|
- RabbitMQ: http://localhost:15672 (guest/guest)
|
|
|
|
|
- MinIO: http://localhost:9001 (minio/minio123)
|
|
|
|
|
|
|
|
|
|
## Notes
|
|
|
|
|
- Tenant ID is enforced via `TenantFilter` using JWT claim `tenant_id`, or `X-Tenant-Id` header (local).
|
|
|
|
|
- Medication plan creation publishes a `MedicationPlanCreated` outbox event.
|
|
|
|
|
- Worker consumes and emits `NotificationRequested` events with idempotency via Redis.
|