A full-stack Car Rental Management System built with Java 17 and Spring Boot 3.2.5. Evolved from a console application into a production-ready web platform featuring a 3-layer architecture, H2 database persistence, PDF receipt generation, Chart.js analytics, loyalty discounts, and an AI assistant powered by OpenRouter.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PRESENTATION LAYER β
β ββββββββββββ ββββββββββββ ββββββββββββ βββββββββββββββ β
β βThymeleaf β β HTML/CSS β βChart.js β β AI Chatbot β β
β βTemplates β β (RWD) β β(Analytics)β β (Markdown) β β
β ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ ββββββββ¬βββββββ β
β β β β β β
βββββββββ΄βββββββββββββββ΄βββββββββββββββ΄βββββββββββββββββ΄ββββββββ€
β CONTROLLER LAYER β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β RentalController (HTTP Routes) β β
β β / /rent /return /history /charts /cars /customer β β
β β /about /agreement/{id} /activity /export/csv β β
β ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββ β
β β ChatController (AI - REST API) β β
β β POST /api/chat β OpenRouter (Free LLM Models) β β
β β Injects live DB context β Intelligent responses β β
β ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββ€
β SERVICE LAYER β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β CarRentalSystem (Business Logic) β β
β β βββββββββββββ ββββββββββββ βββββββββββ βββββββββββββ β β
β β β Fleet Mgmtβ βRental β βCustomer β β Analytics β β β
β β β CRUD β βBooking β βLoyalty β β Insights β β β
β β βββββββββββββ ββββββββββββ βββββββββββ βββββββββββββ β β
β β βββββββββββββ ββββββββββββ βββββββββββββββββββββββββ β β
β β β PDF Gen β βActivity β β Rating & Review β β β
β β β (iText) β β Logging β β System β β β
β β βββββββββββββ ββββββββββββ βββββββββββββββββββββββββ β β
β ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββ€
β REPOSITORY LAYER (Spring Data JPA) β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββ β
β β CarRepository β β RentalRepo β β CustomerRepo β β
β β (CRUD + Query)β β (Overlap + β β (Phone Search) β β
β ββββββββ¬ββββββββ β Status) β ββββββββββ¬ββββββββββ β
β β ββββββββ¬ββββββββ β β
β βββββββββββββββββββ΄ββββββββββββββββββββ β
ββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββ€
β DATABASE LAYER β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β H2 Database (Embedded SQL) β β
β β βββββββββββββ βββββββββββββ βββββββββββββββββββββββ β β
β β β cars β β customers β β rentals β β β
β β β ββββPK β β ββββPK β β ββββPK β β β
β β β car_id β β id β β car_id (FK β cars) β β β
β β β brand β β name β β customer_id (FKβcus)β β β
β β β model β β phone β β start_date β β β
β β β price β β rental_cntβ β end_date β β β
β β β category β β discount β β total_price β β β
β β βββββββββββββ βββββββββββββ β status (ACTIVE/ β β β
β β βββββββββββββ β RETURNED) β β β
β β β activity β β rating, notes β β β
β β β _log β βββββββββββββββββββββββ β β
β β βββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Pattern | Usage |
|---|---|
| 3-Layer Architecture | Controller β Service β Repository β clean separation of concerns |
| Dependency Injection | Spring Boot DI for all services and repositories |
| Repository Pattern | Spring Data JPA for database abstraction |
| DTO Pattern | Model entities used across layers |
| Template Method | Thymeleaf layouts for consistent UI |
| Strategy Pattern | Fallback model strategy for AI chatbot |
| Feature | Description |
|---|---|
| Fleet Management | Add, delete, and view cars with categories and pricing |
| Date-Based Booking | Rent cars with date picker, live price preview, and double-booking prevention |
| One-Click Return | Return any active rental instantly |
| Rental History | Complete record of active and completed rentals |
| PDF Receipts | Professional PDF receipt for every booking via iText |
| Revenue Charts | Monthly revenue bar chart + category doughnut chart via Chart.js |
| CSV Export | Download complete rental history as CSV |
| Feature | Description |
|---|---|
| Customer Profiles | Search customers by phone, view full rental history with stats |
| Customer Ratings | Rate returned rentals (1-5 stars), average rating per car |
| Loyalty Discounts | 3 rentals β 5% off, 5 rentals β 10% off, 10+ rentals β 15% off |
| Activity Log | Track all actions β add/delete/rent/return with timestamps |
| Booking Notes | Add special requests when renting (baby seat, preferred color, etc.) |
| Dashboard Insights | Most rented car, top customer, busiest month, avg rental duration |
| Print Agreement | Print-friendly rental agreement with full terms and conditions |
| AI Assistant | Intelligent chatbot that knows everything about the fleet and system |
| Dark/Light Theme | Toggle between dark and light mode with persistence |
| Technology | Purpose |
|---|---|
| Java 17 | Core programming language |
| Spring Boot 3.2.5 | Web framework + dependency injection |
| Spring Data JPA | Database ORM layer |
| H2 Database | Embedded persistent SQL database |
| iText PDF 5 | PDF receipt generation |
| Maven | Build and dependency management |
| Technology | Purpose |
|---|---|
| Thymeleaf | Server-side HTML templating |
| HTML5 + CSS3 | Mobile-first responsive design |
| Vanilla JavaScript | Dynamic interactions, price preview |
| Chart.js | Interactive revenue and category charts |
| Marked.js | Markdown rendering in AI chatbot |
| KaTeX | LaTeX math rendering in AI chatbot |
| Platform | Method |
|---|---|
| Render | Auto-deploy from GitHub (via render.yaml) |
| Railway | Alternative deployment option |
erDiagram
CAR {
string car_id PK
string brand
string model
double base_price_per_day
string category
boolean available
}
CUSTOMER {
long id PK
string customer_id
string name
string phone
int rental_count
double loyalty_discount
}
RENTAL {
long id PK
string car_id FK
long customer_id FK
date start_date
date end_date
int days
double total_price
string status "ACTIVE | RETURNED"
int rating
string notes
}
ACTIVITY_LOG {
long id PK
string action
string description
timestamp created_at
}
CAR ||--o{ RENTAL : "rented in"
CUSTOMER ||--o{ RENTAL : "rented by"
The app is live at: https://rentify-ifs4.onrender.com
# Clone the repository
git clone https://github.com/bikashpubg678-maker/Rentify-java-project.git
cd Rentify-java-project
# Run the application
mvn spring-boot:run
# Open in browser
open http://localhost:8081mvn clean package
java -jar target/AutoRentWeb-1.0.jar| Variable | Default | Description |
|---|---|---|
PORT |
8081 |
Server port |
OPENROUTER_API_KEY |
β | API key for AI chatbot (optional, free models used otherwise) |
| Method | Path | Description |
|---|---|---|
| GET | / |
Dashboard with fleet overview and insights |
| GET | /rent |
Car rental form with date picker |
| POST | /rent |
Submit rental booking |
| GET | /return |
Car return page |
| POST | /return |
Submit car return |
| GET | /history |
Rental history |
| GET | /charts |
Revenue and category analytics |
| GET | /cars |
Fleet management |
| POST | /cars/add |
Add new car |
| POST | /cars/delete |
Remove car from fleet |
| GET | /customer |
Customer search |
| GET | /customer/profile?id=X |
Customer profile |
| GET | /activity |
System activity log |
| GET | /about |
Developer information |
| GET | /agreement/{id} |
Print-friendly rental agreement |
| Method | Path | Description |
|---|---|---|
| GET | /receipt/{id} |
Download PDF receipt |
| GET | /export/csv |
Download rental history as CSV |
| POST | /api/chat |
AI chatbot API |
- Push your code to GitHub
- In Render Dashboard β New β Blueprint
- Connect your GitHub repository
- Render auto-detects
render.yamland deploys
- Create a Web Service on Render
- Connect your GitHub repo
- Set:
- Build Command:
mvn clean package -DskipTests - Start Command:
java -jar target/AutoRentWeb-1.0.jar - Auto-Deploy: Yes
- Build Command:
- Add Environment Variable:
PORT = 8080
graph LR
A[Git Push] --> B[GitHub]
B --> C[Render Webhook]
C --> D[Build: mvn package]
D --> E[Test: mvn test]
E --> F[Deploy to Render]
F --> G[Health Check /]
G --> H[Live!]
Every push to the main branch triggers automatic build, test, and deployment.
The built-in AI chatbot uses OpenRouter's free LLM models with automatic fallback:
- Meta Llama 3.3 70B (primary)
- OpenRouter Free (fallback)
- Google Gemma 2 9B (secondary fallback)
- Meta Llama 3.2 3B (last resort)
The AI has live access to the entire database β fleet, pricing, rentals, revenue, customer ratings, and loyalty tiers. It can answer questions about:
- Available cars and pricing
- Revenue and business insights
- Customer rental history
- Loyalty discounts
- Feature guidance and troubleshooting
Rentify/
βββ render.yaml # Render deployment config
βββ Procfile # Process definition
βββ pom.xml # Maven build
βββ README.md # This file
βββ src/
β βββ main/
β β βββ java/carrental/
β β β βββ App.java # Entry point
β β β βββ model/ # JPA entities
β β β βββ repository/ # Data access layer
β β β βββ service/ # Business logic
β β β βββ controller/ # HTTP routes
β β βββ resources/
β β βββ templates/ # Thymeleaf pages
β β βββ static/ # CSS, JS, images
β β βββ application.properties
β βββ test/
βββ target/ # Build output
Bikash Talukder Second Year Computer Science & Engineering Student
Built with Java + Spring Boot
This project is licensed under the MIT License β see the LICENSE file for details.
If you found this project useful, please give it a star on GitHub!