# prabhatthakuryt/car-rental-system architecture

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

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

## Overview

1. **Project shape**
   - This is a **single-module Java console application**.
   - The repository is very small: the entire application appears to live in `src/Main.java`, with no separate packages, database layer, or service modules visible in the tree.

2. **Primary runtime boundary**
   - The main architectural boundary is between the **interactive console UI** and the **in-memory rental domain logic**.
   - Users interact through standard input/output; there is no indication of a web server, GUI, or external API.

3. **Entry point and control loop**
   - `Main.java` is the likely application entry point.
   - The app is probably organized around a **menu-driven loop** that keeps prompting the user to rent a car, return a car, manage customers, manage cars, or view history.

4. **Core domain entities**
   - The README identifies the main domain concepts:
     - **Car**
     - **Customer**
     - **Rental / Rental History**
     - **Brand / Model / Pricing details**
   - These are the core objects the application manages and updates during the session.

5. **Car management subsystem**
   - One subsystem handles the **catalog of cars**: adding cars, storing their metadata, and tracking whether each car is available or rented.
   - This is the inventory side of the system and is central to both rent and return flows.

6. **Customer management subsystem**
   - Another subsystem handles **customer records**.
   - The app supports adding new customers and using those records when creating rentals, so customer data is part of the transaction context rather than just a standalone list.

7. **Rental transaction flow**
   - The key business flow is:
     - select customer
     - select available car
     - create rental
     - mark car unavailable
   - The reverse flow on return likely:
     - identify active rental
     - close rental
     - mark car available again
   - This flow connects the customer and car subsystems through a rental record.

8. **Rental history as an audit trail**
   - The README explicitly mentions **rental history**.
   - Architecturally, this is the system’s record of completed or active rentals and provides traceability for what was rented, by whom, and for how long.

9. **State management**
   - Because there is no sign of persistence infrastructure, the app is most likely **stateful in memory only** during execution.
   - That means cars, customers, and rentals are probably stored in collections inside the Java process and reset when the program exits.

10. **Data flow between subsystems**
   - The main data flow is user input → menu action → domain update → console output.
   - Rentals are the coupling point: they depend on both car availability and customer identity, and they update inventory plus history together.

11. **Technology and infrastructure**
   - The only material technology visible is **Java** and the **console/terminal runtime**.
   - There is no evidence of frameworks, databases, networking, or external services in this repository snapshot.

12. **What an architecture diagram should show**
   - A good diagram would have:
     - a **Console UI / Main loop** at the top,
     - connected to **Car Management**, **Customer Management**, and **Rental Management/History**,
     - with shared **in-memory data collections** underneath.
   - The rental flow should be shown crossing between car and customer data, because that is the main business interaction in the system.

13. **Current architectural level**
   - This repo is best described as a **learning-oriented monolith**: small, self-contained, and likely implemented with direct procedural or object-oriented logic in one file.
   - Its simplicity is a feature here—it demonstrates the core rental workflow without persistence or distributed boundaries.

Main entry points: [`src/Main.java`](https://github.com/prabhatthakuryt/car-rental-system/blob/master/src/Main.java) (Main loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Console Runtime"]
  node_main["Main loop<br/>entrypoint<br/>[Main.java]"]
  node_io(("Console I/O<br/>terminal"))
end

subgraph group_domain["Rental Domain"]
  node_car_mgmt["Car management<br/>catalog"]
  node_customer_mgmt["Customer management<br/>registry"]
  node_rental_mgmt["Rental management<br/>workflow"]
  node_history["Rental history<br/>audit trail"]
  node_car_entity(("Car<br/>entity"))
  node_customer_entity(("Customer<br/>entity"))
  node_rental_entity["Rental<br/>entity"]
  node_pricing{{"Pricing<br/>rules"}}
end

subgraph group_state["In-Memory State"]
  node_cars_store[("Cars list<br/>collection")]
  node_customers_store[("Customers list<br/>collection")]
  node_rentals_store[("Rentals list<br/>collection")]
end

node_main -->|"prompt / print"| node_io
node_main -->|"routes"| node_car_mgmt
node_main -->|"routes"| node_customer_mgmt
node_main -->|"routes"| node_rental_mgmt
node_main -->|"view history"| node_history
node_car_mgmt -->|"reads / updates"| node_cars_store
node_customer_mgmt -->|"reads / updates"| node_customers_store
node_rental_mgmt -->|"creates / closes"| node_rentals_store
node_rental_mgmt -->|"checks availability"| node_cars_store
node_rental_mgmt -->|"selects customer"| node_customers_store
node_rental_mgmt -->|"produces"| node_rental_entity
node_car_mgmt -->|"manages"| node_car_entity
node_customer_mgmt -->|"manages"| node_customer_entity
node_rental_mgmt -->|"uses"| node_pricing
node_history -->|"reads"| node_rentals_store
node_rental_entity -->|"links"| node_car_entity
node_rental_entity -->|"links"| node_customer_entity

click node_main "https://github.com/prabhatthakuryt/car-rental-system/blob/master/src/Main.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_main,node_io toneBlue
class node_car_mgmt,node_customer_mgmt,node_rental_mgmt,node_history,node_car_entity,node_customer_entity,node_rental_entity,node_pricing toneAmber
class node_cars_store,node_customers_store,node_rentals_store toneMint
```

## Components

### Console Runtime

Interactive terminal entrypoint and menu loop

- [Main loop](https://github.com/prabhatthakuryt/car-rental-system/blob/master/src/Main.java): entrypoint · Console entrypoint and menu-driven control flow · `src/Main.java`
- **Console I/O**: terminal · Standard input and output interaction

### Rental Domain

Core business logic for cars, customers, and rentals

- **Car management**: catalog · Adds and updates cars and availability
- **Customer management**: registry · Stores and selects customer records
- **Rental management**: workflow · Coordinates renting and returning cars
- **Rental history**: audit trail · Records active and completed rentals
- **Car**: entity · Vehicle details and availability state
- **Customer**: entity · Customer identity used in rentals
- **Rental**: entity · Rental record linking customer and car
- **Pricing**: rules · Rental rate and charge details

### In-Memory State

Process-local collections that hold application data

- **Cars list**: collection · In-memory collection of cars
- **Customers list**: collection · In-memory collection of customers
- **Rentals list**: collection · In-memory collection of rental records

## Connections

- Main loop → Console I/O: prompt / print · Reads user commands and renders menus and results
- Main loop → Car management: routes · Dispatches car-related menu actions
- Main loop → Customer management: routes · Dispatches customer-related menu actions
- Main loop → Rental management: routes · Dispatches rent and return actions
- Main loop → Rental history: view history · Shows rental history from the menu
- Car management → Cars list: reads / updates · Manages the car inventory collection
- Customer management → Customers list: reads / updates · Manages the customer collection
- Rental management → Rentals list: creates / closes · Creates active rentals and marks them returned
- Rental management → Cars list: checks availability · Finds available cars and updates status
- Rental management → Customers list: selects customer · Uses customer identity for each rental
- Rental management → Rental: produces · Creates a rental record for each transaction
- Car management → Car: manages · Works with car details and status
- Customer management → Customer: manages · Works with customer records
- Rental management → Pricing: uses · Applies rental pricing details when needed
- Rental history → Rentals list: reads · Displays stored rental records as history
- Rental → Car: links · Associates each rental with a car
- Rental → Customer: links · Associates each rental with a customer
