Bookings 0.2.0: Rate-limited booking forms and more reliable availability for Phoenix
Bookings 0.2.0 hardens the PhoenixKit booking and reservation module for public sites: guest forms are rate-limited, availability rules close the right days, and a booking made from a stale page is judged on the current rules.
Rate limits on public booking forms
A guest booking form sends email to whatever address it is given, which makes it a target for abuse. Bookings and waitlist sign-ups are now capped at 10 an hour per email address and 30 an hour per visitor connection (IPv6 counted per /64 network), and both limits are configurable:
config :phoenix_kit_bookings, :public_rate_limit, per_address: 10, per_peer: 30
The per-visitor limit needs connect_info: [:peer_data, ...] on your LiveView socket.
Availability you can trust
This release comes from a review of the whole module, and several fixes change what guests see. A single blackout date no longer closes a service on every day, and a closed weekday next to an open rule really closes. A stay with no maximum length now stops at 366 nights instead of running to the year 9999; set max_stay higher on any service where longer stays are real. Today’s time slots that have already passed are no longer offered, and minimum notice now follows the site’s time zone.
Bookings made while the service changed are now checked against the service as it is stored, so a service that was deactivated or moved behind a login while a visitor was typing no longer accepts the booking on the old terms. Confirming and cancelling are guarded too: approving a booking that was just cancelled no longer brings it back, and the customer is not emailed twice.
Upgrading
Bookings 0.2 needs PhoenixKit 3.4: run mix phoenix_kit.update. There is no new migration in the module itself. Read the changelog’s “Changed” section first: besides availability fixes that guests will notice, it changes the API for custom booking code. Booking.status_changeset/3 is replaced by Booking.status_changes/2, WaitlistEntry.changeset/2 now takes today’s date, and confirm_booking/2 and cancel_booking/2 answer {:error, :not_pending, _} and {:error, :not_cancellable, _} when the booking has already moved on.
Full release notes: Bookings 0.2.0
0.2.0 · 6 November 2026
The move to core 3.4, plus the fixes from a review of the whole module: availability rules that closed the wrong days, stays with no end, and bookings written from stale pages. Some changes show on a running site, so read Changed before upgrading.
Added
- Rate limits on the public forms. A guest form mails whatever address it is
given, so
RateLimitcaps bookings and waitlist joins at 10 an hour per address and 30 an hour per peer (IPv6 by /64). Set them withconfig :phoenix_kit_bookings, :public_rate_limit, per_address: 10, per_peer: 30. A limiter that is not running allows the attempt. expected_schema/0, so core’sdoctorandrepaircan see this module’s six tables. It is generated by core’s script, and a test fails when it drifts.reserved_route_prefixes/0, which keepsbookandbookingsout of Publishing’s catch-all route.list_bookings/1takes:order(:ascby default, or:desc), andServices.with_effective_seats/1gives unit-tracked services their unit count.- Translatable public flow.
BookingFlow‘s strings are extractable through core’s Gettext backend. There is no catalogue yet.
Changed
- Core floor raised to
phoenix_kit >= 3.4.0 and < 4.0.0, andphoenix_live_calendarto~> 0.5. Runmix phoenix_kit.update; core’s own rule applies, so a host below core V225 passes through 2.65.0 first. No new migration here: the chain stays at V2. - Availability shows differently to guests. A minute service with only closed rules was bookable on no day and now opens on every other day. A closed weekday beside an open rule now really closes.
- A stay on a service with blank
max_staynow stops at 366 nights. Setmax_stayabove that where longer stays are real. - The per-peer limit needs
connect_info: [:peer_data, ...]on the host’s socket. Without it only the per-address limit applies. - API:
Booking.status_changeset/3is replaced byBooking.status_changes/2.WaitlistEntry.changeset/2is nowchangeset/3and takes today’s date, so it can refuse a past one.confirm_booking/2andcancel_booking/2answer{:error, :not_pending, _}and{:error, :not_cancellable, _}when the booking has moved on. - The widget reads the viewer through core’s
assign_embedded_current_user/2, which carries the managed-organization rules. - The Edit link rides
app_layout’s attrs, andbooking_layout/1is gone. - Holds no longer reload admin lists, and a released hold gives the slot back to open pickers.
test_helper.exsstops the run when the schema fails to build. Only an unreachable database excludes the integration suite, so a test database below core’s floor now stops with core’s error untilmix test.reset.PGDATABASEandPGPOOLare honoured inconfig/test.exs.
Fixed
- One blackout date closed a minute service on every day. The two engines now agree on what a closed rule means.
- A public stay had no end. With
max_stayblank a guest could book through to the year 9999, and each check walked millions of dates inside the row lock. create_booking/4trusted the caller’s struct. A service trashed, deactivated or moved behind a login or approval while a visitor typed still took the booking on the old terms, and a deleted one raised. The rules are now judged on the locked row.- Confirm and cancel had no guard. Approving what had just been cancelled brought it back, and a second cancel mailed the customer again. Both are now conditional writes.
- A deactivated account passed the widget’s
login_requiredcheck. - Slot grids read the wrong clock. Past slots of today were offered,
min_noticewas off by the site’s offset, and west of UTC free slots were hidden. - Manage links died 90 days after signing. A link now lives until 90 days after the booking ends, links already sent included.
- The admin list hid the newest bookings past 200 rows. Lists reaching into the past now read newest first and say when they are cut, and timed and dated bookings sort together.
- Hand-made requests could book off the slot grid.
pick_slotandpick_freeare now held to the service’s grid and shape. - A unit went back into use inside its buffer, and the provider read stopped short of the request’s buffers.
submit_detailsignored the step: replayed after the end it booked again, and before a pick it crashed the page.- Waitlist: a timed booking across midnight notified only its first date, a past date was accepted, and two open rows for one address raised for good.
- A closed rule on a minute service demanded times it then ignored.
visible_services/2failed open on a scope with no user, owning a service outlived the base key, and restoring from the trash went past the per-user cap.migrated_version_runtime/1swallowed an invalid prefix and crashed on a dead pool, anddown(version: 2)on a V2 database dropped the V2 column.- The provider select named a person with no name of their own “Person 0197abcd” despite their account having one, and read the database on every keystroke.
- Unit-tracked services listed their
seatscolumn instead of their units. - Smaller: the email and slug formats let a trailing newline through,
.icslines ran past RFC 5545’s 75 octets, every form gained theidLiveView needs to recover it on reconnect, and stale docs were corrected.
Bookings 0.2.0. Install or update: {:phoenix_kit_bookings, "~> 0.2"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.