Skip to content

kl3inIT/House-Rental-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

133 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RentEase - House Rental Platform

A modern Spring Boot application for managing house rentals with features like property listing, user authentication, booking management, and admin dashboard.

Java Spring Boot Tailwind CSS SQL Server

πŸš€ Features

For Users

  • Authentication: Secure login/register with email verification
  • Property Search: Advanced search and filter capabilities
  • Property Details: Detailed property views with image galleries
  • Booking Management: Request and manage property bookings
  • Profile Management: Update personal information and preferences
  • Favorites: Save and manage favorite properties

For Landlords

  • Property Management: Add, edit, and manage property listings
  • Dashboard: Overview of properties, bookings, and revenue
  • Image Upload: Multiple property images with drag-and-drop interface
  • Booking Requests: Review and respond to tenant requests
  • Analytics: Property performance and viewing statistics

For Admins

  • Admin Dashboard: System overview and user management
  • User Management: Manage user accounts and permissions
  • Property Oversight: Monitor and moderate property listings
  • System Analytics: Platform usage and performance metrics

πŸ“‹ Prerequisites

  • Java 21+ (for local development)
  • Maven 3.9+ (for local development)
  • Node.js 16+ & npm 8+ (for CSS/frontend build)
  • Docker & Docker Compose (recommended for easy setup)

πŸ› οΈ Quick Start

Option 1: Docker Setup (Recommended)

  1. Clone the repository
git clone https://github.com/yourusername/house-rental.git
cd house-rental
  1. Environment Setup Create a .env file:
SPRING_DATASOURCE_URL=jdbc:sqlserver://localhost:1434;databaseName=HouseRentalDB;encrypt=true;trustServerCertificate=true
SPRING_DATASOURCE_USERNAME=sa
SPRING_DATASOURCE_PASSWORD=Dat12345!
SPRING_MAIL_USERNAME=your-email@gmail.com
SPRING_MAIL_PASSWORD=your-app-password
  1. Start with Docker
docker-compose up -d
  1. Access the application
  • 🌐 Web app: http://localhost:8080
  • πŸ—„οΈ SQL Server: localhost:1434
  • πŸ“¦ Redis: localhost:6380

Option 2: Local Development

  1. Install dependencies
npm install
  1. Build CSS (one-time)
npm run build:css:prod
  1. Run the application
./mvnw spring-boot:run

🎨 CSS Development Workflow

This project uses Tailwind CSS with a custom build system:

File Structure

src/main/resources/static/css/
β”œβ”€β”€ input.css      # πŸ“ Source file (edit this)
└── main.css       # πŸ”„ Built file (auto-generated)

Development Commands

chαΊ‘y npm run dev nαΊΏu thay Δ‘α»•i html css để tα»± build lαΊ‘i tailwind

For active development (watch mode):

# Windows
./dev-css.bat

# Linux/Mac  
./dev-css.sh

# Or directly
npm run build:css

For production build:

npm run build:css:prod

Auto-build on app start:

mvn spring-boot:run  # CSS builds automatically

Workflow

  1. ✏️ Edit src/main/resources/static/css/input.css
  2. πŸ”„ Run watch mode: npm run build:css
  3. πŸ’Ύ CSS compiles to main.css automatically
  4. 🌐 Refresh browser to see changes

��️ Project Structure

πŸ“ HouseRental/
β”œβ”€β”€ πŸ“ src/main/
β”‚   β”œβ”€β”€ πŸ“ java/com/rental/houserental/
β”‚   β”‚   β”œβ”€β”€ πŸ“ controller/          # REST controllers
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“ admin/          # Admin endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“ landlord/       # Landlord endpoints  
β”‚   β”‚   β”‚   └── πŸ“ user/           # User endpoints
β”‚   β”‚   β”œβ”€β”€ πŸ“ service/            # Business logic
β”‚   β”‚   β”œβ”€β”€ πŸ“ repository/         # Data access
β”‚   β”‚   β”œβ”€β”€ πŸ“ entity/             # JPA entities
β”‚   β”‚   β”œβ”€β”€ πŸ“ dto/                # Data transfer objects
β”‚   β”‚   β”œβ”€β”€ πŸ“ security/           # Security configuration
β”‚   β”‚   β”œβ”€β”€ πŸ“ config/             # App configuration
β”‚   β”‚   └── πŸ“ exceptions/         # Custom exceptions
β”‚   └── πŸ“ resources/
β”‚       β”œβ”€β”€ πŸ“ static/
β”‚       β”‚   β”œβ”€β”€ πŸ“ css/            # Stylesheets
β”‚       β”‚   └── πŸ“ js/             # JavaScript files
β”‚       └── πŸ“ templates/          # Thymeleaf templates
β”‚           β”œβ”€β”€ πŸ“ admin/          # Admin pages
β”‚           β”œβ”€β”€ πŸ“ landlord/       # Landlord pages
β”‚           β”œβ”€β”€ πŸ“ user/           # User pages
β”‚           β”œβ”€β”€ πŸ“ fragments/      # Reusable components
β”‚           └── πŸ“ layout/         # Page layouts
β”œβ”€β”€ πŸ“„ package.json               # npm dependencies & scripts
β”œβ”€β”€ πŸ“„ tailwind.config.js         # Tailwind configuration
β”œβ”€β”€ πŸ“„ pom.xml                    # Maven dependencies
└── πŸ“„ docker-compose.yml         # Docker setup

πŸ”§ Technology Stack

Backend

  • Spring Boot 3.x - Application framework
  • Spring Security - Authentication & authorization
  • Spring Data JPA - Database operations
  • Thymeleaf - Server-side templating
  • SQL Server - Primary database
  • Redis - Caching & session storage
  • Java Mail - Email notifications

Frontend

  • Tailwind CSS 3.x - Utility-first CSS framework
  • JavaScript ES6+ - Client-side interactions
  • Font Awesome 6 - Icons
  • Inter Font - Typography

Infrastructure

  • Docker & Docker Compose - Containerization
  • Maven - Build tool & dependency management
  • npm - Frontend package management

πŸ” Security Features

  • JWT Authentication with refresh tokens
  • Email Verification for new accounts
  • Password Reset with secure tokens
  • CSRF Protection on all forms
  • Session Management with Redis
  • Role-based Access Control (User, Landlord, Admin)
  • Remember Me functionality

πŸš€ Deployment

Production Build

# Build CSS for production
npm run build:css:prod

# Create jar file
./mvnw clean package -DskipTests

# Run with Docker
docker-compose -f docker-compose.prod.yml up -d

Environment Variables

# Database
SPRING_DATASOURCE_URL=your_database_url
SPRING_DATASOURCE_USERNAME=your_username
SPRING_DATASOURCE_PASSWORD=your_password

# Email
SPRING_MAIL_USERNAME=your_email
SPRING_MAIL_PASSWORD=your_app_password

# Redis
SPRING_REDIS_HOST=your_redis_host
SPRING_REDIS_PORT=6379

# Application
SERVER_PORT=8080
SPRING_PROFILES_ACTIVE=prod

πŸ› οΈ Development

Hot Reload Setup

# Terminal 1: Start CSS watch mode
npm run build:css

# Terminal 2: Start Spring Boot with dev profile
./mvnw spring-boot:run -Dspring-boot.run.profiles=dev

Database Commands

# Connect to SQL Server (Docker)
docker exec -it houserental-db-1 /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Dat12345!

# Backup database
docker exec houserental-db-1 /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Dat12345! -Q "BACKUP DATABASE HouseRentalDB TO DISK = '/var/opt/mssql/backup/HouseRentalDB.bak'"

Docker Commands

# Start services
docker-compose up -d

# View logs
docker-compose logs -f app

# Rebuild with changes
docker-compose up -d --build

# Clean reset
docker-compose down -v && docker-compose up -d

πŸ§ͺ Testing

# Run all tests
./mvnw test

# Run specific test class
./mvnw test -Dtest=AuthServiceTest

# Run with coverage
./mvnw test jacoco:report

πŸ“ API Documentation

The application provides REST endpoints for:

  • Authentication: /api/auth/*
  • Properties: /api/properties/*
  • Users: /api/users/*
  • Bookings: /api/bookings/*
  • Admin: /api/admin/*

Visit /swagger-ui.html when running locally for interactive API docs.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Guidelines

  • Follow Java coding standards
  • Write unit tests for new features
  • Use conventional commits
  • Update documentation as needed

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘₯ Authors

πŸ™‹β€β™‚οΈ Support

If you have any questions or run into issues:

  1. Check the Issues page
  2. Create a new issue with detailed description
  3. Contact: your.email@example.com

Built with ❀️ using Spring Boot and Tailwind CSS

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors