# jack20410/car-rental-system architecture

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

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

## Overview

##### Project type and purpose
- This is a full-stack, microservices-based “Car Rental System” that handles user authentication, vehicle catalog, rental bookings, payments, notifications, support and admin/reporting.
- Each domain is isolated in its own service; there’s a React frontend and a Python-based API Gateway that routes requests to Node.js microservices.

##### File structure
- Top level:
- docker-compose.yml – orchestrates all containers
- api-gateway/ – FastAPI or Flask gateway (Python)
- frontend/ – React+Vite SPA
- services/ – seven domain services: user, vehicle, rental, payment, notification, support, admin
- uploads/ – shared volume for avatars & vehicle images
- Each service has its own Dockerfile, package.json, src folder, and often config (e.g. database.js), controllers, routes, models and middleware.
- Middleware layers are used in both the API Gateway (auth, logging, rate-limiting) and services.

##### README for additional insights
- Describes microservices architecture, features per domain, and shared directories (`uploads`, future `libs`).
- Emphasizes Docker Compose for local orchestration and independent service development.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client and UI Layer
    Client["Client (Browser/Mobile)"]:::external
    React["React SPA"]:::ui

    %% API Gateway Layer
    API["API Gateway"]:::gateway

    %% Container Orchestration
    Compose["Docker Compose"]:::external

    %% Microservices Group
    subgraph "Microservices"
        direction TB
        UserService["User Service"]:::service
        UserDB[(User DB)]:::db

        VehicleService["Vehicle Service"]:::service
        VehicleDB[(Vehicle DB)]:::db

        RentalService["Rental Service"]:::service
        RentalDB[(Rental DB)]:::db

        PaymentService["Payment Service"]:::service
        PaymentDB[(Payment DB)]:::db

        NotificationService["Notification Service"]:::service
        NotificationDB[(Notification DB)]:::db

        SupportService["Support Service"]:::service
        SupportDB[(Support DB)]:::db

        AdminService["Admin Service"]:::service
        AdminDB[(Admin DB)]:::db
    end

    %% Shared Storage
    Storage["Shared Uploads Volume"]:::storage

    %% External Integrations
    Email["Email/SMS Gateway"]:::external
    PaymentGateway["Payment Processor"]:::external
    MessageBroker["Message Broker (Future)"]:::external

    %% Data Flows
    Client --> React
    React --> API
    API --> UserService
    API --> VehicleService
    API --> RentalService
    API --> PaymentService
    API --> NotificationService
    API --> SupportService
    API --> AdminService

    UserService --> UserDB
    VehicleService --> VehicleDB
    RentalService --> RentalDB
    PaymentService --> PaymentDB
    NotificationService --> NotificationDB
    SupportService --> SupportDB
    AdminService --> AdminDB

    VehicleService -.->|stores files| Storage
    UserService -.->|stores files| Storage

    NotificationService --> Email
    PaymentService --> PaymentGateway

    %% Event Bus (Future)
    UserService -.-> MessageBroker
    VehicleService -.-> MessageBroker
    RentalService -.-> MessageBroker
    PaymentService -.-> MessageBroker
    NotificationService -.-> MessageBroker
    SupportService -.-> MessageBroker
    AdminService -.-> MessageBroker

    %% Orchestration connections
    Compose --> API
    Compose --> UserService
    Compose --> VehicleService
    Compose --> RentalService
    Compose --> PaymentService
    Compose --> NotificationService
    Compose --> SupportService
    Compose --> AdminService
    Compose --> Storage

    %% Click Events
    click React "https://github.com/jack20410/car-rental-system/tree/main/frontend/"
    click API "https://github.com/jack20410/car-rental-system/tree/main/api-gateway/"
    click UserService "https://github.com/jack20410/car-rental-system/blob/main/services/user-service/src/index.js"
    click VehicleService "https://github.com/jack20410/car-rental-system/blob/main/services/vehicle-service/src/index.js"
    click RentalService "https://github.com/jack20410/car-rental-system/blob/main/services/rental-service/src/index.js"
    click PaymentService "https://github.com/jack20410/car-rental-system/blob/main/services/payment-service/src/index.js"
    click NotificationService "https://github.com/jack20410/car-rental-system/blob/main/services/notification-service/src/index.js"
    click SupportService "https://github.com/jack20410/car-rental-system/blob/main/services/support-service/src/index.js"
    click AdminService "https://github.com/jack20410/car-rental-system/blob/main/services/admin-service/src/index.js"
    click Compose "https://github.com/jack20410/car-rental-system/blob/main/docker-compose.yml"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366d6,stroke-width:1px
    classDef gateway fill:#DFFFE0,stroke:#2c662d,stroke-width:1px
    classDef service fill:#FFE8B0,stroke:#d48806,stroke-width:1px
    classDef db fill:#F0F0F0,stroke:#888888,stroke-width:1px
    classDef storage fill:#F0F0F0,stroke:#888888,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#E8D0FF,stroke:#6e2c8a,stroke-width:1px,stroke-dasharray: 2 2
```
