# codeshrabon/car-rental-system-api architecture

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

- Interactive diagram: https://gitdiagram.com/codeshrabon/car-rental-system-api
- Repository: https://github.com/codeshrabon/car-rental-system-api

## Overview

This Spring Boot car-rental API manages cars, customers, and rental records, with both HTTP controllers and a command-line admin workflow. In the API path, clients invoke controllers, which delegate to services; services perform domain work and use Spring Data repositories for persistence. Rental creation resolves a car and customer, calculates a date-based price, and saves the booking. The CLI provides a separate workflow for adding records and viewing rentals. Evidence is limited to the supplied excerpts and source index; controller/service wiring for cars and rentals is supported, while persistence configuration and several domain behaviors are not inspected.

Main entry points: [`car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/RentalService.java`](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/RentalService.java) (Rental operations), [`car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Rental.java`](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Rental.java) (Rental bookings), [`car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalCLI.java`](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalCLI.java) (Admin CLI), [`car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/CarService.java`](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/CarService.java) (Car operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_carapi["Car API<br/>[CarController.java]"]
  node_customerapi["Customer API"]
  node_rentalapi["Rental API"]
  node_rentalcli["Admin CLI<br/>[RentalCLI.java]"]
end

subgraph group_domain["Rental domain"]
  node_cars["Car records<br/>[Car.java]"]
  node_customers["Customer records<br/>[Customer.java]"]
  node_rentals["Rental bookings<br/>[Rental.java]"]
  node_rentalstatus["Rental status<br/>[RentalStatus.java]"]
  node_paymentstatus["Payment status<br/>[PaymentStatus.java]"]
  node_travel["Travel model<br/>[Travel.java]"]
end

subgraph group_logic["Application services"]
  node_carservice["Car operations<br/>[CarService.java]"]
  node_customerservice["Customer operations"]
  node_rentalservice["Rental operations<br/>[RentalService.java]"]
end

subgraph group_persistence["Persistence"]
  node_carrepo[("Car repository<br/>[CarRepository.java]")]
  node_customerrepo[("Customer repository")]
  node_rentalrepo[("Rental repository")]
end

node_admin(("Admin client"))
node_cliuser(("CLI operator"))

node_admin -->|"manages cars"| node_carapi
node_admin -->|"manages customers"| node_customerapi
node_admin -.->|"manages rentals"| node_rentalapi
node_cliuser -->|"uses menu"| node_rentalcli
node_carapi -->|"delegates"| node_carservice
node_customerapi -->|"delegates"| node_customerservice
node_rentalapi -->|"delegates"| node_rentalservice
node_rentalcli -->|"adds cars"| node_carservice
node_rentalcli -->|"adds customers"| node_customerservice
node_rentalcli -->|"creates and lists"| node_rentalservice
node_carservice -->|"reads/writes"| node_carrepo
node_customerservice -->|"reads/writes"| node_customerrepo
node_rentalservice -->|"loads car"| node_carrepo
node_rentalservice -->|"loads customer"| node_customerrepo
node_rentalservice -->|"reads/writes"| node_rentalrepo
node_rentals -->|"references"| node_cars
node_rentals -->|"references"| node_customers
node_rentals -->|"uses status"| node_rentalstatus
node_rentals -->|"uses status"| node_paymentstatus

click node_carapi "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/CarController.java"
click node_customerapi "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/CustomerController.java"
click node_rentalapi "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalController.java"
click node_rentalcli "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalCLI.java"
click node_cars "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Car.java"
click node_customers "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Customer.java"
click node_rentals "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Rental.java"
click node_rentalstatus "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/RentalStatus.java"
click node_paymentstatus "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/PaymentStatus.java"
click node_travel "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Travel.java"
click node_carservice "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/CarService.java"
click node_customerservice "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/CustomerService.java"
click node_rentalservice "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/RentalService.java"
click node_carrepo "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/repository/CarRepository.java"
click node_customerrepo "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/repository/CustomerRepository.java"
click node_rentalrepo "https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/repository/RentalRepository.java"

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_carapi,node_customerapi,node_rentalapi,node_rentalcli,node_admin toneBlue
class node_cars,node_customers,node_rentals,node_rentalstatus,node_paymentstatus,node_travel toneAmber
class node_carservice,node_customerservice,node_rentalservice toneMint
class node_carrepo,node_customerrepo,node_rentalrepo toneRose
class node_cliuser toneIndigo
```

## Components

### User interfaces

- [Car API](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/CarController.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/CarController.java`
- [Customer API](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/CustomerController.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/CustomerController.java`
- [Rental API](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalController.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalController.java`
- [Admin CLI](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalCLI.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalCLI.java`

### Rental domain

- [Car records](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Car.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Car.java`
- [Customer records](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Customer.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Customer.java`
- [Rental bookings](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Rental.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Rental.java`
- [Rental status](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/RentalStatus.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/RentalStatus.java`
- [Payment status](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/PaymentStatus.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/PaymentStatus.java`
- [Travel model](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Travel.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Travel.java`

### Application services

- [Car operations](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/CarService.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/CarService.java`
- [Customer operations](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/CustomerService.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/CustomerService.java`
- [Rental operations](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/RentalService.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/RentalService.java`

### Persistence

- [Car repository](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/repository/CarRepository.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/repository/CarRepository.java`
- [Customer repository](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/repository/CustomerRepository.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/repository/CustomerRepository.java`
- [Rental repository](https://github.com/codeshrabon/car-rental-system-api/blob/main/car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/repository/RentalRepository.java): `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/repository/RentalRepository.java`

### Other components

- **Admin client**
- **CLI operator**

## Connections

- Admin client → Car API: manages cars
- Admin client → Customer API: manages customers (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/CustomerController.java`)
- Admin client → Rental API: manages rentals
- CLI operator → Admin CLI: uses menu (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalCLI.java`)
- Car API → Car operations: delegates (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/CarController.java`)
- Customer API → Customer operations: delegates (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/CustomerController.java`)
- Rental API → Rental operations: delegates (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalController.java`)
- Admin CLI → Car operations: adds cars (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalCLI.java`)
- Admin CLI → Customer operations: adds customers (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalCLI.java`)
- Admin CLI → Rental operations: creates and lists (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/controller/RentalCLI.java`)
- Car operations → Car repository: reads/writes (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/CarService.java`)
- Customer operations → Customer repository: reads/writes (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/CustomerService.java`)
- Rental operations → Car repository: loads car (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/RentalService.java`)
- Rental operations → Customer repository: loads customer (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/RentalService.java`)
- Rental operations → Rental repository: reads/writes (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/service/RentalService.java`)
- Rental bookings → Car records: references (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Rental.java`)
- Rental bookings → Customer records: references (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Rental.java`)
- Rental bookings → Rental status: uses status (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Rental.java`)
- Rental bookings → Payment status: uses status (evidence: `car-rental-system-API/src/main/java/com/car_rental_system/car_rental_system_API/model/Rental.java`)
