RentGapp is a comprehensive Java Spring Boot application for managing electronic equipment rentals (laptops, tablets, and smartphones). The system includes customer management, subscription plans, order control with business rule validation, and a modern web interface.
- Customer Management: Complete CRUD operations with web interface
- Equipment Management: Laptops, tablets, and smartphones with inventory control
- Subscription Plans: Basic (1 equipment), Standard (2 equipment), Premium (3 types)
- Order System: Complete order creation with automatic business rule validation
- Web Interface: Modern frontend with Bootstrap 5 and JavaScript
- Business Rule Engine: Automatic validation of plan-based equipment limits
- REST API: Complete endpoints for all operations
- Database: PostgreSQL with JPA/Hibernate and proper relationships
- Security: Spring Security configuration
- Validation Service: Dedicated service for business rule enforcement
- Testing: Comprehensive test suite with JUnit 5 and Mockito
- CI/CD: Automated testing and building with GitHub Actions
- Basic Plan: Allows renting 1 equipment of any type (laptop, tablet, or smartphone)
- Standard Plan: Allows renting up to 2 equipment of any type
- Premium Plan: Allows renting equipment of all 3 types (laptop + tablet + smartphone)
- Automatic Validation: System automatically verifies rules during order creation
- Equipment Type Control: Validates equipment types against plan restrictions
- Backend: Java 17, Spring Boot 3.5.x
- Persistence: Spring Data JPA, Hibernate, PostgreSQL
- Frontend: HTML5, CSS3, JavaScript, Bootstrap 5, Thymeleaf
- Build: Maven
- Security: Spring Security
- Utilities: Lombok
- Database: PostgreSQL 14+
src/main/java/com/melro/rentapp/
βββ config/ # Configurations (Security, etc.)
βββ controller/ # REST Controllers (API + Web)
βββ dto/ # Data Transfer Objects
βββ enums/ # Enumerations (PlanType, EquipmentType, etc.)
βββ model/ # JPA Entities
βββ repository/ # Spring Data Repositories
βββ security/ # Security configurations
βββ service/ # Business logic and validation
customers: Customer data with authenticationinternal_users: Internal system userslaptops: Laptop type equipmenttablets: Tablet type equipmentsmartphones: Smartphone type equipmentplans: Available subscription plans with types and durationsorders: Rental orders with timestampsorder_laptops,order_tablets,order_smartphones: Many-to-many relationships
GET /- Main dashboardGET /customers- Customer management pageGET /equipment- Equipment management pageGET /plans- Plan management pageGET /orders- Order management page
GET /api/health- Check application status
GET /api/customers- List all customersPOST /api/customers- Create new customerGET /api/customers/{id}- Get customer by IDPUT /api/customers/{id}- Update customerDELETE /api/customers/{id}- Delete customer
GET /api/equipment- List all equipmentGET /api/laptops- List laptopsGET /api/tablets- List tabletsGET /api/phones- List smartphonesPOST /api/laptops- Create laptopPOST /api/tablets- Create tabletPOST /api/phones- Create smartphone
GET /api/plans- List all plansPOST /api/plans- Create new plan
GET /api/orders- List all ordersPOST /api/orders- Create new order with validationGET /api/orders/{id}- Get order by ID
- Java 17 or higher
- PostgreSQL 14 or higher
- Maven 3.6+
# Clone the repository
git clone https://github.com/melrojohnn/rentGapp.git
cd rentGapp
# Checkout the latest version
git checkout v2.0.0-- Create database
CREATE DATABASE rentapp;
-- The application will automatically create tables and populate data
-- on first startup using the SQL scripts in src/main/resources/Edit src/main/resources/application.properties:
# Database configuration
spring.datasource.url=jdbc:postgresql://localhost:5432/rentapp
spring.datasource.username=your_username
spring.datasource.password=your_password
# JPA configuration
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
# Server configuration
server.port=8099# Run with Maven
mvn spring-boot:run
# Or build and run JAR
mvn clean package
java -jar target/rentapp-0.0.1-SNAPSHOT.jar- Web Interface: http://localhost:8099
- REST API: http://localhost:8099/api
- Health Check: http://localhost:8099/api/health
- Open http://localhost:8099 in your browser
- Navigate through the tabs: Dashboard, Customers, Equipment, Plans, Orders
- Use the forms to create and manage data
- Test order creation with different plan combinations
curl -X POST http://localhost:8099/api/customers \
-H "Content-Type: application/json" \
-d '{
"name": "John Smith",
"email": "john@email.com",
"password": "password123"
}'curl -X POST http://localhost:8099/api/orders \
-H "Content-Type: application/json" \
-d '{
"customerId": 1,
"planId": 1,
"equipmentItems": [
{"equipmentId": 1, "equipmentType": "LAPTOP"}
]
}'curl -X POST http://localhost:8099/api/orders \
-H "Content-Type: application/json" \
-d '{
"customerId": 1,
"planId": 2,
"equipmentItems": [
{"equipmentId": 1, "equipmentType": "LAPTOP"},
{"equipmentId": 2, "equipmentType": "TABLET"}
]
}'curl -X POST http://localhost:8099/api/orders \
-H "Content-Type: application/json" \
-d '{
"customerId": 1,
"planId": 3,
"equipmentItems": [
{"equipmentId": 1, "equipmentType": "LAPTOP"},
{"equipmentId": 2, "equipmentType": "TABLET"},
{"equipmentId": 3, "equipmentType": "SMARTPHONE"}
]
}'# Make the script executable
chmod +x test_order_creation.sh
# Run the test
./test_order_creation.shThe application includes a complete web interface with:
- Dashboard: System overview with statistics
- Customers: Complete customer management with forms
- Equipment: Management of laptops, tablets, and smartphones
- Plans: Subscription plan management
- Orders: Order visualization and creation with validation
# Server
server.port=8099
# Database
spring.datasource.url=jdbc:postgresql://localhost:5432/rentapp
spring.datasource.username=your_username
spring.datasource.password=your_password
# JPA
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
# Logging
logging.level.com.melro.rentapp=DEBUGexport SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/rentapp
export SPRING_DATASOURCE_USERNAME=your_username
export SPRING_DATASOURCE_PASSWORD=your_password
export SERVER_PORT=8099-
Port already in use (8099)
# Find and kill the process lsof -ti:8099 | xargs kill -9
-
Database connection failed
- Verify PostgreSQL is running
- Check database credentials
- Ensure database exists
-
Application won't start
- Check Java version (requires 17+)
- Verify Maven dependencies
- Check application logs
# View application logs
tail -f logs/application.log
# Or if using Maven
mvn spring-boot:run -Dspring-boot.run.arguments="--logging.level.com.melro.rentapp=DEBUG"- JWT authentication and authorization
- User roles and permissions
- API rate limiting
- Swagger/OpenAPI documentation
- API versioning
- Enhanced error handling
- Unit and integration tests
- CI/CD with GitHub Actions
- Code coverage reports
- Dockerization
- Kubernetes deployment
- Monitoring and metrics
Melro Johnn
- GitHub: @melrojohnn
- Project: RentGapp
This project is under the MIT license. See the LICENSE file for more details.
Contributions are welcome! Please read the contribution guidelines before submitting a pull request.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include logs and error messages
RentGapp v2.0.0 - Complete electronic equipment rental system! π
The project includes a comprehensive test suite:
- CustomerServiceTest: 7 unit tests covering customer operations
- OrderServiceTest: 7 unit tests covering order processing
- CustomerControllerTest: 6 integration tests for REST endpoints
- Uses H2 in-memory database for isolated testing
- Spring Security configured for test scenarios
- CSRF protection for web endpoints
# Run all tests
mvn test
# Run specific test class
mvn test -Dtest=CustomerServiceTest
# Run with coverage
mvn test jacoco:reportThe project uses GitHub Actions for continuous integration:
- Push to
mainordevelopbranches - Pull requests to
mainbranch
- Test Job: Runs all unit and integration tests
- Build Job: Creates application JAR (only if tests pass)
- Artifacts: Uploads test results and application JAR
- JDK 17 setup with Maven caching
- Parallel job execution for efficiency
- Test result artifacts for debugging
- Build artifacts for deployment