# ps-lolfan/airbnb architecture

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

- Interactive diagram: https://gitdiagram.com/ps-lolfan/airbnb
- Repository: https://github.com/ps-lolfan/airbnb

## Overview

This is a Next.js accommodation marketplace: visitors browse listings, inspect availability and reserve stays; signed-in users can manage trips, guest bookings, properties and favorites. The graph separates discovery, booking, account workflows and shared infrastructure. Source excerpts establish the reservation request and session lookup; other links rely on the SOURCE INDEX references, so details of unsampled implementations are not inferred beyond those references.

Main entry points: [`app/actions/getCurrentUser.ts`](https://github.com/ps-lolfan/airbnb/blob/main/app/actions/getCurrentUser.ts) (Current user), [`app/libs/prismadb.ts`](https://github.com/ps-lolfan/airbnb/blob/main/app/libs/prismadb.ts) (Prisma database), [`app/listings/[listingId]/page.tsx`](https://github.com/ps-lolfan/airbnb/blob/main/app/listings/%5BlistingId%5D/page.tsx) (Listing detail page), [`app/actions/getListings.ts`](https://github.com/ps-lolfan/airbnb/blob/main/app/actions/getListings.ts) (Listing queries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Browse listings"]
  node_home["Browse page<br/>[page.tsx]"]
  node_search["Search interface<br/>[SearchModal.tsx]"]
  node_listing_query["Listing queries<br/>[getListings.ts]"]
  node_listing_card["Listing card<br/>[ListingCard.tsx]"]
end

subgraph group_booking["Listing and booking"]
  node_detail_page["Listing detail page<br/>[page.tsx]"]
  node_detail_client["Listing details<br/>[ListingClient.tsx]"]
  node_reservation_widget["Date and price"]
  node_reservation_api["Reservation API<br/>[route.ts]"]
end

subgraph group_account["User workflows"]
  node_trips_page["Trips page<br/>[page.tsx]"]
  node_trips_client["Trips view<br/>[TripsClient.tsx]"]
  node_guest_bookings["Guest bookings<br/>[page.tsx]"]
  node_guest_client["Reservations view"]
  node_properties_page["Properties page<br/>[page.tsx]"]
  node_properties_client["Property manager"]
  node_favorites_page["Favorites page<br/>[page.tsx]"]
  node_favorite_query["Favorite listings"]
  node_favorite_api["Favorites API<br/>[route.ts]"]
  node_listing_api["Listing API<br/>[route.ts]"]
  node_rent_modal["Create listing<br/>[RentModal.tsx]"]
  node_registration["Registration API<br/>[route.ts]"]
end

subgraph group_platform["Shared services"]
  node_session["Current user<br/>[getCurrentUser.ts]"]
  node_auth["NextAuth<br/>[&#91;...nextauth&#93;.ts]"]
  node_database[("Prisma database<br/>[prismadb.ts]")]
end

node_visitor(("Visitor"))

node_visitor -->|"browses"| node_home
node_home -->|"loads listings"| node_listing_query
node_home -->|"renders"| node_listing_card
node_visitor -.->|"sets filters"| node_search
node_search -.->|"filters listings"| node_listing_query
node_listing_query -->|"queries"| node_database
node_listing_card -->|"opens listing"| node_detail_page
node_detail_page -->|"renders"| node_detail_client
node_detail_page -->|"loads user"| node_session
node_detail_page -->|"loads listing"| node_listing_query
node_detail_client -->|"renders"| node_reservation_widget
node_detail_client -->|"posts reservation"| node_reservation_api
node_reservation_api -.->|"stores reservation"| node_database
node_trips_page -->|"renders"| node_trips_client
node_trips_page -->|"loads user"| node_session
node_trips_client -->|"cancels reservation"| node_reservation_api
node_guest_bookings -->|"renders"| node_guest_client
node_guest_bookings -->|"loads user"| node_session
node_guest_client -->|"cancels reservation"| node_reservation_api
node_properties_page -->|"renders"| node_properties_client
node_properties_page -->|"loads user"| node_session
node_properties_client -->|"deletes listing"| node_listing_api
node_rent_modal -.->|"creates listing"| node_listing_api
node_favorites_page -->|"loads favorites"| node_favorite_query
node_favorites_page -->|"loads user"| node_session
node_favorite_query -->|"queries"| node_database
node_favorite_api -.->|"updates favorites"| node_database
node_registration -.->|"creates user"| node_database
node_session -->|"reads session"| node_auth
node_session -->|"looks up user"| node_database
node_auth -.->|"uses adapter"| node_database

click node_home "https://github.com/ps-lolfan/airbnb/blob/main/app/page.tsx"
click node_search "https://github.com/ps-lolfan/airbnb/blob/main/app/components/modals/SearchModal.tsx"
click node_listing_query "https://github.com/ps-lolfan/airbnb/blob/main/app/actions/getListings.ts"
click node_listing_card "https://github.com/ps-lolfan/airbnb/blob/main/app/components/Listings/ListingCard.tsx"
click node_detail_page "https://github.com/ps-lolfan/airbnb/blob/main/app/listings/%5BlistingId%5D/page.tsx"
click node_detail_client "https://github.com/ps-lolfan/airbnb/blob/main/app/listings/%5BlistingId%5D/ListingClient.tsx"
click node_reservation_widget "https://github.com/ps-lolfan/airbnb/blob/main/app/components/Listings/ListingReservation.tsx"
click node_reservation_api "https://github.com/ps-lolfan/airbnb/blob/main/app/api/reservations/route.ts"
click node_trips_page "https://github.com/ps-lolfan/airbnb/blob/main/app/trips/page.tsx"
click node_trips_client "https://github.com/ps-lolfan/airbnb/blob/main/app/trips/TripsClient.tsx"
click node_guest_bookings "https://github.com/ps-lolfan/airbnb/blob/main/app/reservations/page.tsx"
click node_guest_client "https://github.com/ps-lolfan/airbnb/blob/main/app/reservations/ReservationsClient.tsx"
click node_properties_page "https://github.com/ps-lolfan/airbnb/blob/main/app/properties/page.tsx"
click node_properties_client "https://github.com/ps-lolfan/airbnb/blob/main/app/properties/PropertiesClient.tsx"
click node_favorites_page "https://github.com/ps-lolfan/airbnb/blob/main/app/favorites/page.tsx"
click node_favorite_query "https://github.com/ps-lolfan/airbnb/blob/main/app/actions/getFavoriteListings.ts"
click node_favorite_api "https://github.com/ps-lolfan/airbnb/blob/main/app/api/favorites/%5BlistingId%5D/route.ts"
click node_listing_api "https://github.com/ps-lolfan/airbnb/blob/main/app/api/listings/%5BlistingId%5D/route.ts"
click node_rent_modal "https://github.com/ps-lolfan/airbnb/blob/main/app/components/modals/RentModal.tsx"
click node_registration "https://github.com/ps-lolfan/airbnb/blob/main/app/api/register/route.ts"
click node_session "https://github.com/ps-lolfan/airbnb/blob/main/app/actions/getCurrentUser.ts"
click node_auth "https://github.com/ps-lolfan/airbnb/blob/main/pages/api/auth/%5B...nextauth%5D.ts"
click node_database "https://github.com/ps-lolfan/airbnb/blob/main/app/libs/prismadb.ts"

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_home,node_search,node_listing_query,node_listing_card toneBlue
class node_detail_page,node_detail_client,node_reservation_widget,node_reservation_api toneAmber
class node_trips_page,node_trips_client,node_guest_bookings,node_guest_client,node_properties_page,node_properties_client,node_favorites_page,node_favorite_query,node_favorite_api,node_listing_api,node_rent_modal,node_registration toneMint
class node_session,node_auth,node_database toneRose
class node_visitor toneIndigo
```

## Components

### Browse listings

- [Browse page](https://github.com/ps-lolfan/airbnb/blob/main/app/page.tsx): `app/page.tsx`
- [Search interface](https://github.com/ps-lolfan/airbnb/blob/main/app/components/modals/SearchModal.tsx): `app/components/modals/SearchModal.tsx`
- [Listing queries](https://github.com/ps-lolfan/airbnb/blob/main/app/actions/getListings.ts): `app/actions/getListings.ts`
- [Listing card](https://github.com/ps-lolfan/airbnb/blob/main/app/components/Listings/ListingCard.tsx): `app/components/Listings/ListingCard.tsx`

### Listing and booking

- [Listing detail page](https://github.com/ps-lolfan/airbnb/blob/main/app/listings/%5BlistingId%5D/page.tsx): `app/listings/[listingId]/page.tsx`
- [Listing details](https://github.com/ps-lolfan/airbnb/blob/main/app/listings/%5BlistingId%5D/ListingClient.tsx): `app/listings/[listingId]/ListingClient.tsx`
- [Date and price](https://github.com/ps-lolfan/airbnb/blob/main/app/components/Listings/ListingReservation.tsx): `app/components/Listings/ListingReservation.tsx`
- [Reservation API](https://github.com/ps-lolfan/airbnb/blob/main/app/api/reservations/route.ts): `app/api/reservations/route.ts`

### User workflows

- [Trips page](https://github.com/ps-lolfan/airbnb/blob/main/app/trips/page.tsx): `app/trips/page.tsx`
- [Trips view](https://github.com/ps-lolfan/airbnb/blob/main/app/trips/TripsClient.tsx): `app/trips/TripsClient.tsx`
- [Guest bookings](https://github.com/ps-lolfan/airbnb/blob/main/app/reservations/page.tsx): `app/reservations/page.tsx`
- [Reservations view](https://github.com/ps-lolfan/airbnb/blob/main/app/reservations/ReservationsClient.tsx): `app/reservations/ReservationsClient.tsx`
- [Properties page](https://github.com/ps-lolfan/airbnb/blob/main/app/properties/page.tsx): `app/properties/page.tsx`
- [Property manager](https://github.com/ps-lolfan/airbnb/blob/main/app/properties/PropertiesClient.tsx): `app/properties/PropertiesClient.tsx`
- [Favorites page](https://github.com/ps-lolfan/airbnb/blob/main/app/favorites/page.tsx): `app/favorites/page.tsx`
- [Favorite listings](https://github.com/ps-lolfan/airbnb/blob/main/app/actions/getFavoriteListings.ts): `app/actions/getFavoriteListings.ts`
- [Favorites API](https://github.com/ps-lolfan/airbnb/blob/main/app/api/favorites/%5BlistingId%5D/route.ts): `app/api/favorites/[listingId]/route.ts`
- [Listing API](https://github.com/ps-lolfan/airbnb/blob/main/app/api/listings/%5BlistingId%5D/route.ts): `app/api/listings/[listingId]/route.ts`
- [Create listing](https://github.com/ps-lolfan/airbnb/blob/main/app/components/modals/RentModal.tsx): `app/components/modals/RentModal.tsx`
- [Registration API](https://github.com/ps-lolfan/airbnb/blob/main/app/api/register/route.ts): `app/api/register/route.ts`

### Shared services

- [Current user](https://github.com/ps-lolfan/airbnb/blob/main/app/actions/getCurrentUser.ts): `app/actions/getCurrentUser.ts`
- [NextAuth](https://github.com/ps-lolfan/airbnb/blob/main/pages/api/auth/%5B...nextauth%5D.ts): `pages/api/auth/[...nextauth].ts`
- [Prisma database](https://github.com/ps-lolfan/airbnb/blob/main/app/libs/prismadb.ts): `app/libs/prismadb.ts`

### Other components

- **Visitor**

## Connections

- Visitor → Browse page: browses (evidence: `app/page.tsx`)
- Browse page → Listing queries: loads listings (evidence: `app/page.tsx`)
- Browse page → Listing card: renders (evidence: `app/page.tsx`)
- Visitor → Search interface: sets filters
- Search interface → Listing queries: filters listings
- Listing queries → Prisma database: queries (evidence: `app/actions/getListings.ts`)
- Listing card → Listing detail page: opens listing (evidence: `app/components/Listings/ListingCard.tsx`)
- Listing detail page → Listing details: renders (evidence: `app/listings/[listingId]/page.tsx`)
- Listing detail page → Current user: loads user (evidence: `app/listings/[listingId]/page.tsx`)
- Listing detail page → Listing queries: loads listing (evidence: `app/listings/[listingId]/page.tsx`)
- Listing details → Date and price: renders (evidence: `app/listings/[listingId]/ListingClient.tsx`)
- Listing details → Reservation API: posts reservation (evidence: `app/listings/[listingId]/ListingClient.tsx`)
- Reservation API → Prisma database: stores reservation (evidence: `app/api/reservations/route.ts`)
- Trips page → Trips view: renders (evidence: `app/trips/page.tsx`)
- Trips page → Current user: loads user (evidence: `app/trips/page.tsx`)
- Trips view → Reservation API: cancels reservation (evidence: `app/trips/TripsClient.tsx`)
- Guest bookings → Reservations view: renders (evidence: `app/reservations/page.tsx`)
- Guest bookings → Current user: loads user (evidence: `app/reservations/page.tsx`)
- Reservations view → Reservation API: cancels reservation (evidence: `app/reservations/ReservationsClient.tsx`)
- Properties page → Property manager: renders (evidence: `app/properties/page.tsx`)
- Properties page → Current user: loads user (evidence: `app/properties/page.tsx`)
- Property manager → Listing API: deletes listing (evidence: `app/properties/PropertiesClient.tsx`)
- Create listing → Listing API: creates listing
- Favorites page → Favorite listings: loads favorites (evidence: `app/favorites/page.tsx`)
- Favorites page → Current user: loads user (evidence: `app/favorites/page.tsx`)
- Favorite listings → Prisma database: queries (evidence: `app/actions/getFavoriteListings.ts`)
- Favorites API → Prisma database: updates favorites (evidence: `app/api/favorites/[listingId]/route.ts`)
- Registration API → Prisma database: creates user (evidence: `app/api/register/route.ts`)
- Current user → NextAuth: reads session (evidence: `app/actions/getCurrentUser.ts`)
- Current user → Prisma database: looks up user (evidence: `app/actions/getCurrentUser.ts`)
- NextAuth → Prisma database: uses adapter (evidence: `pages/api/auth/[...nextauth].ts`)
