SHEET 03 · DRAWING REGISTER
DETAIL SHEET 03.4 — P-04
Journal
A journal where one AI call turns each entry into a summary, tags, a mood and to-dos — and the entry is still saved if the AI is down. Part 3 of the series: hexagonal architecture and a rich domain model.
WebREST adapter · planned
EntryUseCasesApplicationservices · ports in / out
DomainEntry · Tag · Todo
EntryStore · TagStore
PersistenceSpring Data JPA · in progress
EntryEnricherAISpring AI · planned
SPECIFICATION
- ARCHITECTURE
- Hexagonal: domain/model, application/port/in and out, adapter/in/web, adapter/out/persistence and ai. ArchUnit fails the build if a boundary is crossed.
- DOMAIN
- A rich domain model — Entry, Tag, Todo — whose objects reject invalid state themselves; application services work through ports only.
- AI
- Planned: one Spring AI call turns an entry into a summary, tags, a mood and to-dos. If the call fails, the entry is still saved (graceful degradation).
- PERSISTENCE
- In progress: a Spring Data JPA adapter on PostgreSQL 18 with Flyway, MapStruct mapping between the domain and JPA entities.
- CONCURRENCY
- Optimistic locking on entries: a concurrent edit is detected by a version column and surfaced as a conflict for the user to resolve.
- API
- Design-first OpenAPI 3.1 contract, written before the code; the planned REST adapter is generated from it.
- TESTING
- 79 tests, written test-first: domain and service unit tests with in-memory fakes, persistence on Testcontainers, ArchUnit on the hexagonal boundaries.
- ADR-0001Hexagonal architecture at P3
- ADR-0002Synchronous AI processing
- ADR-0003Spring AI as the LLM integration library
- ADR-0004No cascade delete to shared tags
- ADR-0005Graceful degradation on AI failure
- ADR-0006Tag normalisation defines tag identity
- ADR-0007Optimistic locking on entries, with user-resolved conflicts
REV. NOTE In progress: the domain model is built and persistence is under way; the web and AI adapters come next.