Skip to content

Explore the portfolio

All projects

Personal project · Live

Libra

Classic books. Reading that keeps your place.

Bilingual digital library of classic literature: catalog, chapter reader, and reading progress that survives text edits.

Libra · Application screenshot
Status
Live
Year
2026

The starting point

Libra is a digital library in Spanish and English for reading classic literature. The texts come from Project Gutenberg and are in the public domain in the United States. I built it as a complete product: catalog, authors, categories, chapter reader, accounts, synced progress and an editorial workflow for adding books without breaking what is already published.

Decisions that shape the product

01

A catalog that grows without breaking readers

Books come in from EPUB through an editorial pipeline. By default the importer only compares against the database and reports differences; writing requires --apply and, on a remote database, confirming its identifier with --confirm-database, which is shown masked. A published edition is not altered by a normal import, and publications made with the script are recorded in edition_reviews. (Limit: a direct manual change to the database is not recorded.)

02

Progress survives a new edition

If a reimport rewrites or extends a chapter, the reader’s paragraph is kept (or, if that paragraph changed, its relative position in the chapter) and the percentage is recalculated from the preceding words.

03

Syncing on a poor connection

Progress is stored in a local queue that is sent when the page is hidden or unmounted, with keepalive requests. Offline, a service worker shows a fallback page in the URL’s language.

04

Fast by design

Pages are prerendered with React Server Components and Cache Components. When an editorial script changes content, it invalidates the site cache through an endpoint protected by a shared secret.

05

Security with explicit trade-offs

Security headers and a partial CSP. The full CSP was left out on purpose because it requires per-request nonces and would make pages dynamic; the plan is to start in Report-Only mode. There is no in-memory rate limiting because serverless instances do not share state; limits are configured in the provider’s firewall. Bounded inputs, and writes require a session and the same origin.

06

International SEO

/es and /en routes with next-intl, canonical and hreflang per page, Book JSON-LD and accent-insensitive search with server-side pagination.

Implementation and verification

707

automated tests run in CI, 0 failures

759

automated tests defined

132/137

non-merge commits following the semantic convention

  • CI runs 707 tests: 684 in the main job plus 23 integration tests, without counting the harness test twice, with 0 failures. The remaining 52 run only locally: 51 depend on EPUB files that are not versioned and 1 checks the approved image-processing environment.
  • Integration tests run against a disposable Postgres in CI.
  • History: 132 of 137 non-merge commits follow the semantic convention.
  • Secret scanning and push protection enabled; gitleaks history scan with no findings.
  • Editorial scripts and migrations: dry run by default (documented exceptions: db:studio, which has no guard, and db:seed, which only writes to a local database and refuses remote ones).

Figures as of November 14, 2026. View the latest CI run

Process

How I work with AI

I use AI coding assistants (Claude and GitHub Copilot) and I disclose it: at least 45 of Libra’s 137 commits are co-authored by AI. What matters to me is that every change can be verified:

  1. 01

    Versioned context

    AGENTS.md and CLAUDE.md live in the repository.

  2. 02

    Guards

    Editorial scripts that write are dry runs by default, require --apply and, on remote databases, --confirm-database with the target masked, just like migrations. They have tests.

  3. 03

    Verification

    Every PR must pass lint, type checks, formatting and tests, including integration against a disposable Postgres, before it is merged.

One example: before publishing this case study, I had every claim audited against the code. We found that three write scripts did not do what I was about to claim. I fixed the code, not the text, and added tests.

Technologies

  • Next.js 16
  • React 19
  • TypeScript
  • PostgreSQL
  • Drizzle
  • Cloudflare R2

Current scope

There is no offline reading: only the fallback page. The full CSP is pending. Backups depend on the provider and are not documented in the repository. The rights status of the covers extracted from EPUBs is still to be documented.

Next project

La Central

Let’s build something together.

Get in touch