How ciprian-radu/rent-a-car works
Project Type and Purpose
• This is a multi-module Java / Gradle application that implements a car-rental system as a _Proof of Concept_ for Clean Architecture (Ports & Adapters).
• It comprises three Spring Boot apps (OAuth2 Server, REST API, OAuth2 Client UI), a core domain model (entities + use cases), interface adapters (HTTP + JDBC gateways) and external interfaces (databases, REST endpoints, UI).
Main Architectural Layers (Clean Architecture)
• Entities (core business rules)
– Module: application/entities
• Use Cases (application-specific business rules)
– Module: application/use-cases
• Interface Adapters (implement ports for external systems)
– HTTP adapters: application/interface-adapters/http
– Database gateways: application/interface-adapters/gateways
• External Interfaces / Frameworks (details)
– REST API service: application/external-interfaces/rest-api
– OAuth2 Server: application/external-interfaces/auth-server
– OAuth2 Client UI: application/external-interfaces/auth-client
– Databases:
• Embedded/H2: application/external-interfaces/databases/h2-embedded
• Local H2: application/external-interfaces/databases/h2-local
• PostgreSQL: application/external-interfaces/databases/postgresql
• DB initializer: application/external-interfaces/databases/initializer
Highlighted Design Principles
• Dependency Rule: Outer layers depend on inner layers only via interfaces (ports).
• Ports & Adapters:
• Ports = Use Case input/output ports (interfaces in use-cases module)
• Adapters = HTTP adapters, JDBC gateways, OAuth2 client/server implementations
• Separation of Concerns: Business logic is framework-agnostic.
• Testability: Each layer has its own unit and integration tests (project’s tests/ subprojects).
Technologies & Frameworks
• Java 12, Gradle, Spring Boot
• Spring MVC (HTTP controllers), Spring JDBC (gateways)
• OAuth2 (Spring Security) for authentication
• H2 (embedded and local) and PostgreSQL databases