# divyeshio/next-airbnb architecture

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

- Interactive diagram: https://gitdiagram.com/divyeshio/next-airbnb
- Repository: https://github.com/divyeshio/next-airbnb

## Overview

This is a Next.js Airbnb-style rental marketplace. Guests browse and filter listings, view property details, and book or cancel trips; owners create properties and manage reservations, while users can save favorites. Server actions and API routes provide data operations, with NextAuth identity and Prisma persistence. The README documents additional integrations and capabilities whose wiring is not shown in the sampled source, so those links are marked unverified.

Main entry points: [`src/app/libs/prismadb.ts`](https://github.com/divyeshio/next-airbnb/blob/main/src/app/libs/prismadb.ts) (Prisma client), [`src/app/page.tsx`](https://github.com/divyeshio/next-airbnb/blob/main/src/app/page.tsx) (Browse listings), [`src/app/actions/getListings.ts`](https://github.com/divyeshio/next-airbnb/blob/main/src/app/actions/getListings.ts) (Listing queries), [`src/app/components/listings/ListingCard.tsx`](https://github.com/divyeshio/next-airbnb/blob/main/src/app/components/listings/ListingCard.tsx) (Listing cards)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browse["Discovery and listings"]
  node_home["Browse listings<br/>[page.tsx]"]
  node_search["Search filters<br/>[SearchModal.tsx]"]
  node_listingdetail["Listing details<br/>[ListingClient.tsx]"]
  node_listingcard["Listing cards<br/>[ListingCard.tsx]"]
  node_favorites["Favorites"]
end

subgraph group_booking["Bookings and owner tools"]
  node_propertycreate["Property creation<br/>[RentModal.tsx]"]
  node_imageupload["Image upload<br/>[ImageUpload.tsx]"]
  node_trips["Guest trips<br/>[TripsClient.tsx]"]
  node_ownerreservations["Owner reservations"]
  node_properties["My properties"]
  node_reservationapi["Reservation API"]
  node_listingapi["Listing API"]
end

subgraph group_identity["Identity and favorites"]
  node_favoritesapi["Favorites API<br/>[route.ts]"]
  node_auth["Authentication<br/>[&#91;...nextauth&#93;.ts]"]
  node_register["Registration API<br/>[route.ts]"]
  node_currentuser["Current user<br/>[getCurrentUser.ts]"]
end

subgraph group_data["Server data layer"]
  node_listingactions["Listing queries<br/>[getListings.ts]"]
  node_reservationactions["Reservation queries<br/>[getReservations.ts]"]
  node_listinglookup["Listing lookup<br/>[getListingById.ts]"]
  node_favoritequeries["Favorite queries"]
  node_dbclient["Prisma client<br/>[prismadb.ts]"]
  node_database[("MongoDB")]
end

node_guest(("Guest"))
node_cloudinary["Cloudinary CDN"]

node_guest -->|"browses"| node_home
node_home -->|"loads listings"| node_listingactions
node_listingactions -->|"queries"| node_dbclient
node_home -->|"renders"| node_listingcard
node_guest -.->|"sets filters"| node_search
node_search -.->|"filters results"| node_home
node_listingcard -->|"opens listing"| node_listingdetail
node_guest -->|"views details"| node_listingdetail
node_listingdetail -.->|"requests listing"| node_listingapi
node_listingapi -->|"reads and writes"| node_dbclient
node_guest -.->|"views saved listings"| node_favorites
node_favorites -->|"loads favorites"| node_favoritequeries
node_favoritequeries -.->|"queries"| node_dbclient
node_listingcard -.->|"toggles favorite"| node_favoritesapi
node_guest -.->|"creates property"| node_propertycreate
node_propertycreate -.->|"submits listing"| node_listingapi
node_propertycreate -.->|"uses upload"| node_imageupload
node_imageupload -.->|"uploads images"| node_cloudinary
node_guest -.->|"manages trips"| node_trips
node_trips -->|"cancels reservation"| node_reservationapi
node_ownerreservations -->|"cancels booking"| node_reservationapi
node_trips -->|"loads reservations"| node_reservationactions
node_ownerreservations -->|"loads reservations"| node_reservationactions
node_properties -->|"loads properties"| node_listingactions
node_reservationapi -->|"reads and writes"| node_dbclient
node_guest -.->|"signs in"| node_auth
node_guest -.->|"registers"| node_register
node_auth -->|"uses adapter storage"| node_dbclient
node_register -->|"creates user"| node_dbclient
node_currentuser -->|"reads session"| node_auth
node_currentuser -->|"loads user"| node_dbclient
node_listingactions -.->|"persists data"| node_database
node_dbclient -.->|"connects"| node_database

click node_home "https://github.com/divyeshio/next-airbnb/blob/main/src/app/page.tsx"
click node_search "https://github.com/divyeshio/next-airbnb/blob/main/src/app/components/modals/SearchModal.tsx"
click node_listingdetail "https://github.com/divyeshio/next-airbnb/blob/main/src/app/listings/%5BlistingId%5D/ListingClient.tsx"
click node_listingcard "https://github.com/divyeshio/next-airbnb/blob/main/src/app/components/listings/ListingCard.tsx"
click node_favorites "https://github.com/divyeshio/next-airbnb/blob/main/src/app/favorites/FavoritesClient.tsx"
click node_propertycreate "https://github.com/divyeshio/next-airbnb/blob/main/src/app/components/modals/RentModal.tsx"
click node_imageupload "https://github.com/divyeshio/next-airbnb/blob/main/src/app/components/inputs/ImageUpload.tsx"
click node_trips "https://github.com/divyeshio/next-airbnb/blob/main/src/app/trips/TripsClient.tsx"
click node_ownerreservations "https://github.com/divyeshio/next-airbnb/blob/main/src/app/reservations/ReservationsClient.tsx"
click node_properties "https://github.com/divyeshio/next-airbnb/blob/main/src/app/properties/PropertiesClient.tsx"
click node_reservationapi "https://github.com/divyeshio/next-airbnb/tree/main/src/app/api/reservations"
click node_listingapi "https://github.com/divyeshio/next-airbnb/tree/main/src/app/api/listings"
click node_favoritesapi "https://github.com/divyeshio/next-airbnb/blob/main/src/app/api/favorites/%5BlistingId%5D/route.ts"
click node_auth "https://github.com/divyeshio/next-airbnb/blob/main/src/pages/api/auth/%5B...nextauth%5D.ts"
click node_register "https://github.com/divyeshio/next-airbnb/blob/main/src/app/api/register/route.ts"
click node_currentuser "https://github.com/divyeshio/next-airbnb/blob/main/src/app/actions/getCurrentUser.ts"
click node_listingactions "https://github.com/divyeshio/next-airbnb/blob/main/src/app/actions/getListings.ts"
click node_reservationactions "https://github.com/divyeshio/next-airbnb/blob/main/src/app/actions/getReservations.ts"
click node_listinglookup "https://github.com/divyeshio/next-airbnb/blob/main/src/app/actions/getListingById.ts"
click node_favoritequeries "https://github.com/divyeshio/next-airbnb/blob/main/src/app/actions/getFavoriteListings.ts"
click node_dbclient "https://github.com/divyeshio/next-airbnb/blob/main/src/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_listingdetail,node_listingcard,node_favorites toneBlue
class node_propertycreate,node_imageupload,node_trips,node_ownerreservations,node_properties,node_reservationapi,node_listingapi toneAmber
class node_favoritesapi,node_auth,node_register,node_currentuser toneMint
class node_listingactions,node_reservationactions,node_listinglookup,node_favoritequeries,node_dbclient,node_database toneRose
class node_guest,node_cloudinary toneIndigo
```

## Components

### Discovery and listings

- [Browse listings](https://github.com/divyeshio/next-airbnb/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Search filters](https://github.com/divyeshio/next-airbnb/blob/main/src/app/components/modals/SearchModal.tsx): `src/app/components/modals/SearchModal.tsx`
- [Listing details](https://github.com/divyeshio/next-airbnb/blob/main/src/app/listings/%5BlistingId%5D/ListingClient.tsx): `src/app/listings/[listingId]/ListingClient.tsx`
- [Listing cards](https://github.com/divyeshio/next-airbnb/blob/main/src/app/components/listings/ListingCard.tsx): `src/app/components/listings/ListingCard.tsx`
- [Favorites](https://github.com/divyeshio/next-airbnb/blob/main/src/app/favorites/FavoritesClient.tsx): `src/app/favorites/FavoritesClient.tsx`

### Bookings and owner tools

- [Property creation](https://github.com/divyeshio/next-airbnb/blob/main/src/app/components/modals/RentModal.tsx): `src/app/components/modals/RentModal.tsx`
- [Image upload](https://github.com/divyeshio/next-airbnb/blob/main/src/app/components/inputs/ImageUpload.tsx): `src/app/components/inputs/ImageUpload.tsx`
- [Guest trips](https://github.com/divyeshio/next-airbnb/blob/main/src/app/trips/TripsClient.tsx): `src/app/trips/TripsClient.tsx`
- [Owner reservations](https://github.com/divyeshio/next-airbnb/blob/main/src/app/reservations/ReservationsClient.tsx): `src/app/reservations/ReservationsClient.tsx`
- [My properties](https://github.com/divyeshio/next-airbnb/blob/main/src/app/properties/PropertiesClient.tsx): `src/app/properties/PropertiesClient.tsx`
- [Reservation API](https://github.com/divyeshio/next-airbnb/tree/main/src/app/api/reservations): `src/app/api/reservations`
- [Listing API](https://github.com/divyeshio/next-airbnb/tree/main/src/app/api/listings): `src/app/api/listings`

### Identity and favorites

- [Favorites API](https://github.com/divyeshio/next-airbnb/blob/main/src/app/api/favorites/%5BlistingId%5D/route.ts): `src/app/api/favorites/[listingId]/route.ts`
- [Authentication](https://github.com/divyeshio/next-airbnb/blob/main/src/pages/api/auth/%5B...nextauth%5D.ts): `src/pages/api/auth/[...nextauth].ts`
- [Registration API](https://github.com/divyeshio/next-airbnb/blob/main/src/app/api/register/route.ts): `src/app/api/register/route.ts`
- [Current user](https://github.com/divyeshio/next-airbnb/blob/main/src/app/actions/getCurrentUser.ts): `src/app/actions/getCurrentUser.ts`

### Server data layer

- [Listing queries](https://github.com/divyeshio/next-airbnb/blob/main/src/app/actions/getListings.ts): `src/app/actions/getListings.ts`
- [Reservation queries](https://github.com/divyeshio/next-airbnb/blob/main/src/app/actions/getReservations.ts): `src/app/actions/getReservations.ts`
- [Listing lookup](https://github.com/divyeshio/next-airbnb/blob/main/src/app/actions/getListingById.ts): `src/app/actions/getListingById.ts`
- [Favorite queries](https://github.com/divyeshio/next-airbnb/blob/main/src/app/actions/getFavoriteListings.ts): `src/app/actions/getFavoriteListings.ts`
- [Prisma client](https://github.com/divyeshio/next-airbnb/blob/main/src/app/libs/prismadb.ts): `src/app/libs/prismadb.ts`
- **MongoDB**

### Other components

- **Guest**
- **Cloudinary CDN**

## Connections

- Guest → Browse listings: browses (evidence: `src/app/page.tsx`)
- Browse listings → Listing queries: loads listings (evidence: `src/app/page.tsx`)
- Listing queries → Prisma client: queries (evidence: `src/app/actions/getListings.ts`)
- Browse listings → Listing cards: renders (evidence: `src/app/page.tsx`)
- Guest → Search filters: sets filters
- Search filters → Browse listings: filters results
- Listing cards → Listing details: opens listing (evidence: `src/app/components/listings/ListingCard.tsx`)
- Guest → Listing details: views details (evidence: `src/app/listings/[listingId]/ListingClient.tsx`)
- Listing details → Listing API: requests listing
- Listing API → Prisma client: reads and writes (evidence: `src/app/api/listings/route.ts`)
- Guest → Favorites: views saved listings
- Favorites → Favorite queries: loads favorites (evidence: `src/app/favorites/page.tsx`)
- Favorite queries → Prisma client: queries
- Listing cards → Favorites API: toggles favorite
- Guest → Property creation: creates property
- Property creation → Listing API: submits listing
- Property creation → Image upload: uses upload
- Image upload → Cloudinary CDN: uploads images
- Guest → Guest trips: manages trips
- Guest trips → Reservation API: cancels reservation (evidence: `src/app/trips/TripsClient.tsx`)
- Owner reservations → Reservation API: cancels booking (evidence: `src/app/reservations/ReservationsClient.tsx`)
- Guest trips → Reservation queries: loads reservations (evidence: `src/app/trips/page.tsx`)
- Owner reservations → Reservation queries: loads reservations (evidence: `src/app/reservations/page.tsx`)
- My properties → Listing queries: loads properties (evidence: `src/app/properties/page.tsx`)
- Reservation API → Prisma client: reads and writes (evidence: `src/app/api/reservations/route.ts`)
- Guest → Authentication: signs in
- Guest → Registration API: registers
- Authentication → Prisma client: uses adapter storage (evidence: `src/pages/api/auth/[...nextauth].ts`)
- Registration API → Prisma client: creates user (evidence: `src/app/api/register/route.ts`)
- Current user → Authentication: reads session (evidence: `src/app/actions/getCurrentUser.ts`)
- Current user → Prisma client: loads user (evidence: `src/app/actions/getCurrentUser.ts`)
- Listing queries → MongoDB: persists data
- Prisma client → MongoDB: connects
