feature/slotbook
SlotBook
SlotBook books desks in reading rooms, gym sessions, meeting rooms and office hours. It replaces the group chat or spreadsheet where bookings overlap and nobody knows who took what. Every organisation has its own resources, staff, members and time zone.
- Role
- Sole developer, backend to deployment
- Built
- 10–28 November 2026
- Commits
- 235
- Built with
- Spring Boot PostgreSQL React Testcontainers

How a request travels
- React 19 + ViteVercel
- Spring Boot 4.1 APIRender
- PostgreSQL 17Neon
Stack and why
The backend is Java 21 with Spring Boot 4.1 and PostgreSQL 17, with Flyway for migrations. I picked PostgreSQL because it can reject overlapping bookings by itself, with an EXCLUDE USING gist constraint. A check in Java would not be enough: two requests that arrive at the same moment both see a free slot.
Tests use JUnit and Testcontainers, so they run against a real PostgreSQL in Docker, not H2. That matters here, because the bugs I cared about only show up on the real database. The backend has 595 tests, the frontend 337 Vitest tests and 9 Playwright tests that go through the real backend and database. CI runs the tests and gitleaks over the whole git history on every push.
The frontend is React 19 with Vite. Vercel forwards /api to the backend on Render, so the browser sees a single address.
The hardest problems
Twenty clicks at once, one slot
BookingIstovremenoApiTest sends 20 requests for the same slot through a real HTTP server, in four rounds. In each round exactly one gets through and the other 19 get 409. The first version deadlocked (40P01): PostgreSQL writes the row first and then looks for conflicts, so two transactions waited on each other. Booking now locks the resource first. Without the lock the test sometimes passed twice in a row, which is why it runs four rounds.
Daylight saving time does not move slots
Opening hours are local, in the organisation’s zone (Europe/Sarajevo), and slots are stored as TIMESTAMPTZ. A rule like “Mondays from 08:00” gives an 08:00 slot by the wall clock in both winter (+01:00) and summer (+02:00). On the night the clocks go back, a rule from 00 to 04 has five hourly slots, not four. When I tried taking the zone offset at query time instead of the slot’s date, all four DST tests failed.
A webhook that refunded four times
Stripe can deliver the same event more than once, even at the same moment. StripeWebhookApiTest sends five identical deliveries at once. In the first version a correctly paid slot was refunded four times. Now exactly one delivery is processed and the others change nothing.

An admin can put a tablet by the door that shows today’s slots. People who are not members yet scan the code and book from their phone.
What I would do differently today
I would test every kind of notification, not just the one I started with. PushApiTest only checked push for a waitlist offer. Once push notifications were in, a reminder created one row for email and one for each browser, but an older index allowed only one reminder row per booking. sendReminders runs as one transaction, so a single user with notifications turned on could break reminders for everyone in that batch. That code was in production. I only found the bug when a test for the reminder text failed on that index, and I don’t know whether a batch actually failed there.
I would also give every end-to-end test its own data. A Playwright test once failed after 90 seconds because I picked a slot that another test had already taken in the same organisation. The code was fine. The test wasn’t.