Skip to content

urasylmaz1/RealEstate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real Estate API

A modern, scalable RESTful API for managing real estate properties, listings, inquiries, and user accounts. Built with clean architecture principles and industry best practices.

🎯 Overview

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.

🛠 Tech Stack

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)

🏗 Architecture

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

📁 Project Structure

Controllers

  • PropertyController - Endpoints for property management (CRUD operations, pagination)

Core Entities

  • 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

Key Features

  • 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

🚀 Getting Started

Prerequisites

  • .NET 10.0 SDK or later
  • PostgreSQL 12 or later
  • Visual Studio 2022 or VS Code with C# extension

Installation

  1. Clone the repository

    git clone <repository-url>
    cd RealEstate
  2. Configure database connection

    Update appsettings.json with your PostgreSQL connection string:

    {
      "ConnectionStrings": {
        "PostgreSqlConnection": "Host=localhost;Port=5432;Database=RealEstateDb;Username=postgres;Password=your_password"
      }
    }
  3. Apply database migrations

    dotnet ef database update --project RealEstate.API
  4. Restore dependencies

    dotnet restore
  5. Run the application

    dotnet run --project RealEstate.API

    The API will be available at https://localhost:5001 or http://localhost:5000

📚 API Endpoints

Properties

  • GET /api/property/{id} - Get property by ID
  • GET /api/property - Get all properties (with pagination)
  • POST /api/property - Create new property
  • PUT /api/property/{id} - Update property
  • DELETE /api/property/{id} - Delete property

Response Format

All endpoints return a standardized response:

{
  "statusCode": 200,
  "isSuccess": true,
  "message": "Success",
  "data": { }
}

🔧 Configuration

JWT Configuration

Configure JWT settings in appsettings.json:

{
  "JwtConfig": {
    "Secret": "your-secret-key",
    "Issuer": "your-issuer",
    "Audience": "your-audience",
    "ExpirationMinutes": 60
  }
}

CORS Configuration

Customize CORS settings in appsettings.json:

{
  "CorsSettings": {
    "AllowedOrigins": ["http://localhost:3000"],
    "AllowedMethods": ["GET", "POST", "PUT", "DELETE"],
    "AllowedHeaders": ["*"]
  }
}

🧪 Validation

Input validation is enforced using FluentValidation:

  • PropertyCreateDtoValidator - Validates new property creation
  • PropertyUpdateDtoValidator - Validates property updates
  • InquiryCreateDtoValidator - Validates inquiry creation
  • InquiryUpdateDtoValidator - Validates inquiry updates

🔐 Security Features

  • 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

📊 Database Schema

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages