Problem
Solè is a beach club and restaurant in Positano. Bookings used to go through a third-party system, and the new platform brings them in house. Customers book experiences and packages, like sunbeds and tables, and pay online. They can also buy gift cards, join a waiting list and open a booking from a link with its code. Staff manage sunbeds, the restaurant, the opening calendar and payments from a back office.
Architecture
The browser talks to a Next.js app, which queries a GraphQL API built with Laravel and Lighthouse. The API stores data in MySQL and Redis. To pay, the customer leaves the site for Nexi and comes back with the outcome in the URL. Emails go out through Brevo and receipts through a fiscal gateway. Staff use a Laravel Nova back office, and when content changes, the backend calls a revalidate endpoint on the frontend.
Scope
Mine
- The booking frontend for Solè and for the other venues built on it
- Typed GraphQL queries and mutations, generated from the backend schema
- The checkout and the return flow from the payment gateway
- Part of the Nexi payment backend: a nonce before the redirect, a guaranteed capture and error handling
Other teams
- GraphQL API, data model and the Nova back office (PixelCrew backend team)
- Infrastructure and deploy
Key decisions
Generate the types from the backend schema
Why. Another team writes the API, and it changed during the project. Codegen reads the GraphQL schema and turns every query into typed hooks. If a field disappears from the schema, the build fails on the query that uses it.
Trade-off. The schema has to be reachable in development and at build time.
Clean the payment return URL in middleware
Why. After payment, Nexi sends the customer back with parameters in the URL. The middleware keeps the ones the page needs, like the outcome and the transaction code, and redirects to a clean URL. Anything else is dropped before the page runs.
Trade-off. If the page needs a new gateway parameter, I have to add it to the list by hand.
Send the purchase event once, and never block the customer
Why. The flow bounces between the site and the payment gateway, so a conversion can get lost or counted twice. The purchase event waits until the tag manager has been quiet for 300 ms, with a hard timeout in case it’s blocked. A flag in storage stops a second event on reload.
Trade-off. The confirmation page can wait up to that timeout before it moves on.
In code
The middleware that cleans the payment return URL:
const CHECKOUT_PAYMENT_ALLOWED_PARAMS = [
"alias",
"codTrans",
"importo",
"divisa",
"esito",
"product",
] as const;
function stripDisallowedParams(
request: NextRequest,
allowed: readonly string[],
) {
const url = request.nextUrl;
const hasDisallowed = [...url.searchParams.keys()].some(
(k) => !allowed.includes(k),
);
if (!hasDisallowed) return null;
const cleanUrl = new URL(url.pathname, url.origin);
for (const key of allowed) {
const value = url.searchParams.get(key);
if (value !== null) cleanUrl.searchParams.set(key, value);
}
return NextResponse.redirect(cleanUrl);
}One platform, three venues
Chic Mama runs on its own copy of the backend. Arienzo Beach Club shares the Solè backend and adds English and Italian. There is no multi-tenancy: each venue is a separate fork, adapted to its own packages and rules.
Results
- 3
- venues on the same booking platform
- 630+
- versioned releases of the Solè frontend
- 987 / 994
- of the frontend commits are mine
Solè now takes bookings and payments on its own platform, and the frontend has reached version 1.0.632. I can’t share usage numbers.