A modern, scalable RESTful API for managing real estate properties, listings, inquiries, and user accounts. Built with clean architecture principles and industry best practices.
Real Estate API is a comprehensive backend solution designed to handle complex real estate business operations. It provides a robust platform for managing properties, property types, user inquiries, and property images with advanced features like pagination, validation, and JWT authentication.
| Layer | Technology |
|---|---|
| Framework | ASP.NET Core 10.0 |
| Database | PostgreSQL |
| ORM | Entity Framework Core 10.0 |
| Authentication | JWT (JSON Web Tokens) |
| Validation | FluentValidation |
| Mapping | AutoMapper |
| API Documentation | OpenAPI/Swagger |
| Language | C# (.NET) |
The project follows Clean Architecture principles with a layered approach:
RealEstate.API (Presentation Layer)
├── Controllers # API endpoints
├── Filters # Request/response filters
└── Middleware # Custom middleware (exception handling)
RealEstate.Business (Business Logic Layer)
├── Abstract # Service interfaces
├── Concrete # Service implementations
├── DTOs # Data transfer objects
├── Validators # FluentValidation rules
├── Exceptions # Custom exceptions
├── Mapping # AutoMapper profiles
└── Configs # Configuration classes
RealEstate.Entity (Data Layer)
├── Abstract # Base entity classes
└── Concrete # Entity models
- PropertyController - Endpoints for property management (CRUD operations, pagination)
- Property - Main property listings
- PropertyType - Types of properties (e.g., apartment, house)
- PropertyImage - Property images and media
- Inquiry - User inquiries about properties
- AppUser - User accounts and profiles
- AppRole - User roles and permissions
- ✅ Pagination - Efficient large dataset handling with
PaginationQueryDto - ✅ Validation - Comprehensive input validation using FluentValidation
- ✅ Error Handling - Custom exception middleware with consistent error responses
- ✅ Authentication - JWT-based security
- ✅ CORS - Configurable cross-origin resource sharing
- ✅ API Documentation - Built-in OpenAPI/Swagger support
- .NET 10.0 SDK or later
- PostgreSQL 12 or later
- Visual Studio 2022 or VS Code with C# extension
-
Clone the repository
git clone <repository-url> cd RealEstate
-
Configure database connection
Update
appsettings.jsonwith your PostgreSQL connection string:{ "ConnectionStrings": { "PostgreSqlConnection": "Host=localhost;Port=5432;Database=RealEstateDb;Username=postgres;Password=your_password" } } -
Apply database migrations
dotnet ef database update --project RealEstate.API
-
Restore dependencies
dotnet restore
-
Run the application
dotnet run --project RealEstate.API
The API will be available at
https://localhost:5001orhttp://localhost:5000
GET /api/property/{id}- Get property by IDGET /api/property- Get all properties (with pagination)POST /api/property- Create new propertyPUT /api/property/{id}- Update propertyDELETE /api/property/{id}- Delete property
All endpoints return a standardized response:
{
"statusCode": 200,
"isSuccess": true,
"message": "Success",
"data": { }
}Configure JWT settings in appsettings.json:
{
"JwtConfig": {
"Secret": "your-secret-key",
"Issuer": "your-issuer",
"Audience": "your-audience",
"ExpirationMinutes": 60
}
}Customize CORS settings in appsettings.json:
{
"CorsSettings": {
"AllowedOrigins": ["http://localhost:3000"],
"AllowedMethods": ["GET", "POST", "PUT", "DELETE"],
"AllowedHeaders": ["*"]
}
}Input validation is enforced using FluentValidation:
PropertyCreateDtoValidator- Validates new property creationPropertyUpdateDtoValidator- Validates property updatesInquiryCreateDtoValidator- Validates inquiry creationInquiryUpdateDtoValidator- Validates inquiry updates
- JWT Authentication - Secure token-based authentication
- Input Validation - Comprehensive server-side validation
- Exception Handling - Custom error responses for security
- CORS Protection - Configurable cross-origin access
- Identity Integration - ASP.NET Identity for user management
The application uses PostgreSQL with Entity Framework Core. Key entities include:
- Properties with images and types
- User accounts with roles
- Inquiries linked to properties and users
- Property types for categorization
Built with ❤️ using ASP.NET Core