In progress
Leaf & Lore
A reading tracker where the habit is the picture: every reading session grows a leaf, each book becomes a cluster of leaves, each month a tree, and your reading history a forest. It's a full-stack web app with a Java API and a PostgreSQL database.
- 4database tables, versioned with migrations
- 3REST endpoints so far
The idea
Most reading trackers are a list of books and a progress bar. In Leaf & Lore, you log a short session with a one-line reflection and a leaf grows. Days where you meet your goal grow full, bright leaves. A month you read often grows a full tree, and a quiet month thins out but never dies. Logging a reading session should feel like tending something.
How it works
- Backend: a Spring Boot REST API in Java 21 over PostgreSQL. The schema is versioned with Flyway migrations. Leaves, trees and streaks are never stored: they’re computed from the session records, so they can’t get out of sync.
- Frontend: React and TypeScript. Each leaf’s size and brightness come from pages read compared with that day’s goal. Today’s leaf glows, and animations turn off when the system’s reduce-motion setting is on.
- Rules in the database. A partial unique index allows only one “currently reading” book per user, so the rule holds even if the app has a bug.
Where it stands
The first slice works end to end: logging a session saves it through the API and draws its leaf in the book’s cluster. The API is tested against a real PostgreSQL database in Docker using Testcontainers.
- Next: arranging leaves in a spiral cluster, then real accounts and multiple books.
- (Planned) The tree and forest views, the library, and insights such as streaks and genre mix.
What I learned so far
Getting the data model right first made everything after it simpler. Before writing code, I designed the tables: a shared book catalog, a per-user entry for each book, and the reading sessions. Three decisions came out of that:
- Store facts, compute pictures. The database stores only what happened: sessions, pages and reflections. Leaves, trees, streaks and progress are calculated from those, so the picture can never disagree with the data.
- Let the database enforce the rules. “Only one book being read at a time” is a partial unique index, not just a check in the code. A bug in the API can’t break the rule.
- Test against the real thing. The API tests run against a real PostgreSQL database in Docker (Testcontainers) instead of a mock, so they catch the SQL and constraint errors that would happen in production.
This is also the first server I’ve built myself. Writing the REST API, versioning the schema with migrations and running the database locally in Docker showed me how the frontend, backend and database fit together.
What I’d do differently
- Decide on deployment early. My Lean Tracker taught me that where an app runs shapes its design. Leaf & Lore doesn’t have a hosting plan yet, and I’d settle that before adding accounts, because authentication depends on it.