# How to Build an AI-Powered Multi-Vendor Travel Booking System in 5 Steps

## Introduction
Travel platforms that span hotels, cars, and buses require complex data models, real-time availability, and multiple back-office panels. Building this from scratch traditionally involves weeks of plumbing across auth, bookings, payments, and analytics. With **Zoer**, you can describe your system in natural language and get a full-stack application — database, REST APIs, responsive frontend, multi-role admin consoles, and deployment — in minutes.

## The Prompt That Generates the App
Use this rephrased prompt in Zoer (faithful to your requirements, but not verbatim):

```
"Build a comprehensive travel booking platform that includes hotel reservations, car rentals, and bus ticketing. The app should support customer accounts, search and filtering across all services, payment processing, booking confirmations/management, and a user dashboard with booking history.

Provide four admin experiences:

- Hotel owners/managers: login-only access to add/edit/delete hotels, manage room types/pricing/availability, review reservations, and view analytics

- Car rental companies: login-only access for fleet management (vehicles), pricing/availability, rental bookings, and revenue tracking

- Bus operators: login-only access to create routes, manage schedules/pricing, track seat availability, and monitor ticket sales

- Super admin: global control over users and business accounts, commissions & payments, system-wide analytics/reports, content management, and business onboarding/verification

Technical expectations:

- Responsive UI for all devices and roles

- Real-time availability updates across hotels, cars, and buses

- Secure authentication and role-based access

- Relational database backing all entities and bookings

- Search with filters for each service category

- Booking confirmation flows and a simulated payment gateway

- Production-quality error handling and smooth UX throughout
"
```

## Step 1: Map Roles, Journeys, and Availability
- Customers: register/login → search (hotel/car/bus) → filter → select → pay → confirm → manage in dashboard
- Hotel admin: manage listings, rooms, rates, availability → review reservations → track analytics
- Car admin: manage vehicles, pricing, availability → confirm rentals → track revenue
- Bus admin: manage routes, schedules, pricing, seats → monitor ticket sales
- Super admin: manage users/businesses, commissions, payouts, approvals, content, and reports

## Step 2: Generate with Zoer’s Unified Platform
### Zoer vs. Traditional Development
| Aspect | Traditional Stack | Zoer Platform |
| --- | --- | --- |
| Timeline | 8–20 weeks | Minutes to hours |
| Database | Manual schema/migrations | AI-generated PostgreSQL schema |
| APIs | Handwritten REST | Generated endpoints + docs |
| Auth/RBAC | Custom roles and policies | Built-in roles + permissions |
| Availability | Custom locking & checks | Generated booking flows + hooks |
| Deployment | CI/CD + infra setup | One-click cloud deploy |

## Step 3: Enable Core Features
### Database Configuration
Enable **[Zoer Database](/content/docs/core-features/zoer-database/index.html)**. A representative subset of tables:

```
-- Simplified travel schema (Zoer will generate and optimize)
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  email VARCHAR(255) UNIQUE NOT NULL,
  password_hash TEXT,
  role VARCHAR(30) DEFAULT 'customer', -- customer | hotel_admin | car_admin | bus_admin | super_admin
  created_at TIMESTAMP DEFAULT NOW()
);

-- Hotel domain
CREATE TABLE hotels (
  id SERIAL PRIMARY KEY,
  owner_id INTEGER REFERENCES users(id),
  name VARCHAR(255) NOT NULL,
  city VARCHAR(120),
  address TEXT,
  description TEXT
);

CREATE TABLE hotel_rooms (
  id SERIAL PRIMARY KEY,
  hotel_id INTEGER REFERENCES hotels(id),
  room_type VARCHAR(100),
  price_cents INTEGER NOT NULL,
  total_inventory INTEGER NOT NULL,
  amenities TEXT[]
);

CREATE TABLE hotel_reservations (
  id SERIAL PRIMARY KEY,
  user_id INTEGER REFERENCES users(id),
  room_id INTEGER REFERENCES hotel_rooms(id),
  check_in DATE,
  check_out DATE,
  status VARCHAR(20) DEFAULT 'confirmed',
  created_at TIMESTAMP DEFAULT NOW()
);

-- Car rental domain
CREATE TABLE car_companies (
  id SERIAL PRIMARY KEY,
  admin_id INTEGER REFERENCES users(id),
  name VARCHAR(255) NOT NULL,
  city VARCHAR(120)
);

CREATE TABLE vehicles (
  id SERIAL PRIMARY KEY,
  company_id INTEGER REFERENCES car_companies(id),
  make VARCHAR(100),
  model VARCHAR(100),
  daily_price_cents INTEGER,
  availability_status VARCHAR(20) DEFAULT 'available'
);

CREATE TABLE car_reservations (
  id SERIAL PRIMARY KEY,
  user_id INTEGER REFERENCES users(id),
  vehicle_id INTEGER REFERENCES vehicles(id),
  start_date DATE,
  end_date DATE,
  status VARCHAR(20) DEFAULT 'confirmed'
);

-- Bus domain
CREATE TABLE bus_companies (
  id SERIAL PRIMARY KEY,
  admin_id INTEGER REFERENCES users(id),
  name VARCHAR(255) NOT NULL
);

CREATE TABLE bus_routes (
  id SERIAL PRIMARY KEY,
  company_id INTEGER REFERENCES bus_companies(id),
  origin VARCHAR(120),
  destination VARCHAR(120)
);

CREATE TABLE bus_trips (
  id SERIAL PRIMARY KEY,
  route_id INTEGER REFERENCES bus_routes(id),
  departure_ts TIMESTAMP,
  arrival_ts TIMESTAMP,
  price_cents INTEGER
);

CREATE TABLE bus_tickets (
  id SERIAL PRIMARY KEY,
  trip_id INTEGER REFERENCES bus_trips(id),
  user_id INTEGER REFERENCES users(id),
  seat_number VARCHAR(10),
  status VARCHAR(20) DEFAULT 'confirmed'
);

-- Finance & commissions (simplified)
CREATE TABLE payments (
  id SERIAL PRIMARY KEY,
  user_id INTEGER REFERENCES users(id),
  amount_cents INTEGER,
  currency VARCHAR(10) DEFAULT 'USD',
  provider VARCHAR(50),
  status VARCHAR(20) DEFAULT 'succeeded',
  created_at TIMESTAMP DEFAULT NOW()
);
```

### Authentication, RBAC, and Admin Panels
- Secure login for customers and each business role; separate admin consoles per vendor type
- Role-based route protection; redirect unauthorized access attempts
- Business onboarding and verification managed by super admin

### Search, Filters, and Real-Time Availability
- Service-specific filters (e.g., city/dates for hotels, dates for cars, origin/destination for buses)
- Availability checks on booking with concurrent-safe updates

### Payment Flow (Simulation)
- Tokenized checkout flow with test providers; store receipts in `payments`
- Booking confirmation pages and email-ready payloads

## Step 4: Customize with Zoer Copilot
```
"Add occupancy-based dynamic pricing for hotel rooms (weekends +15%, holidays +25%)."

"Expose a revenue dashboard for each vendor, broken down by service and time period."

"Enable seat maps for bus trips and block seats during checkout for 10 minutes."

"Create a dispute flow: customer requests change/cancellation → vendor review → status updates."
```

## Step 5: Deploy and Scale
### Deployment Options
1. **Zoer Cloud Hosting** — Managed infra, autoscaling, backups
2. **[Code Export](/content/docs/core-features/download-code/index.html)** — Self-host for deep customization

### Example Code Export Structure
```
ai-travel-booking/
├── src/app/next_api/
│   ├── hotels/        # Listings, rooms, reservations
│   ├── cars/          # Fleet, availability, rentals
│   ├── buses/         # Routes, trips, tickets
│   ├── auth/          # Login, sessions, roles
│   ├── search/        # Search & filters
│   └── finance/       # Payments, commissions
├── src/components/travel/  # UI components for each domain
├── app.sql                # PostgreSQL schema
└── package.json           # Dependencies
```

## Security & Operations
- Strong input validation and sanitization
- Role-based access checks and audit logs for admin actions
- Rate limiting on booking and payment endpoints
- Monitoring, structured logging, and automated backups (PITR)

## Getting Started
1. **Open Zoer** and create a new app
2. **Paste the prompt** (above) and enable Database and Authentication
3. **Review generated features**: hotels/cars/buses, multi-admin panels, search, payments
4. **Configure availability rules and test payment provider**
5. **Deploy** to Zoer Cloud or **export code** to self-host

Launch a multi-vendor travel platform that’s fast, reliable, and easy to evolve — powered by Zoer.
