Building a Multi-Branch Spa, Salon & On-Demand Local Service Booking Backend
Power spas, studios, and on-demand home service teams: conflict-free staff scheduling, address autocomplete via Places Service, automated Zalo ZBS / SMS appointment reminders, and tracked promo links.

Appointment workflows extend far beyond clinics: spas, hair salons, photo studios, auto care shops, and on-demand home technicians can compose every needed capability natively on Habify Base. Alongside conflict-free PostgreSQL staff locks, built-in Places and Link services handle home address autocomplete and campaign link telemetry cleanly.
With branches, services, technicians, and bookings organized inside one isolated PostgreSQL database, multi-location brands manage every branch consistently without brittle third-party glue.
1. Multi-Branch & On-Demand Service Architecture
Combining isolated PostgreSQL tables with Places, Messaging, and Link services solves six daily operational workflows:
| Service Workflow | Habify Base Feature | Business Outcome |
|---|---|---|
| Branch & technician slots | PostgreSQL partial unique index on (staff_id, slot_at) | Prevents two customers from double-booking the same specialist |
| Home service address entry | Places Service (/v1/places/autocomplete & geocode) | Captures verified street addresses and map coordinates cleanly |
| Deposit / voucher checkout | Direct BYO QR Checkout straight to shop bank | Cuts last-minute no-shows without marketplace commissions |
| Booking phone verification | Passwordless OTP via official Zalo OA or SMS | Stops fake spam bookings before reserving staff hours |
| Automated reminders & NPS | Zalo ZBS triggers 2h before visit & post-service | Drives repeat visits and structured customer feedback |
| Tracked SMS promo links | Link Service short URLs + device/click analytics | Shortens SMS length and measures campaign ROI accurately |
2. Branch, Staff & Collision-Free Slot Schema
A single partial unique index per specialist and start timestamp keeps schedules conflict-free across locations while RLS isolates personal customer histories:
CREATE TABLE public.service_bookings (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
branch_id uuid NOT NULL,
staff_id uuid NOT NULL,
customer_id uuid NOT NULL,
service_name text NOT NULL,
service_address text,
slot_at timestamptz NOT NULL,
status text NOT NULL DEFAULT 'confirmed' CHECK (status IN ('confirmed', 'cancelled', 'done'))
);
CREATE UNIQUE INDEX uniq_staff_active_booking
ON public.service_bookings (staff_id, slot_at)
WHERE status = 'confirmed';
ALTER TABLE public.service_bookings ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.service_bookings FORCE ROW LEVEL SECURITY;
CREATE POLICY bookings_customer_or_branch ON public.service_bookings
USING (
customer_id::text = current_setting('app.current_user_id', true)
OR current_setting('app.current_role', true) = 'branch_reception'
)
WITH CHECK (
customer_id::text = current_setting('app.current_user_id', true)
OR current_setting('app.current_role', true) = 'branch_reception'
);3. Autocomplete Addresses with Places & Shorten Reminder Links
For at-home service orders, call habifyPublic.places.autocomplete() directly from your booking form, then shorten the confirmation URL on the server before dispatching a Zalo or SMS reminder:
// 1. Trình duyệt: Gợi ý địa chỉ khách khi chọn dịch vụ tại nhà
const suggestions = await habifyPublic.places.autocomplete(addressInput, {
country: "VN",
limit: 5,
});
// 2. Server: Rút gọn link lịch hẹn và gửi nhắc lịch Zalo OA
const { short_url } = await habifyServer.link.createLink({
url: `https://booking.brand.vn/visits/${booking.id}`,
alias: `hen-${booking.id.slice(0, 6)}`,
title: "Chi tiết lịch hẹn Spa",
});
await habifyServer.zalo.sendMessage({
phone: customerPhone,
template_id: process.env.ZALO_REMINDER_TEMPLATE_ID!,
template_data: {
customer_name: customerName,
slot_time: "14:00 · 02/12/2026",
detail_link: String(short_url),
},
});4. Collecting Booking Deposits and Measuring Campaign Links
For peak weekend slots, collect small QR deposits straight into your merchant account to reduce no-shows. Every short link tracks human clicks separately from messaging link-preview bots so marketing teams see true campaign performance.
Frequently Asked Questions
Does Places Service support Vietnam addresses cleanly?
Yes. Places Service includes Vietnam-tuned address autocomplete and geocoding accessible directly via browser publishable keys.
Can 5 separate salon branches share a single project database?
Yes. Include branch_id across your service and booking tables and scope receptionists to their assigned location inside your PostgreSQL RLS rules.
Are short links protected against messaging bot preview inflation?
Yes. Link Service filters out Zalo, Facebook, and Telegram link-preview crawlers automatically while supporting branded custom domains.
Related Documentation & Guides
Launch This Architecture in Free Sandbox in 3 Minutes
Spin up an isolated PostgreSQL 18 database, grab your hb_pk_* / hb_sk_* keys, and wire @habifybase/sdk.