Urgent.News

What's breaking now, across thousands of outlets.

Tech

Booking SDK: Typed TypeScript for Custom Booking Flows

Originally published on opencals.com . The original stays updated; check it for the latest version. Adding booking to an app looks like a weekend project until you start. Real-time availability across staff and locations, cart state that survives a page refresh, a payment flow that fails gracefully, booking statuses that move through their lifecycle — every piece is more nested and more stateful…

Integrating a booking system into an app can seem daunting, especially when dealing with real-time availability, cart state that persists through page refreshes, and handling payment flows gracefully. A booking SDK simplifies this process by turning complex HTTP requests into typed method calls, thus reducing the maintenance burden and ensuring data consistency.

APIs without an SDK can still function, but a booking API particularly benefits from one due to its intricate data structure. Every aspect of a booking flow—availability, cart state, payment intents, and booking status—has its own nested and stateful components. A well-structured SDK provides autocomplete functionality, compile-time errors for shape changes, and validates responses at the boundary, ensuring a robust and trustworthy booking process.

The Opencals storefront SDK, written in TypeScript, is designed to handle these complexities. To set it up, install the package via npm and initialize it with your store's API key. It's crucial to use a private storefront key for server-side code, scoped to a single store, and to forward the buyer's IP address to manage rate limits accurately.

The SDK simplifies the booking flow into five key steps—loading the service catalog, fetching real-time availability, creating a cart and holding the slot, and ultimately creating the booking.

For example, loading the service catalog involves listing active services from the catalog, while fetching real-time availability requires specifying details like service ID, date, staff member, and location, returning the available slots. Creating a cart involves storing the cart ID to maintain the booking state across page refreshes, and finally, creating a booking merges the selected slot with the cart ID.

The SDK abstracts away the complexities, allowing developers to focus on the booking logic rather than manual HTTP request handling.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Prometheus Tutorial: Metrics That Show What Your App Does

Quick answer Prometheus is a monitoring system that pulls numbers from your app on a schedule and stores them as time series, so you can ask how many orders failed in the last hour or how slow…

  • Prometheus collects metrics from applications via /metrics endpoint
  • Python script defines Counter for orders placed and Histogram for processing time
  • Consider label cardinality to avoid slow and expensive Prometheus server

Katib's Small Public Footprint Still Exposes Experiment Authority

Katib's Small Public Footprint Still Exposes Experiment Authority Katib is a Kubeflow component for hyperparameter tuning, early stopping and neural architecture search.

  • Katib deprecated but still present in clusters
  • Small public footprint: zero ZoomEye matches for app=Katib, 53 for title=Katib
  • Risks include resource consumption and unauthorized workload launches

More from Wednesday 18 November →