# christiancl92/rental_escrow architecture

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

- Interactive diagram: https://gitdiagram.com/christiancl92/rental_escrow
- Repository: https://github.com/christiancl92/rental_escrow

## Overview

El Solar is a vacation-rental dApp: guests browse property listings, choose dates, and create USDC-backed bookings; guests can review or cancel reservations, while the owner releases escrow after check-in. The Next.js client coordinates API-backed booking records in Supabase with client-signed Solana transactions; the Anchor program enforces escrow rules. The README also documents a separate, wallet-free marketing-copy generator. Edges are limited to visible calls and README architecture statements; some page-to-hook wiring and backend integrations are not sampled.

Main entry points: [`app/components/BookingCard.tsx`](https://github.com/christiancl92/rental_escrow/blob/main/app/components/BookingCard.tsx) (Date booking), [`programs/rental_escrow/src/lib.rs`](https://github.com/christiancl92/rental_escrow/blob/main/programs/rental_escrow/src/lib.rs) (Escrow instructions), [`app/hooks/useRentalProgram.ts`](https://github.com/christiancl92/rental_escrow/blob/main/app/hooks/useRentalProgram.ts) (Wallet program client), [`app/lib/supabase/initSupabase.ts`](https://github.com/christiancl92/rental_escrow/blob/main/app/lib/supabase/initSupabase.ts) (Supabase database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Rental web app"]
  node_listings["Property listings<br/>[page.tsx]"]
  node_property["Property details<br/>[page.tsx]"]
  node_property_data["Listing data<br/>[properties.ts]"]
  node_booking_card["Date booking<br/>[BookingCard.tsx]"]
  node_guest_page["Guest bookings<br/>[page.tsx]"]
  node_guest_view["Booking controls<br/>[GuestBookings.tsx]"]
  node_admin["Owner dashboard<br/>[page.tsx]"]
  node_wallet_program["Wallet program client"]
  node_booking_api["Booking API client<br/>[useBookingAPI.ts]"]
  node_guest_queries["Guest escrow queries"]
  node_admin_queries["Admin escrow queries"]
end

subgraph group_booking["Booking records"]
  node_booking_routes["Booking CRUD<br/>[route.ts]"]
  node_availability["Availability checks<br/>[route.ts]"]
  node_booked_dates["Booked dates<br/>[route.ts]"]
  node_guest_route["Wallet booking lookup<br/>[route.ts]"]
  node_supabase[("Supabase database<br/>[initSupabase.ts]")]
end

subgraph group_chain["Solana escrow"]
  node_escrow_program["Escrow instructions<br/>[lib.rs]"]
  node_initialize["Create escrow<br/>[initialize.rs]"]
  node_release["Release payment<br/>[release_payment.rs]"]
  node_cancel["Cancel and refund<br/>[cancel_booking.rs]"]
  node_escrow_state["Escrow state<br/>[state.rs]"]
end

subgraph group_marketing["Marketing generator"]
  node_marketing_page["Marketing tool<br/>[page.tsx]"]
  node_marketing_route["Copy generation API<br/>[route.ts]"]
  node_llm["Language model client<br/>[llm.ts]"]
  node_copy_schema["Output validation<br/>[schema.ts]"]
end

node_guest(("Guest"))
node_owner(("Property owner"))
node_solana(("Solana network"))
node_model_service(("LLM provider"))

node_guest -->|"browses"| node_listings
node_listings -->|"opens listing"| node_property
node_property -->|"uses listings"| node_property_data
node_property -->|"offers booking"| node_booking_card
node_booking_card -->|"checks dates"| node_availability
node_booking_card -->|"loads dates"| node_booked_dates
node_booking_card -->|"calls"| node_booking_api
node_booking_card -->|"creates escrow"| node_wallet_program
node_booking_api -->|"sends booking requests"| node_booking_routes
node_availability -->|"checks conflicts"| node_supabase
node_booked_dates -->|"reads reservations"| node_supabase
node_booking_routes -->|"stores bookings"| node_supabase
node_guest_page -->|"shows bookings"| node_guest_view
node_guest_view -->|"uses"| node_guest_queries
node_guest_queries -->|"reads and cancels escrow"| node_wallet_program
node_guest_queries -->|"fetches booking signatures"| node_guest_route
node_guest_route -->|"looks up bookings"| node_supabase
node_admin -->|"manages escrows"| node_admin_queries
node_admin_queries -->|"reads and releases"| node_wallet_program
node_wallet_program -->|"submits transactions"| node_solana
node_solana -->|"executes instructions"| node_escrow_program
node_escrow_program -->|"dispatches"| node_initialize
node_escrow_program -->|"dispatches"| node_release
node_escrow_program -->|"dispatches"| node_cancel
node_initialize -->|"initializes"| node_escrow_state
node_release -->|"updates"| node_escrow_state
node_cancel -.->|"uses"| node_escrow_state
node_owner -->|"manages rentals"| node_admin
node_guest -->|"requests copy"| node_marketing_page
node_marketing_page -->|"submits brief"| node_marketing_route
node_marketing_route -->|"generates copy"| node_llm
node_marketing_route -->|"validates output"| node_copy_schema
node_llm -->|"calls provider"| node_model_service

click node_listings "https://github.com/christiancl92/rental_escrow/blob/main/app/app/page.tsx"
click node_property "https://github.com/christiancl92/rental_escrow/blob/main/app/app/properties/%5Bid%5D/page.tsx"
click node_property_data "https://github.com/christiancl92/rental_escrow/blob/main/app/lib/properties.ts"
click node_booking_card "https://github.com/christiancl92/rental_escrow/blob/main/app/components/BookingCard.tsx"
click node_guest_page "https://github.com/christiancl92/rental_escrow/blob/main/app/app/bookings/page.tsx"
click node_guest_view "https://github.com/christiancl92/rental_escrow/blob/main/app/components/GuestBookings.tsx"
click node_admin "https://github.com/christiancl92/rental_escrow/blob/main/app/app/admin/page.tsx"
click node_wallet_program "https://github.com/christiancl92/rental_escrow/blob/main/app/hooks/useRentalProgram.ts"
click node_booking_api "https://github.com/christiancl92/rental_escrow/blob/main/app/hooks/useBookingAPI.ts"
click node_booking_routes "https://github.com/christiancl92/rental_escrow/blob/main/app/app/api/bookings/route.ts"
click node_availability "https://github.com/christiancl92/rental_escrow/blob/main/app/app/api/bookings/availability/route.ts"
click node_booked_dates "https://github.com/christiancl92/rental_escrow/blob/main/app/app/api/bookings/booked-dates/route.ts"
click node_guest_route "https://github.com/christiancl92/rental_escrow/blob/main/app/app/api/bookings/guest/route.ts"
click node_supabase "https://github.com/christiancl92/rental_escrow/blob/main/app/lib/supabase/initSupabase.ts"
click node_guest_queries "https://github.com/christiancl92/rental_escrow/blob/main/app/hooks/useGuestBookings.ts"
click node_admin_queries "https://github.com/christiancl92/rental_escrow/blob/main/app/hooks/useEscrowQueries.ts"
click node_escrow_program "https://github.com/christiancl92/rental_escrow/blob/main/programs/rental_escrow/src/lib.rs"
click node_initialize "https://github.com/christiancl92/rental_escrow/blob/main/programs/rental_escrow/src/instructions/initialize.rs"
click node_release "https://github.com/christiancl92/rental_escrow/blob/main/programs/rental_escrow/src/instructions/release_payment.rs"
click node_cancel "https://github.com/christiancl92/rental_escrow/blob/main/programs/rental_escrow/src/instructions/cancel_booking.rs"
click node_escrow_state "https://github.com/christiancl92/rental_escrow/blob/main/programs/rental_escrow/src/state.rs"
click node_marketing_page "https://github.com/christiancl92/rental_escrow/blob/main/app/app/tools/marketing/page.tsx"
click node_marketing_route "https://github.com/christiancl92/rental_escrow/blob/main/app/app/api/marketing/generate/route.ts"
click node_llm "https://github.com/christiancl92/rental_escrow/blob/main/app/lib/llm.ts"
click node_copy_schema "https://github.com/christiancl92/rental_escrow/blob/main/app/lib/marketing/schema.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_listings,node_property,node_property_data,node_booking_card,node_guest_page,node_guest_view,node_admin,node_wallet_program,node_booking_api,node_guest_queries,node_admin_queries toneBlue
class node_booking_routes,node_availability,node_booked_dates,node_guest_route,node_supabase toneAmber
class node_escrow_program,node_initialize,node_release,node_cancel,node_escrow_state toneMint
class node_marketing_page,node_marketing_route,node_llm,node_copy_schema toneRose
class node_guest,node_owner,node_solana,node_model_service toneIndigo
```

## Components

### Rental web app

- [Property listings](https://github.com/christiancl92/rental_escrow/blob/main/app/app/page.tsx): `app/app/page.tsx`
- [Property details](https://github.com/christiancl92/rental_escrow/blob/main/app/app/properties/%5Bid%5D/page.tsx): `app/app/properties/[id]/page.tsx`
- [Listing data](https://github.com/christiancl92/rental_escrow/blob/main/app/lib/properties.ts): `app/lib/properties.ts`
- [Date booking](https://github.com/christiancl92/rental_escrow/blob/main/app/components/BookingCard.tsx): `app/components/BookingCard.tsx`
- [Guest bookings](https://github.com/christiancl92/rental_escrow/blob/main/app/app/bookings/page.tsx): `app/app/bookings/page.tsx`
- [Booking controls](https://github.com/christiancl92/rental_escrow/blob/main/app/components/GuestBookings.tsx): `app/components/GuestBookings.tsx`
- [Owner dashboard](https://github.com/christiancl92/rental_escrow/blob/main/app/app/admin/page.tsx): `app/app/admin/page.tsx`
- [Wallet program client](https://github.com/christiancl92/rental_escrow/blob/main/app/hooks/useRentalProgram.ts): `app/hooks/useRentalProgram.ts`
- [Booking API client](https://github.com/christiancl92/rental_escrow/blob/main/app/hooks/useBookingAPI.ts): `app/hooks/useBookingAPI.ts`
- [Guest escrow queries](https://github.com/christiancl92/rental_escrow/blob/main/app/hooks/useGuestBookings.ts): `app/hooks/useGuestBookings.ts`
- [Admin escrow queries](https://github.com/christiancl92/rental_escrow/blob/main/app/hooks/useEscrowQueries.ts): `app/hooks/useEscrowQueries.ts`

### Booking records

- [Booking CRUD](https://github.com/christiancl92/rental_escrow/blob/main/app/app/api/bookings/route.ts): `app/app/api/bookings/route.ts`
- [Availability checks](https://github.com/christiancl92/rental_escrow/blob/main/app/app/api/bookings/availability/route.ts): `app/app/api/bookings/availability/route.ts`
- [Booked dates](https://github.com/christiancl92/rental_escrow/blob/main/app/app/api/bookings/booked-dates/route.ts): `app/app/api/bookings/booked-dates/route.ts`
- [Wallet booking lookup](https://github.com/christiancl92/rental_escrow/blob/main/app/app/api/bookings/guest/route.ts): `app/app/api/bookings/guest/route.ts`
- [Supabase database](https://github.com/christiancl92/rental_escrow/blob/main/app/lib/supabase/initSupabase.ts): `app/lib/supabase/initSupabase.ts`

### Solana escrow

- [Escrow instructions](https://github.com/christiancl92/rental_escrow/blob/main/programs/rental_escrow/src/lib.rs): `programs/rental_escrow/src/lib.rs`
- [Create escrow](https://github.com/christiancl92/rental_escrow/blob/main/programs/rental_escrow/src/instructions/initialize.rs): `programs/rental_escrow/src/instructions/initialize.rs`
- [Release payment](https://github.com/christiancl92/rental_escrow/blob/main/programs/rental_escrow/src/instructions/release_payment.rs): `programs/rental_escrow/src/instructions/release_payment.rs`
- [Cancel and refund](https://github.com/christiancl92/rental_escrow/blob/main/programs/rental_escrow/src/instructions/cancel_booking.rs): `programs/rental_escrow/src/instructions/cancel_booking.rs`
- [Escrow state](https://github.com/christiancl92/rental_escrow/blob/main/programs/rental_escrow/src/state.rs): `programs/rental_escrow/src/state.rs`

### Marketing generator

- [Marketing tool](https://github.com/christiancl92/rental_escrow/blob/main/app/app/tools/marketing/page.tsx): `app/app/tools/marketing/page.tsx`
- [Copy generation API](https://github.com/christiancl92/rental_escrow/blob/main/app/app/api/marketing/generate/route.ts): `app/app/api/marketing/generate/route.ts`
- [Language model client](https://github.com/christiancl92/rental_escrow/blob/main/app/lib/llm.ts): `app/lib/llm.ts`
- [Output validation](https://github.com/christiancl92/rental_escrow/blob/main/app/lib/marketing/schema.ts): `app/lib/marketing/schema.ts`

### Other components

- **Guest**
- **Property owner**
- **Solana network**
- **LLM provider**

## Connections

- Guest → Property listings: browses
- Property listings → Property details: opens listing
- Property details → Listing data: uses listings
- Property details → Date booking: offers booking
- Date booking → Availability checks: checks dates (evidence: `app/components/BookingCard.tsx`)
- Date booking → Booked dates: loads dates
- Date booking → Booking API client: calls (evidence: `app/components/BookingCard.tsx`)
- Date booking → Wallet program client: creates escrow (evidence: `app/components/BookingCard.tsx`)
- Booking API client → Booking CRUD: sends booking requests
- Availability checks → Supabase database: checks conflicts
- Booked dates → Supabase database: reads reservations
- Booking CRUD → Supabase database: stores bookings
- Guest bookings → Booking controls: shows bookings
- Booking controls → Guest escrow queries: uses
- Guest escrow queries → Wallet program client: reads and cancels escrow (evidence: `app/hooks/useGuestBookings.ts`)
- Guest escrow queries → Wallet booking lookup: fetches booking signatures (evidence: `app/hooks/useGuestBookings.ts`)
- Wallet booking lookup → Supabase database: looks up bookings
- Owner dashboard → Admin escrow queries: manages escrows
- Admin escrow queries → Wallet program client: reads and releases (evidence: `app/hooks/useEscrowQueries.ts`)
- Wallet program client → Solana network: submits transactions (evidence: `app/hooks/useRentalProgram.ts`)
- Solana network → Escrow instructions: executes instructions
- Escrow instructions → Create escrow: dispatches (evidence: `programs/rental_escrow/src/lib.rs`)
- Escrow instructions → Release payment: dispatches (evidence: `programs/rental_escrow/src/lib.rs`)
- Escrow instructions → Cancel and refund: dispatches (evidence: `programs/rental_escrow/src/lib.rs`)
- Create escrow → Escrow state: initializes (evidence: `programs/rental_escrow/src/instructions/initialize.rs`)
- Release payment → Escrow state: updates (evidence: `programs/rental_escrow/src/instructions/release_payment.rs`)
- Cancel and refund → Escrow state: uses
- Property owner → Owner dashboard: manages rentals
- Guest → Marketing tool: requests copy
- Marketing tool → Copy generation API: submits brief
- Copy generation API → Language model client: generates copy
- Copy generation API → Output validation: validates output
- Language model client → LLM provider: calls provider
