Crisphive

Next.js booking widget backed by Crisphive availability

Build a customer-facing booking flow with clear availability, submission, and recovery states for field-service clients.

By Terry Ha7 min read493 views4.8 (15)
A woman points at wireframe sketches on a wooden table while speaking with an older colleague sitting next to a laptop in an office.

A Next.js booking widget backed by Crisphive availability gives your field-service client a customer-facing path from choosing a service to requesting a visit. Build it around a clear distinction: an available time becomes a booking only when the backend accepts the request. For an agency serving a multi-branch fleet, that boundary belongs in the first design review. You'll define the application boundary, handle competing submissions, and agree with dispatch on what customers should see when confirmation is uncertain.

What we're building

Keep the first version narrow. Your booking widget collects the context required for a service request, displays matching choices, and submits the selected choice, while a crew-facing version can expose operational detail that customers don't need. Both versions should distinguish a selected time from an accepted booking.

Sit down with the client's dispatch manager before drawing the scheduling UI. Decide which services belong in self-service booking and which should go to a person. For a regional fleet, that discussion also needs to cover branch ownership, including who handles a request that reaches the wrong office, who answers a customer when the website cannot establish the outcome, and which team can take over if the usual contact is unavailable.

Write acceptance criteria in the language of the visit. Keep the checklist with the project handoff, where a replacement maintainer can find it without searching through a design discussion or a sales proposal. The customer can identify the service and location, understand the displayed time zone, correct a selection, and tell whether the request was accepted. Don't describe a selection as reserved unless the booking contract supports that promise. Put the same wording in the design review and the implementation checklist, so the agency and client approve the same behavior.

Data flow: UI to solver and back

Route the interaction through your application server. Let the browser collect permitted input, validate it before calling the scheduling backend, and return the choices the page needs; when the visitor submits a selection, pass it through that same boundary. Browser state should never decide which client account a public visitor can access.

For the framework boundary, the Next.js server and client components documentation describes keeping secrets in server components and adding interactivity through client components. Keep service credentials on the server and review your authorization decisions separately from rendering decisions. A customer booking page and an internal crew page need their own access rules.

Use the Crisphive booking walkthrough to check the integration sequence. It describes customer lookup or creation, job-type selection, availability, and job-request creation. Your adapter should preserve the distinction between those operations. Decide what each result allows your interface to say before connecting a confirmation message to it.

If the project includes routing, the Google Maps Routes documentation describes computing routes and route matrices. Treat that integration as a separate design choice. Name the decision it supports and its owner; don't add a routing request to every calendar interaction without a reason.

The build, step by step

Start with an application-level adapter contract. Describe the context your page sends, the choices it can render, and the outcomes it must distinguish after submission. Use your own test fixtures to build the interaction before connecting live bookings. Those fixtures describe your application, not undocumented backend fields.

A developer arranges paper prototype cards while her client watches at a shared desk.
Review the booking interaction with the client
  1. Capture the booking context and validate it at the server boundary.
  2. Request availability and show a distinct loading state.
  3. Render returned choices with the time zone visible.
  4. Show a review step before submitting the selected choice.
  5. Interpret the documented response and display the corresponding result.
  6. Provide a recovery action when confirmation cannot be established.

Keep every selection attached to the inputs that produced it. Changing a service or location should clear the selection and request matching choices. Also test an older availability response arriving after a newer one: your page must keep the result associated with the current input. A stale response shouldn't overwrite the customer's latest search.

Review the matching time slots reference when deciding which availability operation fits the workflow. It addresses matching slots for a quoted job. Check the required job state and inputs before treating it as interchangeable with the initial booking flow. Put that choice in the adapter notes so the next developer can trace it.

Preventing double-booking

Assume that availability can change between display and submission. Disabling a button discourages repeated clicks in that browser; competing sessions still need a backend decision. Before launch, establish how the booking operation handles concurrency and what response your application receives when a request cannot be accepted.

Verify the safeguards you intend to rely on. Check whether the operation revalidates availability, supports a temporary hold, or offers a documented repeated-request mechanism, and record each answer with the contract you reviewed so your application maintainer can distinguish a verified safeguard from a question that still needs an answer. If the design requires a guarantee the contract doesn't provide, resolve that gap before accepting public bookings.

Test the race.

Run a controlled test with separate sessions selecting the same displayed choice. Submit both and inspect the results against the client's booking policy. The interface must explain any rejected path and offer current choices where appropriate, with enough context that a dispatcher can follow up without asking the customer to reconstruct every click. Don't invent an error identifier to make a test look complete; assert against the contract you've verified.

Then interrupt the connection after submission. This case needs different wording from a confirmed rejection because the request may already have reached the backend. Agree on a recovery path that checks an existing result when supported, or sends the customer to dispatch. Protect booking details. Keep diagnostic context useful without putting private booking details in general-purpose logs.

Polish: states, errors, empty slots

A blank calendar leaves the customer guessing.

Distinguish loading, no available choices, and a failed availability request. Preserve useful input across recovery, and make the next action match the outcome. An empty result can offer another date range; a failed request can offer a retry.

While a submission is pending, prevent another accidental click and explain that confirmation is in progress. Show accepted details only after an accepted result. If the outcome is unresolved, say so and provide the agreed contact or recovery path instead of inviting an immediate duplicate booking.

Review the page with a keyboard and on a narrow screen. Inputs need clear labels, selected times must be identifiable without color alone, and validation messages should sit beside the relevant control. Ask someone outside the build team to complete the flow and explain what happened. Watch where their explanation differs from the system's actual state.

For the dispatch handoff, choose customer-facing language with the client. Internal response details belong in operational tooling; the page should explain the action a visitor can take. Keep branch-specific contact paths current, especially when a regional office owns the follow-up rather than a central team.

Deploy and measure

Use a controlled entry point for launch and the integration's documented test environment and verify account context before directing public traffic to the widget. Walk through an accepted booking with dispatch, including the point at which the visit becomes visible to the people who will manage it. Give an owner authority to stop new submissions if that handoff breaks. Test the stop control before launch, too. Dispatch needs to know whether it stops only new requests or also affects work already submitted; write down that boundary so an incident doesn't leave the team improvising a policy while customers wait.

A developer and her client review a dispatch-office pinboard beside the service yard.
Agree on the dispatch handoff before launch

Choose events that describe the booking flow: availability requested, choices shown, booking submitted, and booking accepted. Define their meaning before building a dashboard. Keep an unresolved submission distinct from a rejected one, and don't count a selected time as a booking. Review empty results and support contacts alongside accepted requests.

For agencies, separate the build scope from ongoing responsibility. The Crisphive partner program describes agencies charging for their builds alongside a recurring share. Agree with your client on who maintains the widget, investigates uncertain bookings, and checks the integration after website changes; the commercial arrangement doesn't replace that operating agreement.

Before opening the entry point, ask dispatch to run the interrupted-submission test with you. Record the outcome, the customer message, and the person responsible for follow-up in the handoff notes.

#BuildInPublic#DevTools#AIAgents#API#MCP#FieldService#FieldOps#dispatch#scheduling#AI#automation#SaaS#B2B#Productivity

Share this article

Was this article useful?

4.8 out of 5 · 15 ratings

Comments

0/2000

Keep reading

More Developers notes →