# coegithub/airlinebookingrepo architecture

> Architecture diagram of the GitHub repository coegithub/airlinebookingrepo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/coegithub/airlinebookingrepo
- Repository: https://github.com/coegithub/airlinebookingrepo

## Overview

SkyBook is a flight-booking web app: travellers browse and save flights, build a trip, sign in, submit booking details with a mock payment, and view their bookings. The React client fetches the catalog and sends booking requests through a shared HTTP layer; the Express API validates identity and delegates persistent work to Postgres. The database transaction reserves seats and saves the booking atomically, while shared pricing rules calculate totals. The README documents the major capabilities and API; some server and page wiring is supported by the source index rather than sampled implementation excerpts.

Main entry points: [`src/context/StoreContext.jsx`](https://github.com/coegithub/airlinebookingrepo/blob/main/src/context/StoreContext.jsx) (Trip and saved flights), [`server/db.js`](https://github.com/coegithub/airlinebookingrepo/blob/main/server/db.js) (Catalog and booking store), [`src/services/api.js`](https://github.com/coegithub/airlinebookingrepo/blob/main/src/services/api.js) (Catalog and orders API), [`src/App.jsx`](https://github.com/coegithub/airlinebookingrepo/blob/main/src/App.jsx) (React app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browse["Flight browsing"]
  node_client_app["React app<br/>[App.jsx]"]
  node_flight_search["Flight discovery<br/>[Home.jsx]"]
  node_flight_detail["Flight details<br/>[ProductDetail.jsx]"]
  node_flight_cards["Flight cards<br/>[ProductCard.jsx]"]
  node_store_state["Trip and saved flights<br/>[StoreContext.jsx]"]
end

subgraph group_booking["Trip and account"]
  node_auth_state["Account session<br/>[AuthContext.jsx]"]
  node_checkout["Booking checkout<br/>[Checkout.jsx]"]
  node_trip_view["Trip cart<br/>[Cart.jsx]"]
  node_saved_view["Saved flights<br/>[Wishlist.jsx]"]
  node_booking_history["Booking history<br/>[Orders.jsx]"]
  node_booking_detail["Booking details<br/>[OrderDetail.jsx]"]
end

subgraph group_api["API and identity"]
  node_catalog_service["Catalog and orders API<br/>[api.js]"]
  node_http_client["HTTP client<br/>[http.js]"]
  node_identity_client["Authentication client<br/>[auth.js]"]
  node_server_entry["Express server<br/>[index.js]"]
  node_api_routes["Booking API<br/>[api.js]"]
  node_identity_routes["Account and sessions<br/>[identity.js]"]
end

subgraph group_data["Booking data"]
  node_database_layer["Catalog and booking store<br/>[db.js]"]
  node_pool["Database connection<br/>[pool.js]"]
  node_postgres[("Neon Postgres")]
  node_flight_seed["Flight catalog seed<br/>[products.js]"]
  node_fare_rules["Fare calculations<br/>[pricing.js]"]
end

node_traveller(("Traveller"))

node_traveller -->|"uses"| node_client_app
node_client_app -->|"routes to"| node_flight_search
node_client_app -->|"routes to"| node_flight_detail
node_flight_search -->|"reads catalog"| node_store_state
node_flight_detail -->|"reads and updates"| node_store_state
node_flight_search -->|"renders"| node_flight_cards
node_flight_detail -->|"renders related"| node_flight_cards
node_store_state -->|"fetches catalog"| node_catalog_service
node_catalog_service -->|"sends requests"| node_http_client
node_trip_view -->|"reads trip"| node_store_state
node_saved_view -->|"reads saved flights"| node_store_state
node_checkout -->|"reads and clears trip"| node_store_state
node_checkout -->|"creates booking"| node_catalog_service
node_checkout -->|"shows totals"| node_fare_rules
node_booking_history -->|"loads bookings"| node_catalog_service
node_booking_detail -->|"loads booking"| node_catalog_service
node_auth_state -->|"manages session"| node_identity_client
node_identity_client -->|"sends requests"| node_http_client
node_client_app -->|"provides account state"| node_auth_state
node_traveller -->|"submits booking"| node_checkout
node_http_client -->|"calls API"| node_server_entry
node_server_entry -->|"mounts routes"| node_api_routes
node_server_entry -->|"mounts auth"| node_identity_routes
node_api_routes -->|"reads and writes"| node_database_layer
node_identity_routes -->|"claims records"| node_database_layer
node_database_layer -->|"queries"| node_pool
node_pool -.->|"connects"| node_postgres
node_database_layer -->|"seeds catalog"| node_flight_seed
node_database_layer -->|"calculates booking totals"| node_fare_rules
node_identity_routes -->|"stores accounts and sessions"| node_postgres

click node_client_app "https://github.com/coegithub/airlinebookingrepo/blob/main/src/App.jsx"
click node_flight_search "https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/Home.jsx"
click node_flight_detail "https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/ProductDetail.jsx"
click node_flight_cards "https://github.com/coegithub/airlinebookingrepo/blob/main/src/components/ProductCard.jsx"
click node_store_state "https://github.com/coegithub/airlinebookingrepo/blob/main/src/context/StoreContext.jsx"
click node_catalog_service "https://github.com/coegithub/airlinebookingrepo/blob/main/src/services/api.js"
click node_http_client "https://github.com/coegithub/airlinebookingrepo/blob/main/src/services/http.js"
click node_identity_client "https://github.com/coegithub/airlinebookingrepo/blob/main/src/services/auth.js"
click node_auth_state "https://github.com/coegithub/airlinebookingrepo/blob/main/src/context/AuthContext.jsx"
click node_checkout "https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/Checkout.jsx"
click node_trip_view "https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/Cart.jsx"
click node_saved_view "https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/Wishlist.jsx"
click node_booking_history "https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/Orders.jsx"
click node_booking_detail "https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/OrderDetail.jsx"
click node_server_entry "https://github.com/coegithub/airlinebookingrepo/blob/main/server/index.js"
click node_api_routes "https://github.com/coegithub/airlinebookingrepo/blob/main/server/api.js"
click node_identity_routes "https://github.com/coegithub/airlinebookingrepo/blob/main/server/identity.js"
click node_database_layer "https://github.com/coegithub/airlinebookingrepo/blob/main/server/db.js"
click node_pool "https://github.com/coegithub/airlinebookingrepo/blob/main/server/pool.js"
click node_flight_seed "https://github.com/coegithub/airlinebookingrepo/blob/main/shared/products.js"
click node_fare_rules "https://github.com/coegithub/airlinebookingrepo/blob/main/shared/pricing.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client_app,node_flight_search,node_flight_detail,node_flight_cards,node_store_state toneBlue
class node_auth_state,node_checkout,node_trip_view,node_saved_view,node_booking_history,node_booking_detail toneAmber
class node_catalog_service,node_http_client,node_identity_client,node_server_entry,node_api_routes,node_identity_routes toneMint
class node_database_layer,node_pool,node_postgres,node_flight_seed,node_fare_rules toneRose
class node_traveller toneIndigo
```

## Components

### Flight browsing

- [React app](https://github.com/coegithub/airlinebookingrepo/blob/main/src/App.jsx): `src/App.jsx`
- [Flight discovery](https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Flight details](https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/ProductDetail.jsx): `src/pages/ProductDetail.jsx`
- [Flight cards](https://github.com/coegithub/airlinebookingrepo/blob/main/src/components/ProductCard.jsx): `src/components/ProductCard.jsx`
- [Trip and saved flights](https://github.com/coegithub/airlinebookingrepo/blob/main/src/context/StoreContext.jsx): `src/context/StoreContext.jsx`

### Trip and account

- [Account session](https://github.com/coegithub/airlinebookingrepo/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Booking checkout](https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/Checkout.jsx): `src/pages/Checkout.jsx`
- [Trip cart](https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/Cart.jsx): `src/pages/Cart.jsx`
- [Saved flights](https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/Wishlist.jsx): `src/pages/Wishlist.jsx`
- [Booking history](https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/Orders.jsx): `src/pages/Orders.jsx`
- [Booking details](https://github.com/coegithub/airlinebookingrepo/blob/main/src/pages/OrderDetail.jsx): `src/pages/OrderDetail.jsx`

### API and identity

- [Catalog and orders API](https://github.com/coegithub/airlinebookingrepo/blob/main/src/services/api.js): `src/services/api.js`
- [HTTP client](https://github.com/coegithub/airlinebookingrepo/blob/main/src/services/http.js): `src/services/http.js`
- [Authentication client](https://github.com/coegithub/airlinebookingrepo/blob/main/src/services/auth.js): `src/services/auth.js`
- [Express server](https://github.com/coegithub/airlinebookingrepo/blob/main/server/index.js): `server/index.js`
- [Booking API](https://github.com/coegithub/airlinebookingrepo/blob/main/server/api.js): `server/api.js`
- [Account and sessions](https://github.com/coegithub/airlinebookingrepo/blob/main/server/identity.js): `server/identity.js`

### Booking data

- [Catalog and booking store](https://github.com/coegithub/airlinebookingrepo/blob/main/server/db.js): `server/db.js`
- [Database connection](https://github.com/coegithub/airlinebookingrepo/blob/main/server/pool.js): `server/pool.js`
- **Neon Postgres**
- [Flight catalog seed](https://github.com/coegithub/airlinebookingrepo/blob/main/shared/products.js): `shared/products.js`
- [Fare calculations](https://github.com/coegithub/airlinebookingrepo/blob/main/shared/pricing.js): `shared/pricing.js`

### Other components

- **Traveller**

## Connections

- Traveller → React app: uses (evidence: `README.md`)
- React app → Flight discovery: routes to (evidence: `src/App.jsx`)
- React app → Flight details: routes to (evidence: `src/App.jsx`)
- Flight discovery → Trip and saved flights: reads catalog (evidence: `src/pages/Home.jsx`)
- Flight details → Trip and saved flights: reads and updates (evidence: `src/pages/ProductDetail.jsx`)
- Flight discovery → Flight cards: renders (evidence: `src/pages/Home.jsx`)
- Flight details → Flight cards: renders related (evidence: `src/pages/ProductDetail.jsx`)
- Trip and saved flights → Catalog and orders API: fetches catalog (evidence: `src/context/StoreContext.jsx`)
- Catalog and orders API → HTTP client: sends requests (evidence: `src/services/api.js`)
- Trip cart → Trip and saved flights: reads trip (evidence: `src/pages/Cart.jsx`)
- Saved flights → Trip and saved flights: reads saved flights (evidence: `src/pages/Wishlist.jsx`)
- Booking checkout → Trip and saved flights: reads and clears trip (evidence: `src/pages/Checkout.jsx`)
- Booking checkout → Catalog and orders API: creates booking (evidence: `src/pages/Checkout.jsx`)
- Booking checkout → Fare calculations: shows totals
- Booking history → Catalog and orders API: loads bookings (evidence: `src/pages/Orders.jsx`)
- Booking details → Catalog and orders API: loads booking (evidence: `src/pages/OrderDetail.jsx`)
- Account session → Authentication client: manages session (evidence: `src/context/AuthContext.jsx`)
- Authentication client → HTTP client: sends requests (evidence: `src/services/auth.js`)
- React app → Account session: provides account state (evidence: `src/main.jsx`)
- Traveller → Booking checkout: submits booking (evidence: `README.md`)
- HTTP client → Express server: calls API (evidence: `README.md`)
- Express server → Booking API: mounts routes (evidence: `server/index.js`)
- Express server → Account and sessions: mounts auth (evidence: `server/index.js`)
- Booking API → Catalog and booking store: reads and writes (evidence: `server/api.js`)
- Account and sessions → Catalog and booking store: claims records (evidence: `server/identity.js`)
- Catalog and booking store → Database connection: queries (evidence: `server/db.js`)
- Database connection → Neon Postgres: connects (evidence: `README.md`)
- Catalog and booking store → Flight catalog seed: seeds catalog (evidence: `server/db.js`)
- Catalog and booking store → Fare calculations: calculates booking totals (evidence: `server/db.js`)
- Account and sessions → Neon Postgres: stores accounts and sessions (evidence: `server/identity.js`)
