# ahmedsheikh27/car-rental architecture

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

- Interactive diagram: https://gitdiagram.com/ahmedsheikh27/car-rental
- Repository: https://github.com/ahmedsheikh27/car-rental

## Overview

This is a small Next.js car-rental browsing and booking frontend. The user-facing flow loads car inventory, presents filtering and cards, and opens a booking form that fetches pickup locations and submits booking data to a GraphQL service; booking success is surfaced through shared context and a toast. Navigation, Clerk sign-in, and footer content are separate shell features. Relationships are limited to the provided excerpts, source-index references, and README; unsampled UI wiring is not assumed.

Main entry points: [`app/page.tsx`](https://github.com/ahmedsheikh27/car-rental/blob/master/app/page.tsx) (Home page), [`services/index.tsx`](https://github.com/ahmedsheikh27/car-rental/blob/master/services/index.tsx) (GraphQL services), [`components/CarBooking/Form.tsx`](https://github.com/ahmedsheikh27/car-rental/blob/master/components/CarBooking/Form.tsx) (Booking form), [`components/Home/CarLists.tsx`](https://github.com/ahmedsheikh27/car-rental/blob/master/components/Home/CarLists.tsx) (Car list)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browse["Car browsing"]
  node_home["Home page<br/>[page.tsx]"]
  node_hero["Hero<br/>[Hero.tsx]"]
  node_search["Location search<br/>[SearchInput.tsx]"]
  node_filters["Car filters<br/>[CarsFilter.tsx]"]
  node_carlist["Car list<br/>[CarLists.tsx]"]
  node_carcard["Car card<br/>[CarCard.tsx]"]
  node_loader["Car loader<br/>[CarLoader.tsx]"]
end

subgraph group_booking["Booking"]
  node_bookingmodal["Booking dialog<br/>[BookingModel.tsx]"]
  node_bookingform["Booking form<br/>[Form.tsx]"]
  node_bookingcontext["Booking context<br/>[BookingContext.tsx]"]
  node_toast["Success toast<br/>[ToastMsg.tsx]"]
end

subgraph group_shell["Application shell"]
  node_layout["App layout<br/>[layout.tsx]"]
  node_navbar["Navigation<br/>[Navbar.tsx]"]
  node_footer["Footer<br/>[Footer.tsx]"]
end

subgraph group_integration["Service integration"]
  node_services["GraphQL services<br/>[index.tsx]"]
  node_graphql[("GraphQL backend")]
end

node_renter(("Renter"))
node_clerk["Clerk identity"]

node_renter -->|"opens"| node_home
node_home -->|"loads inventory"| node_services
node_home -->|"shows while loading"| node_loader
node_home -->|"renders"| node_hero
node_home -->|"renders"| node_search
node_home -->|"renders"| node_filters
node_home -->|"renders"| node_carlist
node_home -->|"provides state"| node_bookingcontext
node_home -->|"renders"| node_toast
node_carlist -->|"renders"| node_carcard
node_carlist -->|"renders"| node_bookingmodal
node_bookingmodal -->|"renders"| node_carcard
node_bookingmodal -->|"renders"| node_bookingform
node_bookingform -->|"fetches locations"| node_services
node_bookingform -->|"submits booking"| node_services
node_bookingform -->|"sets success state"| node_bookingcontext
node_home -->|"receives inventory"| node_services
node_services -->|"queries and mutates"| node_graphql
node_layout -->|"renders"| node_navbar
node_layout -->|"renders"| node_footer
node_navbar -->|"uses identity UI"| node_clerk

click node_home "https://github.com/ahmedsheikh27/car-rental/blob/master/app/page.tsx"
click node_hero "https://github.com/ahmedsheikh27/car-rental/blob/master/components/Home/Hero.tsx"
click node_search "https://github.com/ahmedsheikh27/car-rental/blob/master/components/Home/SearchInput.tsx"
click node_filters "https://github.com/ahmedsheikh27/car-rental/blob/master/components/Home/CarsFilter.tsx"
click node_carlist "https://github.com/ahmedsheikh27/car-rental/blob/master/components/Home/CarLists.tsx"
click node_carcard "https://github.com/ahmedsheikh27/car-rental/blob/master/components/Home/CarCard.tsx"
click node_bookingmodal "https://github.com/ahmedsheikh27/car-rental/blob/master/components/CarBooking/BookingModel.tsx"
click node_bookingform "https://github.com/ahmedsheikh27/car-rental/blob/master/components/CarBooking/Form.tsx"
click node_bookingcontext "https://github.com/ahmedsheikh27/car-rental/blob/master/context/BookingContext.tsx"
click node_toast "https://github.com/ahmedsheikh27/car-rental/blob/master/components/ToastMsg.tsx"
click node_loader "https://github.com/ahmedsheikh27/car-rental/blob/master/components/loader/CarLoader.tsx"
click node_services "https://github.com/ahmedsheikh27/car-rental/blob/master/services/index.tsx"
click node_layout "https://github.com/ahmedsheikh27/car-rental/blob/master/app/layout.tsx"
click node_navbar "https://github.com/ahmedsheikh27/car-rental/blob/master/components/Navbar.tsx"
click node_footer "https://github.com/ahmedsheikh27/car-rental/blob/master/components/footer/Footer.tsx"

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_hero,node_search,node_filters,node_carlist,node_carcard,node_loader toneBlue
class node_bookingmodal,node_bookingform,node_bookingcontext,node_toast toneAmber
class node_layout,node_navbar,node_footer toneMint
class node_services,node_graphql toneRose
class node_renter,node_clerk toneIndigo
```

## Components

### Car browsing

- [Home page](https://github.com/ahmedsheikh27/car-rental/blob/master/app/page.tsx): `app/page.tsx`
- [Hero](https://github.com/ahmedsheikh27/car-rental/blob/master/components/Home/Hero.tsx): `components/Home/Hero.tsx`
- [Location search](https://github.com/ahmedsheikh27/car-rental/blob/master/components/Home/SearchInput.tsx): `components/Home/SearchInput.tsx`
- [Car filters](https://github.com/ahmedsheikh27/car-rental/blob/master/components/Home/CarsFilter.tsx): `components/Home/CarsFilter.tsx`
- [Car list](https://github.com/ahmedsheikh27/car-rental/blob/master/components/Home/CarLists.tsx): `components/Home/CarLists.tsx`
- [Car card](https://github.com/ahmedsheikh27/car-rental/blob/master/components/Home/CarCard.tsx): `components/Home/CarCard.tsx`
- [Car loader](https://github.com/ahmedsheikh27/car-rental/blob/master/components/loader/CarLoader.tsx): `components/loader/CarLoader.tsx`

### Booking

- [Booking dialog](https://github.com/ahmedsheikh27/car-rental/blob/master/components/CarBooking/BookingModel.tsx): `components/CarBooking/BookingModel.tsx`
- [Booking form](https://github.com/ahmedsheikh27/car-rental/blob/master/components/CarBooking/Form.tsx): `components/CarBooking/Form.tsx`
- [Booking context](https://github.com/ahmedsheikh27/car-rental/blob/master/context/BookingContext.tsx): `context/BookingContext.tsx`
- [Success toast](https://github.com/ahmedsheikh27/car-rental/blob/master/components/ToastMsg.tsx): `components/ToastMsg.tsx`

### Application shell

- [App layout](https://github.com/ahmedsheikh27/car-rental/blob/master/app/layout.tsx): `app/layout.tsx`
- [Navigation](https://github.com/ahmedsheikh27/car-rental/blob/master/components/Navbar.tsx): `components/Navbar.tsx`
- [Footer](https://github.com/ahmedsheikh27/car-rental/blob/master/components/footer/Footer.tsx): `components/footer/Footer.tsx`

### Service integration

- [GraphQL services](https://github.com/ahmedsheikh27/car-rental/blob/master/services/index.tsx): `services/index.tsx`
- **GraphQL backend**

### Other components

- **Renter**
- **Clerk identity**

## Connections

- Renter → Home page: opens (evidence: `README.md`)
- Home page → GraphQL services: loads inventory (evidence: `app/page.tsx`)
- Home page → Car loader: shows while loading (evidence: `app/page.tsx`)
- Home page → Hero: renders (evidence: `app/page.tsx`)
- Home page → Location search: renders (evidence: `app/page.tsx`)
- Home page → Car filters: renders (evidence: `app/page.tsx`)
- Home page → Car list: renders (evidence: `app/page.tsx`)
- Home page → Booking context: provides state (evidence: `app/page.tsx`)
- Home page → Success toast: renders (evidence: `app/page.tsx`)
- Car list → Car card: renders (evidence: `components/Home/CarLists.tsx`)
- Car list → Booking dialog: renders (evidence: `components/Home/CarLists.tsx`)
- Booking dialog → Car card: renders (evidence: `components/CarBooking/BookingModel.tsx`)
- Booking dialog → Booking form: renders (evidence: `components/CarBooking/BookingModel.tsx`)
- Booking form → GraphQL services: fetches locations (evidence: `components/CarBooking/Form.tsx`)
- Booking form → GraphQL services: submits booking (evidence: `components/CarBooking/Form.tsx`)
- Booking form → Booking context: sets success state (evidence: `components/CarBooking/Form.tsx`)
- Home page → GraphQL services: receives inventory (evidence: `services/index.tsx`)
- GraphQL services → GraphQL backend: queries and mutates (evidence: `services/index.tsx`)
- App layout → Navigation: renders (evidence: `app/layout.tsx`)
- App layout → Footer: renders (evidence: `app/layout.tsx`)
- Navigation → Clerk identity: uses identity UI (evidence: `components/Navbar.tsx`)
