Skip to main content
Tango is the customer-facing booking application that enables users to discover services, view availability, and make reservations with merchants.

Overview

  • Port: 5174
  • Purpose: Customer booking and reservation management
  • Authentication: Optional (guest booking supported)
  • Tech Stack: React 19, TanStack Router, TanStack Query, Tailwind CSS 4

Key Features

Service Discovery

Browse merchant services with detailed descriptions and pricing

Real-Time Availability

View available time slots in real-time with calendar interface

Guest Booking

Make reservations without creating an account

Booking Management

View, modify, and cancel reservations

Multi-Phase Services

Book complex services with multiple phases and steps

Location Information

Interactive maps showing merchant locations

Technology Stack

Core Dependencies

From frontend/apps/tango/package.json: Tango relies primarily on shared dependencies from the root workspace:
  • React 19.2.3 - Latest React version
  • TanStack Router 1.147.1 - File-based routing
  • TanStack Query 5.90.16 - Server state management
  • Tailwind CSS 4.1.18 - Styling
  • mapbox-gl 3.17.0 - Interactive maps (from root package.json)
  • react-day-picker 9.13.0 - Date selection component

Shared Packages

  • @reservations/components - Reusable UI components
  • @reservations/lib - Utilities and hooks
  • @reservations/assets - Icons and images (BackArrowIcon, etc.)

Application Structure

Route Organization

Tango uses a merchant-scoped routing structure:
routes/
├── __root.jsx                    # Root layout
├── index.jsx                     # Landing page
├── login.jsx                     # Customer login
├── signup/                       # Customer registration
└── m/$merchantName/              # Merchant-scoped routes
    ├── index.jsx                 # Merchant profile
    ├── services/$serviceId/      # Service details
    ├── booking/                  # Booking flow
    └── cancel/$bookingId/        # Cancellation flow
All merchant-specific functionality is scoped under /m/:merchantName to support multi-tenancy.

Customer Journey

User Authentication

Tango supports both authenticated and guest users:
Users can book without an account:
  1. Browse merchant services
  2. Select service and time
  3. Enter contact information
  4. Receive booking confirmation via email
  5. Use booking link for management

Booking Flow

Merchant Discovery

Route: /m/$merchantName/index.jsx Merchant profile page with:
1

Business Information

  • Merchant name and description
  • Business hours display
  • Contact information
  • Location with interactive map (MapboxMap)
2

Service Catalog

ServiceCategoryItem components:
  • Services organized by category
  • ServiceItem cards with:
    • Service name and description
    • Duration and pricing
    • Quick booking button
3

Recent Reservations

ReservationSection component:
  • Upcoming bookings (for logged-in users)
  • Booking history preview
  • Quick actions (modify, cancel)

Service Details

Route: /m/$merchantName/services/$serviceId/index.jsx Detailed service information:
  • Service Overview
    • Full description
    • Pricing details
    • Duration and capacity
    • Employee information
  • Multi-Phase Services
    • PhaseItem components for each phase
    • Phase descriptions and durations
    • Prerequisites and dependencies
    • Total service time calculation
  • Business Hours
    • DropDownBusinessHours component
    • Weekly schedule display
    • Special hours and holidays
    • Availability indicators
  • Booking Action
    • Prominent “Book Now” button
    • Redirects to booking flow with service pre-selected

Booking Creation

Route: /m/$merchantName/booking/index.jsx Interactive booking creation:
1

Service Selection

If not pre-selected:
  • Browse available services
  • View pricing and duration
  • Select service to continue
2

Date Selection

SmallCalendar component from @reservations/components:
  • Month view calendar
  • Available dates highlighted
  • Blocked dates shown in gray
  • Navigate between months
3

Time Selection

AvailableTimeSection component:
  • Fetches real-time availability
  • Displays available time slots
  • Shows time slot duration
  • Indicates employee (if applicable)
  • Handles multi-phase scheduling
4

Customer Information

For guests:
  • Name input fields
  • Email (required for confirmation)
  • Phone number
  • Optional notes/requests
For logged-in users:
  • Pre-filled contact info
  • Option to update details
  • Add special requests
5

Review & Confirm

  • Summary of booking details
  • Service, date, time confirmation
  • Customer information review
  • Final pricing display
  • Terms and conditions
  • Submit booking button

Booking Confirmation

Route: /m/$merchantName/booking/completed.jsx Post-booking confirmation page:
  • Booking success message
  • Booking reference number
  • Service details summary
  • Date and time confirmation
  • Add to calendar options
  • Email confirmation notice
  • Cancellation policy information
  • Link to manage booking

Availability Engine

The booking flow uses TanStack Query to fetch availability:
// From booking/index.jsx
async function fetchHours(merchantName, locationId, serviceId, start, end) {
  const response = await fetch(
    `/api/v1/merchants/${merchantName}/locations/${locationId}/services/${serviceId}/availability?start=${start}&end=${end}`
  );
  // Returns available time slots
}
Features:
  • Real-time availability checking
  • Handles multi-phase services
  • Employee-specific availability
  • Buffer time calculation
  • Blocked time periods
  • Business hours compliance

Booking Management

Cancellation Flow

Route: /m/$merchantName/cancel/$bookingId/
1

Cancellation Request

index.jsx - Cancellation form:
  • Booking details display
  • Cancellation policy reminder
  • Reason for cancellation (optional)
  • Refund information (if applicable)
  • Confirm cancellation button
2

Cancellation Confirmation

completed.jsx - Confirmation page:
  • Cancellation success message
  • Refund details (if applicable)
  • Email confirmation notice
  • Option to book again

Key Components

Merchant Page Components

  • MapboxMap - Interactive location map using Mapbox GL
  • ReservationSection - User’s upcoming and past reservations
  • ServiceCategoryItem - Service category display with services
  • ServiceItem - Individual service card with booking action

Service Detail Components

  • PhaseItem - Multi-phase service step display
  • DropDownBusinessHours - Expandable business hours schedule

Booking Components

  • AvailableTimeSection - Real-time time slot availability
  • SmallCalendar - Date picker from @reservations/components
  • Uses shared components: Button, Loading, ServerError, Textarea

Signup Components

  • EmailForm - Email validation and verification
  • NameForm - Name input fields
  • PhoneNumberForm - Phone number with validation
  • PasswordForm - Secure password creation
  • SubmissionCompleted - Registration success

Shared Components

From @reservations/components:
  • Button - Primary action buttons
  • Loading - Loading states
  • ServerError - Error handling
  • SmallCalendar - Date selection
  • Textarea - Multi-line text input

Shared Assets

From @reservations/assets:
  • BackArrowIcon - Navigation back button

Data Fetching

Tango uses TanStack Query with the following patterns:
import { useQuery, queryOptions, keepPreviousData } from '@tanstack/react-query';

// Example from booking/index.jsx
const { data, isLoading, isError } = useQuery({
  queryKey: ['availability', merchantName, serviceId, start, end],
  queryFn: () => fetchHours(merchantName, locationId, serviceId, start, end),
  placeholderData: keepPreviousData,
});
Key Patterns:
  • Query keys with dependencies
  • Placeholder data for smooth transitions
  • Error handling with ServerError component
  • Loading states with Loading component
  • Automatic refetching and caching

API Integration

Endpoints Used

  • GET /api/v1/merchants/:merchantName - Merchant profile
  • GET /api/v1/merchants/:merchantName/services - Service listing
  • GET /api/v1/merchants/:merchantName/services/:serviceId - Service details
  • GET /api/v1/merchants/:merchantName/locations/:locationId/services/:serviceId/availability - Time slot availability
  • POST /api/v1/bookings - Create booking
  • DELETE /api/v1/bookings/:bookingId - Cancel booking
  • GET /api/v1/customers/bookings - User booking history

Error Handling

if (isError) {
  return <ServerError />;
}
All API errors display the shared ServerError component from @reservations/components.

Utilities from @reservations/lib

Tango uses several utilities from the shared lib package:
  • formatToDateString - Format dates for display
  • GetDayPickerWindow - Calculate date picker range
  • getDisplayPrice - Format prices for display
  • invalidateLocalStorageAuth - Handle auth token expiration

Development

Running Tango

# Start development server on port 5174
npm run dev-tango

# Build for production
npm run build-tango

Development Features

  • Hot module replacement (HMR)
  • API proxy to backend at /api
  • Local domain support (.reservations.local)
  • React DevTools integration
  • TanStack Query DevTools for debugging queries

Testing Flows

  1. Navigate to /m/[merchant-name]
  2. Select a service
  3. Choose date and time
  4. Enter guest information
  5. Confirm booking

User Experience

Mobile-First Design

Tango is optimized for mobile devices:
  • Touch-friendly interface
  • Responsive layouts with Tailwind CSS
  • Optimized calendar interactions
  • Fast loading times
  • Minimal data usage

Performance Optimizations

  • Code splitting with TanStack Router
  • Query caching with TanStack Query
  • Optimistic UI updates
  • Lazy loading of components
  • Image optimization

Accessibility

  • Semantic HTML structure
  • ARIA labels on interactive elements
  • Keyboard navigation support
  • Screen reader friendly
  • High contrast text

Frontend Overview

Learn about the frontend monorepo architecture

Jabulani Dashboard

Explore the merchant dashboard application

Build docs developers (and LLMs) love