# gabrielscordeiro/airbnb-clone architecture

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

- Interactive diagram: https://gitdiagram.com/gabrielscordeiro/airbnb-clone
- Repository: https://github.com/gabrielscordeiro/airbnb-clone

## Overview

This is a Next.js Airbnb-style rental marketplace. Visitors browse and filter listings, inspect availability and pricing, then reserve; signed-in users can manage trips, guest bookings, properties, and favorites. The graph includes those product branches and the authentication, API, and persistence layers. The README documents search filters and Cloudinary uploads, but sampled evidence does not establish all implementation links, so those links are marked unverified or omitted.

Main entry points: [`app/actions/getCurrentUser.ts`](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/actions/getCurrentUser.ts) (Current user lookup), [`app/libs/prismadb.ts`](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/libs/prismadb.ts) (Prisma database), [`app/listings/[listingId]/page.tsx`](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/listings/%5BlistingId%5D/page.tsx) (Listing detail page), [`app/api/reservations`](https://github.com/gabrielscordeiro/airbnb-clone/tree/main/app/api/reservations) (Reservation endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Marketplace experience"]
  node_home["Listing discovery<br/>[page.tsx]"]
  node_search["Search controls<br/>[SearchModal.tsx]"]
  node_searchbar["Search entry<br/>[Search.tsx]"]
  node_listingcard["Listing cards<br/>[ListingCard.tsx]"]
  node_detailpage["Listing detail page<br/>[page.tsx]"]
end

subgraph group_booking["Booking and management"]
  node_detailclient["Listing and booking UI<br/>[ListingClient.tsx]"]
  node_favorites["Favorites<br/>[page.tsx]"]
  node_favoriteclient["Favorites view"]
  node_trips["Guest trips<br/>[page.tsx]"]
  node_tripsclient["Trip management<br/>[TripsClient.tsx]"]
  node_ownerreservations["Owner reservations<br/>[page.tsx]"]
  node_reservationclient["Reservation management"]
  node_properties["Property management<br/>[page.tsx]"]
  node_propertiesclient["Property controls"]
end

subgraph group_services["Application services"]
  node_api["Marketplace API"]
  node_listingapi["Listing endpoints"]
  node_reservationapi["Reservation endpoints"]
  node_favoriteapi["Favorite endpoint<br/>[route.ts]"]
  node_registerapi["Registration endpoint<br/>[route.ts]"]
end

subgraph group_persistence["Identity and persistence"]
  node_currentuser["Current user lookup<br/>[getCurrentUser.ts]"]
  node_auth["NextAuth providers<br/>[&#91;...nextauth&#93;.ts]"]
  node_listingqueries["Listing queries<br/>[getListings.ts]"]
  node_listingquery["Listing by ID<br/>[getListingById.ts]"]
  node_reservationqueries["Reservation queries<br/>[getReservations.ts]"]
  node_favoritequeries["Favorite listings query"]
  node_database[("Prisma database<br/>[prismadb.ts]")]
end

node_visitor(("Visitor"))
node_cloudinary["Cloudinary CDN"]

node_visitor -->|"browses"| node_home
node_home -->|"loads listings"| node_listingqueries
node_home -->|"loads user"| node_currentuser
node_home -->|"renders"| node_listingcard
node_searchbar -->|"opens"| node_search
node_search -->|"uses modal state"| node_searchbar
node_search -.->|"filters listings"| node_listingqueries
node_listingcard -->|"opens listing"| node_detailpage
node_detailpage -->|"loads listing"| node_listingquery
node_detailpage -->|"loads availability"| node_reservationqueries
node_detailpage -->|"loads user"| node_currentuser
node_detailpage -->|"renders"| node_detailclient
node_detailclient -->|"creates reservation"| node_reservationapi
node_favorites -->|"loads user"| node_currentuser
node_favorites -->|"loads favorites"| node_favoritequeries
node_favorites -->|"renders"| node_favoriteclient
node_favoriteclient -->|"renders cards"| node_listingcard
node_trips -->|"loads user"| node_currentuser
node_trips -->|"loads reservations"| node_reservationqueries
node_trips -->|"renders"| node_tripsclient
node_tripsclient -->|"cancels reservation"| node_reservationapi
node_ownerreservations -->|"loads user"| node_currentuser
node_ownerreservations -->|"loads reservations"| node_reservationqueries
node_ownerreservations -->|"renders"| node_reservationclient
node_reservationclient -->|"cancels reservation"| node_reservationapi
node_properties -->|"loads user"| node_currentuser
node_properties -->|"loads listings"| node_listingqueries
node_properties -->|"renders"| node_propertiesclient
node_propertiesclient -->|"deletes property"| node_listingapi
node_listingapi -->|"reads and writes"| node_database
node_listingapi -->|"checks identity"| node_currentuser
node_reservationapi -->|"reads and writes"| node_database
node_reservationapi -->|"checks identity"| node_currentuser
node_favoriteapi -->|"reads and writes"| node_database
node_favoriteapi -->|"checks identity"| node_currentuser
node_registerapi -->|"creates account"| node_database
node_currentuser -->|"reads session"| node_auth
node_currentuser -->|"looks up user"| node_database
node_auth -->|"uses Prisma"| node_database
node_listingqueries -->|"queries listings"| node_database
node_listingquery -->|"queries listing"| node_database
node_reservationqueries -->|"queries reservations"| node_database
node_favoritequeries -->|"queries favorites"| node_database
node_propertiesclient -.->|"uploads images"| node_cloudinary

click node_home "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/page.tsx"
click node_search "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/components/modals/SearchModal.tsx"
click node_searchbar "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/components/navbar/Search.tsx"
click node_listingcard "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/components/listings/ListingCard.tsx"
click node_detailpage "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/listings/%5BlistingId%5D/page.tsx"
click node_detailclient "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/listings/%5BlistingId%5D/ListingClient.tsx"
click node_favorites "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/favorites/page.tsx"
click node_favoriteclient "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/favorites/FavoritesClient.tsx"
click node_trips "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/trips/page.tsx"
click node_tripsclient "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/trips/TripsClient.tsx"
click node_ownerreservations "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/reservations/page.tsx"
click node_reservationclient "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/reservations/ReservationsClient.tsx"
click node_properties "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/properties/page.tsx"
click node_propertiesclient "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/properties/PropertiesClient.tsx"
click node_api "https://github.com/gabrielscordeiro/airbnb-clone/tree/main/app/api"
click node_listingapi "https://github.com/gabrielscordeiro/airbnb-clone/tree/main/app/api/listings"
click node_reservationapi "https://github.com/gabrielscordeiro/airbnb-clone/tree/main/app/api/reservations"
click node_favoriteapi "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/api/favorites/%5BlistingId%5D/route.ts"
click node_registerapi "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/api/register/route.ts"
click node_currentuser "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/actions/getCurrentUser.ts"
click node_auth "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/pages/api/auth/%5B...nextauth%5D.ts"
click node_listingqueries "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/actions/getListings.ts"
click node_listingquery "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/actions/getListingById.ts"
click node_reservationqueries "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/actions/getReservations.ts"
click node_favoritequeries "https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/actions/getFavoritesListing.ts"
click node_database "https://github.com/gabrielscordeiro/airbnb-clone/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_searchbar,node_listingcard,node_detailpage toneBlue
class node_detailclient,node_favorites,node_favoriteclient,node_trips,node_tripsclient,node_ownerreservations,node_reservationclient,node_properties,node_propertiesclient toneAmber
class node_api,node_listingapi,node_reservationapi,node_favoriteapi,node_registerapi toneMint
class node_currentuser,node_auth,node_listingqueries,node_listingquery,node_reservationqueries,node_favoritequeries,node_database toneRose
class node_visitor,node_cloudinary toneIndigo
```

## Components

### Marketplace experience

- [Listing discovery](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/page.tsx): `app/page.tsx`
- [Search controls](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/components/modals/SearchModal.tsx): `app/components/modals/SearchModal.tsx`
- [Search entry](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/components/navbar/Search.tsx): `app/components/navbar/Search.tsx`
- [Listing cards](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/components/listings/ListingCard.tsx): `app/components/listings/ListingCard.tsx`
- [Listing detail page](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/listings/%5BlistingId%5D/page.tsx): `app/listings/[listingId]/page.tsx`

### Booking and management

- [Listing and booking UI](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/listings/%5BlistingId%5D/ListingClient.tsx): `app/listings/[listingId]/ListingClient.tsx`
- [Favorites](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/favorites/page.tsx): `app/favorites/page.tsx`
- [Favorites view](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/favorites/FavoritesClient.tsx): `app/favorites/FavoritesClient.tsx`
- [Guest trips](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/trips/page.tsx): `app/trips/page.tsx`
- [Trip management](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/trips/TripsClient.tsx): `app/trips/TripsClient.tsx`
- [Owner reservations](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/reservations/page.tsx): `app/reservations/page.tsx`
- [Reservation management](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/reservations/ReservationsClient.tsx): `app/reservations/ReservationsClient.tsx`
- [Property management](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/properties/page.tsx): `app/properties/page.tsx`
- [Property controls](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/properties/PropertiesClient.tsx): `app/properties/PropertiesClient.tsx`

### Application services

- [Marketplace API](https://github.com/gabrielscordeiro/airbnb-clone/tree/main/app/api): `app/api`
- [Listing endpoints](https://github.com/gabrielscordeiro/airbnb-clone/tree/main/app/api/listings): `app/api/listings`
- [Reservation endpoints](https://github.com/gabrielscordeiro/airbnb-clone/tree/main/app/api/reservations): `app/api/reservations`
- [Favorite endpoint](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/api/favorites/%5BlistingId%5D/route.ts): `app/api/favorites/[listingId]/route.ts`
- [Registration endpoint](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/api/register/route.ts): `app/api/register/route.ts`

### Identity and persistence

- [Current user lookup](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/actions/getCurrentUser.ts): `app/actions/getCurrentUser.ts`
- [NextAuth providers](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/pages/api/auth/%5B...nextauth%5D.ts): `pages/api/auth/[...nextauth].ts`
- [Listing queries](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/actions/getListings.ts): `app/actions/getListings.ts`
- [Listing by ID](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/actions/getListingById.ts): `app/actions/getListingById.ts`
- [Reservation queries](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/actions/getReservations.ts): `app/actions/getReservations.ts`
- [Favorite listings query](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/actions/getFavoritesListing.ts): `app/actions/getFavoritesListing.ts`
- [Prisma database](https://github.com/gabrielscordeiro/airbnb-clone/blob/main/app/libs/prismadb.ts): `app/libs/prismadb.ts`

### Other components

- **Visitor**
- **Cloudinary CDN**

## Connections

- Visitor → Listing discovery: browses
- Listing discovery → Listing queries: loads listings (evidence: `app/page.tsx`)
- Listing discovery → Current user lookup: loads user (evidence: `app/page.tsx`)
- Listing discovery → Listing cards: renders (evidence: `app/page.tsx`)
- Search entry → Search controls: opens (evidence: `app/components/navbar/Search.tsx`)
- Search controls → Search entry: uses modal state (evidence: `app/components/modals/SearchModal.tsx`)
- Search controls → Listing queries: filters listings
- Listing cards → Listing detail page: opens listing (evidence: `app/components/listings/ListingCard.tsx`)
- Listing detail page → Listing by ID: loads listing (evidence: `app/listings/[listingId]/page.tsx`)
- Listing detail page → Reservation queries: loads availability (evidence: `app/listings/[listingId]/page.tsx`)
- Listing detail page → Current user lookup: loads user (evidence: `app/listings/[listingId]/page.tsx`)
- Listing detail page → Listing and booking UI: renders (evidence: `app/listings/[listingId]/page.tsx`)
- Listing and booking UI → Reservation endpoints: creates reservation (evidence: `app/listings/[listingId]/ListingClient.tsx`)
- Favorites → Current user lookup: loads user (evidence: `app/favorites/page.tsx`)
- Favorites → Favorite listings query: loads favorites (evidence: `app/favorites/page.tsx`)
- Favorites → Favorites view: renders (evidence: `app/favorites/page.tsx`)
- Favorites view → Listing cards: renders cards (evidence: `app/favorites/FavoritesClient.tsx`)
- Guest trips → Current user lookup: loads user (evidence: `app/trips/page.tsx`)
- Guest trips → Reservation queries: loads reservations (evidence: `app/trips/page.tsx`)
- Guest trips → Trip management: renders (evidence: `app/trips/page.tsx`)
- Trip management → Reservation endpoints: cancels reservation (evidence: `app/trips/TripsClient.tsx`)
- Owner reservations → Current user lookup: loads user (evidence: `app/reservations/page.tsx`)
- Owner reservations → Reservation queries: loads reservations (evidence: `app/reservations/page.tsx`)
- Owner reservations → Reservation management: renders (evidence: `app/reservations/page.tsx`)
- Reservation management → Reservation endpoints: cancels reservation (evidence: `app/reservations/ReservationsClient.tsx`)
- Property management → Current user lookup: loads user (evidence: `app/properties/page.tsx`)
- Property management → Listing queries: loads listings (evidence: `app/properties/page.tsx`)
- Property management → Property controls: renders (evidence: `app/properties/page.tsx`)
- Property controls → Listing endpoints: deletes property (evidence: `app/properties/PropertiesClient.tsx`)
- Listing endpoints → Prisma database: reads and writes (evidence: `app/api/listings/route.ts`)
- Listing endpoints → Current user lookup: checks identity (evidence: `app/api/listings/route.ts`)
- Reservation endpoints → Prisma database: reads and writes (evidence: `app/api/reservations/route.ts`)
- Reservation endpoints → Current user lookup: checks identity (evidence: `app/api/reservations/route.ts`)
- Favorite endpoint → Prisma database: reads and writes (evidence: `app/api/favorites/[listingId]/route.ts`)
- Favorite endpoint → Current user lookup: checks identity (evidence: `app/api/favorites/[listingId]/route.ts`)
- Registration endpoint → Prisma database: creates account (evidence: `app/api/register/route.ts`)
- Current user lookup → NextAuth providers: reads session (evidence: `app/actions/getCurrentUser.ts`)
- Current user lookup → Prisma database: looks up user (evidence: `app/actions/getCurrentUser.ts`)
- NextAuth providers → Prisma database: uses Prisma (evidence: `pages/api/auth/[...nextauth].ts`)
- Listing queries → Prisma database: queries listings (evidence: `app/actions/getListings.ts`)
- Listing by ID → Prisma database: queries listing (evidence: `app/actions/getListingById.ts`)
- Reservation queries → Prisma database: queries reservations (evidence: `app/actions/getReservations.ts`)
- Favorite listings query → Prisma database: queries favorites (evidence: `app/actions/getFavoritesListing.ts`)
- Property controls → Cloudinary CDN: uploads images
