# tzolov/playground-flight-booking architecture

> Architecture diagram of the GitHub repository tzolov/playground-flight-booking, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tzolov/playground-flight-booking
- Repository: https://github.com/tzolov/playground-flight-booking

## Overview

##### Main Components

a) Frontend Layer:
- React/TypeScript frontend components (Message.tsx, MessageList.tsx)
- Theming system (customer-support-agent theme)

b) Backend Layer:
- Spring Boot Application core
- AI Services integration
- Booking System components
- Data models

c) External Services:
- Multiple AI Provider options (OpenAI, VertexAI Gemini, Azure OpenAI, Groq, Anthropic Claude)
- PostgreSQL with pgvector (for vector embeddings)

**[Client Layer]**
- ↓↑
**[API Layer]**
- ↓↑
**[Service Layer]**
- ↓↑
**[Data Layer]**
- ↓↑
**[External Services]**

##### Component Details

Client Layer:
- Components: MessageList, Message components
- Theme: Customer Support Agent UI

API Layer:
- Entry point: Application.java
- Controllers (implicit from the structure)

Service Layer (highlight these key services):
- CustomerSupportAssistant
- FlightBookingService
- BookingTools
- AssistantService
- LoggingAdvisor

Data Layer:
- Models: Booking, BookingClass, Customer
- Enums: BookingStatus
- RAG: terms-of-service.txt

External Services Layer:
- AI Providers (with configurable options)
- Database (PostgreSQL with pgvector)

##### Important Relationships

- Frontend to Backend communication
- Service layer interactions
- AI service integration points
- Database interactions
- RAG system data flow

##### The configuration flexibility for different AI providers

This system design should clearly communicate how the application integrates AI capabilities with traditional booking system functionality while maintaining flexibility in AI provider selection.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    classDef infrastructure fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Frontend Layer
    subgraph Frontend
        FE_ML["MessageList"]
        FE_M["Message"]
        FE_T["Theme System"]
        FE_V["Main View"]
    end

    %% Backend Layer
    subgraph Backend
        APP["Spring Boot Application"]
        PROPS["Application Properties"]
    end

    %% Service Layer
    subgraph Services
        CSA["Customer Support Assistant"]
        FBS["Flight Booking Service"]
        BT["Booking Tools"]
        AS["Assistant Service"]
        LA["Logging Advisor"]
        BC["Booking Service Client"]
    end

    %% Data Layer
    subgraph Data
        BM["Booking Model"]
        BCL["Booking Class"]
        BS["Booking Status"]
        CM["Customer Model"]
        BD["Booking Data"]
        TOS["Terms of Service RAG"]
    end

    %% External Services
    subgraph External
        direction TB
        AI1["OpenAI"]
        AI2["VertexAI Gemini"]
        AI3["Azure OpenAI"]
        AI4["Groq"]
        AI5["Anthropic Claude"]
        DB[(PostgreSQL/pgvector)]
    end

    %% Infrastructure
    subgraph Infrastructure
        DC["Docker Config"]
        BC["Build Config"]
    end

    %% Relationships
    Frontend --> Backend
    Backend --> Services
    Services --> Data
    Services --> External
    Data --> DB

    %% Click Events
    click FE_ML "https://github.com/tzolov/playground-flight-booking/blob/main/frontend/components/MessageList.tsx"
    click FE_M "https://github.com/tzolov/playground-flight-booking/blob/main/frontend/components/Message.tsx"
    click FE_T "https://github.com/tzolov/playground-flight-booking/tree/main/frontend/themes/customer-support-agent/"
    click FE_V "https://github.com/tzolov/playground-flight-booking/blob/main/frontend/views/@index.tsx"
    click APP "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/java/ai/spring/demo/ai/playground/Application.java"
    click PROPS "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/resources/application.properties"
    click CSA "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/java/ai/spring/demo/ai/playground/services/CustomerSupportAssistant.java"
    click FBS "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/java/ai/spring/demo/ai/playground/services/FlightBookingService.java"
    click BT "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/java/ai/spring/demo/ai/playground/services/BookingTools.java"
    click AS "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/java/ai/spring/demo/ai/playground/client/AssistantService.java"
    click LA "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/java/ai/spring/demo/ai/playground/services/LoggingAdvisor.java"
    click BM "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/java/ai/spring/demo/ai/playground/data/Booking.java"
    click BCL "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/java/ai/spring/demo/ai/playground/data/BookingClass.java"
    click BS "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/java/ai/spring/demo/ai/playground/data/BookingStatus.java"
    click CM "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/java/ai/spring/demo/ai/playground/data/Customer.java"
    click BD "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/java/ai/spring/demo/ai/playground/data/BookingData.java"
    click TOS "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/resources/rag/terms-of-service.txt"
    click BC "https://github.com/tzolov/playground-flight-booking/blob/main/src/main/java/ai/spring/demo/ai/playground/client/BookingService.java"
    click DC "https://github.com/tzolov/playground-flight-booking/blob/main/docker-compose.yml"
    click BC "https://github.com/tzolov/playground-flight-booking/blob/main/pom.xml"

    %% Style Applications
    class FE_ML,FE_M,FE_T,FE_V frontend
    class APP,PROPS backend
    class CSA,FBS,BT,AS,LA,BC backend
    class BM,BCL,BS,CM,BD,TOS data
    class AI1,AI2,AI3,AI4,AI5,DB external
    class DC,BC infrastructure
```
