# sanimanqezu/vehicle-rental-system architecture

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

- Interactive diagram: https://gitdiagram.com/sanimanqezu/vehicle-rental-system
- Repository: https://github.com/sanimanqezu/vehicle-rental-system

## Overview

Vehicle Rental System is a Next.js client backed by Spring Cloud microservices for vehicle inventory, reservations, and user accounts. The main workflow is sign-in through NextAuth and the OAuth2 authorization server, followed by bearer-token API requests through the gateway to a domain service, which applies business logic and accesses persistence. The frontend also provides domain management and dashboard views; the README documents service discovery, centralized configuration, and role-based authorization. Backend service internals are represented where sampled; cross-service and dashboard wiring is limited to documented behavior.

Main entry points: [`frontend/app/layout.tsx`](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/layout.tsx) (Next.js app), [`backend/infrastructure/gatewayservice/src/main/java/za/co/protogen/gatewayservice/GatewayserviceApplication.java`](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/infrastructure/gatewayservice/src/main/java/za/co/protogen/gatewayservice/GatewayserviceApplication.java) (API gateway), [`backend/services/reservations-service/src/main/java/za/co/protogen/controller/ReservationsApiController.java`](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/reservations-service/src/main/java/za/co/protogen/controller/ReservationsApiController.java) (Reservations API), [`backend/services/users-service/src/main/java/za/co/protogen/controller/UsersApiController.java`](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/users-service/src/main/java/za/co/protogen/controller/UsersApiController.java) (Users API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Frontend"]
  node_webapp["Next.js app<br/>[layout.tsx]"]
  node_authpages["Sign-in / registration<br/>[page.tsx]"]
  node_nextauth["NextAuth<br/>[route.ts]"]
  node_frontendapi["API client<br/>[api.ts]"]
  node_carui["Car management<br/>[page.tsx]"]
  node_reservationui["Reservation management<br/>[page.tsx]"]
  node_userui["User management<br/>[page.tsx]"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
end

subgraph group_platform["Platform services"]
  node_authserver["OAuth2 server"]
  node_gateway["API gateway"]
  node_registry["Eureka registry"]
  node_configserver["Config server"]
end

subgraph group_cars["Cars domain"]
  node_carcontroller["Cars API"]
  node_carservice["Cars logic"]
  node_carrepo["Car repository<br/>[CarRepository.java]"]
end

subgraph group_reservations["Reservations domain"]
  node_reservationcontroller["Reservations API"]
  node_reservationservice["Reservation logic"]
  node_reservationrepo["Reservation repository"]
end

subgraph group_users["Users domain"]
  node_usercontroller["Users API"]
  node_userservice["User logic"]
  node_userrepo["User repository"]
end

node_renter(("Renter"))
node_databases[("Service databases")]

node_renter -->|"uses"| node_webapp
node_webapp -->|"opens"| node_authpages
node_authpages -->|"signs in"| node_nextauth
node_nextauth -->|"requests token"| node_authserver
node_authpages -->|"registers"| node_webapp
node_webapp -->|"manages cars"| node_carui
node_webapp -->|"manages bookings"| node_reservationui
node_webapp -->|"manages users"| node_userui
node_webapp -->|"views metrics"| node_dashboard
node_carui -->|"API calls"| node_frontendapi
node_reservationui -->|"API calls"| node_frontendapi
node_userui -->|"API calls"| node_frontendapi
node_dashboard -->|"API calls"| node_frontendapi
node_frontendapi -->|"bearer requests"| node_gateway
node_gateway -->|"routes"| node_carcontroller
node_gateway -->|"routes"| node_reservationcontroller
node_gateway -->|"routes"| node_usercontroller
node_carcontroller -->|"invokes"| node_carservice
node_carservice -->|"queries / writes"| node_carrepo
node_carrepo -->|"persists"| node_databases
node_reservationcontroller -->|"invokes"| node_reservationservice
node_reservationservice -->|"queries / writes"| node_reservationrepo
node_reservationrepo -->|"persists"| node_databases
node_usercontroller -->|"invokes"| node_userservice
node_userservice -->|"queries / writes"| node_userrepo
node_userrepo -->|"persists"| node_databases
node_carservice -->|"validates JWT"| node_authserver
node_reservationcontroller -->|"validates JWT"| node_authserver
node_usercontroller -->|"validates JWT"| node_authserver
node_gateway -->|"discovers services"| node_registry
node_carcontroller -->|"registers"| node_registry
node_reservationcontroller -->|"registers"| node_registry
node_usercontroller -->|"registers"| node_registry
node_gateway -->|"loads config"| node_configserver
node_carcontroller -->|"loads config"| node_configserver
node_reservationcontroller -->|"loads config"| node_configserver
node_usercontroller -->|"loads config"| node_configserver

click node_webapp "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/layout.tsx"
click node_authpages "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/(auth)/login/page.tsx"
click node_nextauth "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/api/auth/%5B...nextauth%5D/route.ts"
click node_frontendapi "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/lib/api.ts"
click node_carui "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/(dashboard)/cars/page.tsx"
click node_reservationui "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/(dashboard)/reservations/page.tsx"
click node_userui "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/(dashboard)/users/page.tsx"
click node_dashboard "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/(dashboard)/dashboard/page.tsx"
click node_authserver "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/infrastructure/AuthorizationServerConfig/src/main/java/za/co/protogen/AuthorizationServerConfig/AuthorizationServerConfigApplication.java"
click node_gateway "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/infrastructure/gatewayservice/src/main/java/za/co/protogen/gatewayservice/GatewayserviceApplication.java"
click node_registry "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/infrastructure/eurekaserver/src/main/java/za/co/protogen/eurekaserver/EurekaserverApplication.java"
click node_configserver "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/infrastructure/configserver/src/main/java/za/co/protogen/configserver/ConfigserverApplication.java"
click node_carcontroller "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/cars-service/src/main/java/za/co/protogen/controller/CarsApiController.java"
click node_carservice "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/cars-service/src/main/java/za/co/protogen/core/impl/CarsServiceImpl.java"
click node_carrepo "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/cars-service/src/main/java/za/co/protogen/persistance/repository/CarRepository.java"
click node_reservationcontroller "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/reservations-service/src/main/java/za/co/protogen/controller/ReservationsApiController.java"
click node_reservationservice "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/reservations-service/src/main/java/za/co/protogen/core/impl/ReservationServiceImpl.java"
click node_reservationrepo "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/reservations-service/src/main/java/za/co/protogen/persistance/repository/ReservationRepository.java"
click node_usercontroller "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/users-service/src/main/java/za/co/protogen/controller/UsersApiController.java"
click node_userservice "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/users-service/src/main/java/za/co/protogen/core/impl/UserServiceImpl.java"
click node_userrepo "https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/users-service/src/main/java/za/co/protogen/persistance/repository/UserRepository.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_webapp,node_authpages,node_nextauth,node_frontendapi,node_carui,node_reservationui,node_userui,node_dashboard toneBlue
class node_authserver,node_gateway,node_registry,node_configserver,node_databases toneAmber
class node_carcontroller,node_carservice,node_carrepo toneMint
class node_reservationcontroller,node_reservationservice,node_reservationrepo toneRose
class node_usercontroller,node_userservice,node_userrepo,node_renter toneIndigo
```

## Components

### Frontend

- [Next.js app](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/layout.tsx): `frontend/app/layout.tsx`
- [Sign-in / registration](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/(auth)/login/page.tsx): `frontend/app/(auth)/login/page.tsx`
- [NextAuth](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/api/auth/%5B...nextauth%5D/route.ts): `frontend/app/api/auth/[...nextauth]/route.ts`
- [API client](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/lib/api.ts): `frontend/lib/api.ts`
- [Car management](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/(dashboard)/cars/page.tsx): `frontend/app/(dashboard)/cars/page.tsx`
- [Reservation management](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/(dashboard)/reservations/page.tsx): `frontend/app/(dashboard)/reservations/page.tsx`
- [User management](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/(dashboard)/users/page.tsx): `frontend/app/(dashboard)/users/page.tsx`
- [Dashboard](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/frontend/app/(dashboard)/dashboard/page.tsx): `frontend/app/(dashboard)/dashboard/page.tsx`

### Platform services

- [OAuth2 server](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/infrastructure/AuthorizationServerConfig/src/main/java/za/co/protogen/AuthorizationServerConfig/AuthorizationServerConfigApplication.java): `backend/infrastructure/AuthorizationServerConfig/src/main/java/za/co/protogen/AuthorizationServerConfig/AuthorizationServerConfigApplication.java`
- [API gateway](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/infrastructure/gatewayservice/src/main/java/za/co/protogen/gatewayservice/GatewayserviceApplication.java): `backend/infrastructure/gatewayservice/src/main/java/za/co/protogen/gatewayservice/GatewayserviceApplication.java`
- [Eureka registry](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/infrastructure/eurekaserver/src/main/java/za/co/protogen/eurekaserver/EurekaserverApplication.java): `backend/infrastructure/eurekaserver/src/main/java/za/co/protogen/eurekaserver/EurekaserverApplication.java`
- [Config server](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/infrastructure/configserver/src/main/java/za/co/protogen/configserver/ConfigserverApplication.java): `backend/infrastructure/configserver/src/main/java/za/co/protogen/configserver/ConfigserverApplication.java`

### Cars domain

- [Cars API](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/cars-service/src/main/java/za/co/protogen/controller/CarsApiController.java): `backend/services/cars-service/src/main/java/za/co/protogen/controller/CarsApiController.java`
- [Cars logic](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/cars-service/src/main/java/za/co/protogen/core/impl/CarsServiceImpl.java): `backend/services/cars-service/src/main/java/za/co/protogen/core/impl/CarsServiceImpl.java`
- [Car repository](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/cars-service/src/main/java/za/co/protogen/persistance/repository/CarRepository.java): `backend/services/cars-service/src/main/java/za/co/protogen/persistance/repository/CarRepository.java`

### Reservations domain

- [Reservations API](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/reservations-service/src/main/java/za/co/protogen/controller/ReservationsApiController.java): `backend/services/reservations-service/src/main/java/za/co/protogen/controller/ReservationsApiController.java`
- [Reservation logic](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/reservations-service/src/main/java/za/co/protogen/core/impl/ReservationServiceImpl.java): `backend/services/reservations-service/src/main/java/za/co/protogen/core/impl/ReservationServiceImpl.java`
- [Reservation repository](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/reservations-service/src/main/java/za/co/protogen/persistance/repository/ReservationRepository.java): `backend/services/reservations-service/src/main/java/za/co/protogen/persistance/repository/ReservationRepository.java`

### Users domain

- [Users API](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/users-service/src/main/java/za/co/protogen/controller/UsersApiController.java): `backend/services/users-service/src/main/java/za/co/protogen/controller/UsersApiController.java`
- [User logic](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/users-service/src/main/java/za/co/protogen/core/impl/UserServiceImpl.java): `backend/services/users-service/src/main/java/za/co/protogen/core/impl/UserServiceImpl.java`
- [User repository](https://github.com/sanimanqezu/vehicle-rental-system/blob/master/backend/services/users-service/src/main/java/za/co/protogen/persistance/repository/UserRepository.java): `backend/services/users-service/src/main/java/za/co/protogen/persistance/repository/UserRepository.java`

### Other components

- **Renter**
- **Service databases**

## Connections

- Renter → Next.js app: uses
- Next.js app → Sign-in / registration: opens
- Sign-in / registration → NextAuth: signs in
- NextAuth → OAuth2 server: requests token
- Sign-in / registration → Next.js app: registers
- Next.js app → Car management: manages cars
- Next.js app → Reservation management: manages bookings
- Next.js app → User management: manages users
- Next.js app → Dashboard: views metrics
- Car management → API client: API calls
- Reservation management → API client: API calls
- User management → API client: API calls
- Dashboard → API client: API calls
- API client → API gateway: bearer requests
- API gateway → Cars API: routes
- API gateway → Reservations API: routes
- API gateway → Users API: routes
- Cars API → Cars logic: invokes
- Cars logic → Car repository: queries / writes
- Car repository → Service databases: persists
- Reservations API → Reservation logic: invokes
- Reservation logic → Reservation repository: queries / writes
- Reservation repository → Service databases: persists
- Users API → User logic: invokes
- User logic → User repository: queries / writes
- User repository → Service databases: persists
- Cars logic → OAuth2 server: validates JWT
- Reservations API → OAuth2 server: validates JWT
- Users API → OAuth2 server: validates JWT
- API gateway → Eureka registry: discovers services
- Cars API → Eureka registry: registers
- Reservations API → Eureka registry: registers
- Users API → Eureka registry: registers
- API gateway → Config server: loads config
- Cars API → Config server: loads config
- Reservations API → Config server: loads config
- Users API → Config server: loads config
