Portfolio API
The Spring Boot back end of this site: a private admin, the contact form, the visit counter, the AI assistant and my GitHub profile card.
- Java 21
- Spring Boot 4.1
- Spring Security
- PostgreSQL 18
- Flyway
- Testcontainers
- Docker Compose
- nginx
Problem
This site is static, which keeps it fast, but a static site can't take a message, count a visit or let me update a project without editing code. I wanted those features on a server of my own, without handing visitors' data to a third-party service.
Technical decisions
- Two API instances behind nginx, which routes each visitor to the same instance by address and fails over to the other, so a deploy or a crash doesn't take the site down.
- Content edited in the admin reaches the site at build time: publishing queues a rebuild that reads the selected copies from the API, and a failed source keeps the previous release online.
- Contact messages are saved before the visitor gets a confirmation, then sent through an outbox with retries, so a failed e-mail is retried instead of lost.
- Visits are counted without storing raw IP addresses, and contact messages are deleted after 90 days.
- The admin signs in with GitHub (OAuth with PKCE), and every change is protected by CSRF; only my account is authorized.
- Tests run against a real PostgreSQL started by Testcontainers, not an in-memory database.
Result
In production since November 14, 2026, with 182 tests and a daily encrypted backup. It powers the admin I use to edit this site, the contact form, the visit counter, the assistant and the card on my GitHub profile.