Paperless / rebuild
Course 2 28ef273

Paperless backend: architecture by implementation

Snapshot 28ef273Markdown

Understand the backend by tracing real code, then build one vertical slice yourself.

Foundations

01

Build graph and the first request

Code walkthrough · practice · verification gate

02

Architecture and domain-driven design

Code walkthrough · practice · verification gate

03

Kotlin features through a Java lens

Code walkthrough · practice · verification gate

Boundaries

04

HTTP contracts and thin controllers

Code walkthrough · practice · verification gate

05

The persistence anti-corruption layer

Code walkthrough · practice · verification gate

06

MapStruct and explicit mapping decisions

Code walkthrough · practice · verification gate

Consistency

07

Transactions, versions, and locking

Code walkthrough · practice · verification gate

08

Document lifecycle and file consistency

Code walkthrough · practice · verification gate

Use cases

09

Authentication, teams, and authorization

Code walkthrough · practice · verification gate

10

Search, Kotlin collections, and architectural evolution

Code walkthrough · practice · verification gate

Verification

11

Tests as architectural evidence

Code walkthrough · practice · verification gate

12

Capstone: extend one vertical slice

Code walkthrough · practice · verification gate

Course 02 follows the Kotlin/Spring backend at /home/friedcutlet/Projects/SWEN3-Paperless/paperless-backend. Learn architecture, domain-driven design, the persistence Anti-Corruption Layer, MapStruct, Kotlin compared with Java, and the consistency rules behind real document operations.

The source baseline is commit 28ef27347fb16e076f24449a78072f480bd443d9, captured on 2026-10-26 from a clean checkout. The bundled reference includes all 135 tracked backend files plus 16 repository guidance/deployment/CI files. Generated outputs, downloaded dependencies, local configuration, and the frontend are excluded. File hashes are recorded in the manifest.

Start with the assessment review

Read the grading alignment and backend review before copying the implementation. The supplied rubric and twelve lecture PDFs reveal unfinished requirements and architectural improvements. The existing 131 tests pass, but five additional checks reproduce lost updates, incorrect HTTP errors, and invalid upload acceptance. The report maps every grading row to evidence and separates the checked-out baseline from newer local queue branches.

How to use the course

Read the explanation, follow the complete selected source listings in the website, then perform the practice exercise in a separate checkout. Every chapter has a verification gate. The source browser and raw downloads contain the full pinned backend, so the website builds without the original repository. Saved chapter progress belongs to this course independently of Yokan.

This is a focused architecture and implementation course. Selected files appear inline at the teaching steps; all remaining tracked backend files are available in the source reference. Exercises and future improvements are labeled separately from the current implementation. Source evidence establishes what is currently implemented; the assessment material and stated API contracts establish expectations to check it against. Existing code is not automatically the correct design.

Learning path

Chapter Focus
01 Build graph and the first request
02 Architecture and domain-driven design
03 Kotlin features through a Java lens
04 HTTP contracts and thin controllers
05 The persistence anti-corruption layer
06 MapStruct and explicit mapping decisions
07 Transactions, versions, and locking
08 Document lifecycle and file consistency
09 Authentication, teams, and authorization
10 Search, Kotlin collections, and architectural evolution
11 Tests as architectural evidence
12 Capstone: extend one vertical slice

Milestones

  • Foundations, 01–03: explain build generation, domain vocabulary, dependency direction, and Kotlin semantics.
  • Boundaries, 04–06: trace DTO/domain/entity translations and implement a persistence port without leaking entities.
  • Consistency, 07–08: preserve versions, reason about authorization races, and distinguish database rollback from file compensation.
  • Use cases, 09–10: follow authentication, team access, and the current in-memory search; design a future external-search adapter.
  • Verification, 11–12: collect meaningful test evidence and implement an archive-document vertical slice.

Documentation and evidence

Framework explanations were checked with Context7 on 2026-10-26, with the official MapStruct reference used for the detailed injection options. Consult MapStruct 1.6, Kotlin data classes, Kotlin Java interoperability, and Spring transaction semantics. The repository build pins remain the implementation baseline.

The current code has framework-aware ports, service-centered business logic, local filesystem storage, and in-memory search. It does not establish a fully framework-independent domain, a durable distributed transaction, or an external OCR/search worker. The capstone and proposed ports are learning exercises.

Website checks verify links, source hashes, chapter content, and course navigation. The follow-up review executed 131 existing backend tests and five diagnostic checks; see the exact results and limitations. This does not establish a passing PostgreSQL/Compose/worker deployment.

Search chapters, reference and source filenames.