A comprehensive real estate management platform backend built with Spring Boot, featuring role-based access, property management, and real-time notifications.
- Features
- Tech Stack
- Architecture
- Project Structure
- API Endpoints
- Setup & Installation
- Contributors
-
User Authentication & Authorization
- JWT-based authentication
- Role-based access control (Admin, Provider, Customer)
- Secure password hashing with BCrypt
-
Property Management
- CRUD operations for property listings
- Advanced filtering and search
- Image upload and management
- Favorites system
-
Request System
- Property inquiries and requests
- Status tracking
- Admin management
-
Notifications
- Real-time notifications
- Read/unread status
- Admin broadcasting
-
User Profiles
- Profile management
- Profile pictures
- Role-specific features
- Backend: Java 21, Spring Boot 3.5.5
- Database: PostgreSQL 13
- Object Relational Mapping: JPA, Hibernate
- Authentication: Spring Security, JWT
- File Storage: Local file system
- Tools: Maven, Postman
- Testing: JUnit 5, Mockito
Controller → Service → Repository → PostgreSQL
Authentication → Spring Security + JWT
src/main/java/org/os/bayturabackend/
├── config/ # Configuration classes
├── controllers/ # REST Controllers
├── DTOs/ # Data Transfer Objects
├── entities/ # JPA Entities
├── exceptions/ # Custom exceptions
├── mappers/ # Object mappers
├── repositories/ # Data access layer
├── services/ # Business logic
└── specifications/ # JPA Specifications
POST /api/auth/register/customer- Register a new customerPOST /api/auth/register/provider- Register a new property providerPOST /api/auth/register/admin- Register a new adminPOST /api/auth/login- User login
GET /api/user/profile- Get current user profilePUT /api/user/profile- Update user profileDELETE /api/user/profile- Delete a user accountPUT /api/user/profile/pfp- Upload profile pictureDELETE /api/user/profile/pfp- Remove profile pictureGET /api/user/profile/favorites- Get user's favorite properties
GET /api/properties- Get all properties with filtering- Query params: type, purpose, searchQuery, minPrice, maxPrice, minArea, maxArea, owner, page, size
GET /api/properties/{id}- Get property by IDGET /api/properties/media/{id}- Get media by IDGET /api/properties/{id}/media- Get all media for a property
GET /api/properties/my- Get current user's properties (PROVIDER/CUSTOMER)POST /api/properties- Create new property (PROVIDER only)PUT /api/properties/{id}- Update property (Owner only)PUT /api/properties/{id}/change-status- Change property status (Owner only)DELETE /api/properties/{id}- Delete property (Owner only)POST /api/properties/{id}/media-upload- Upload media for property (Owner only)DELETE /api/properties/{propertyId}/media/{mediaId}- Delete property media (Owner only)POST /api/properties/{id}/favorite- Add property to favorites (CUSTOMER only)DELETE /api/properties/{id}/unfavorite- Remove property from favorites (CUSTOMER only)
DELETE /api/admin/properties/{id}- Delete any property
GET /api/requests- Get all requests by current customerGET /api/requests/{requestId}- Get request detailsPOST /api/requests- Create new requestDELETE /api/requests/{requestId}- Delete request
GET /api/admin/requests- Get all requests with filtering- Query params: status, username
GET /api/admin/requests/{requestId}- Get any request detailsPUT /api/admin/requests/{requestId}/status- Update request statusDELETE /api/admin/requests/{requestId}- Delete any request
PUT /api/admin/provider/{id}/status- Update provider statusGET /api/admin/customer-requests- Get all customer requestsGET /api/admin/provider-requests- Get all provider requestsGET /api/admin/users- Get all users with filtering- Query params: role, status, companyName
GET /api/notifications- Get all user notificationsGET /api/notifications/unread- Get unread notificationsGET /api/notifications/unread/count- Get count of unread notificationsPUT /api/notifications/{id}/read- Mark notification as readDELETE /api/notifications/{id}- Delete notificationPOST /api/notifications/create- Create notification (ADMIN only)- Params: userId, title, content, type
- Java 21 or higher
- Maven 3.5.5 or higher
- PostgreSQL 13 or higher
- Cloudinary account (for image storage)
- Email service (e.g., Gmail) for email notifications
-
Clone the repository
git clone https://github.com/Nada-ibrahim12/baytura-backend cd baytura-backend -
Database Setup
- Install and start PostgreSQL
- Create a new database for the application
-
Cloudinary Setup
- Create a Cloudinary account (https://cloudinary.com)
- Get your Cloud Name, API Key, and API Secret from the Cloudinary dashboard
-
Email Service Setup
- Set up an email service (e.g., Gmail)
- For Gmail, you may need to enable "Less secure app access" or use an App Password
-
Configure the application
- Create a
.envfile in the project root directory - Copy the following variables from
.env.exampleand fill in your values:# Database Configuration DB_URL=jdbc:postgresql://localhost:5432/your_database_name DB_USERNAME=your_db_username DB_PASSWORD=your_db_password API_PORT=8080 # JWT Configuration JWT_SECRET=your_secure_random_string JWT_EXPIRATION=86400000 # 24 hours in milliseconds # Cloudinary Configuration CLOUDINARY_CLOUD_NAME=your_cloud_name CLOUDINARY_API_KEY=your_api_key CLOUDINARY_API_SECRET=your_api_secret # Email Configuration MAIL_USERNAME=your_email@example.com MAIL_PASSWORD=your_email_password_or_app_password
- Create a
-
Build the application
# Build the application ./mvnw clean install -
Run the application
# Run the application ./mvnw spring-boot:run -
Verify the installation
- The application will be available at:
http://localhost:8080 - Check the console output for any startup errors
- The application will be available at:
-
Ephraim Youssef
-
Nada Ibrahim