# aayush412/real-estate-website architecture

> Architecture diagram of the GitHub repository aayush412/real-estate-website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aayush412/real-estate-website
- Repository: https://github.com/aayush412/real-estate-website

## Overview

##### Overall Project Breakdown
- Frontend: This is the user-facing React application (located in the “frontend” directory). It manages dynamic property searches, user authentication, property details, and integrates all the visual components, including AI-driven property analysis components.
- Admin: A separate React application (in the “admin” directory) that provides an administrative interface for managing properties, appointments, user accounts, and overall analytics.
- Backend: The Express-based server (inside the “backend” folder) that handles API requests, business logic, and integrates with various services. Notice the clear segregation by folders (config, controller, middleware, models, routes, and services).
- Database: MongoDB is used (with Mongoose) to store data related to users, properties, appointments, and statistics.
- External Services/Integrations:
- AI Integration: Azure AI is used for text generation/analysis and FirecrawlJS for real estate data extraction.
- Email Notifications: Nodemailer is integrated to handle appointment and notification emails.

## Diagram (Mermaid)

```mermaid
graph TD
    %% User Layer
    subgraph "User Layer"
        F("Frontend React App"):::frontend
        A("Admin Dashboard"):::admin
    end

    %% API Server
    API("Express API Server"):::backend
    click API "https://github.com/aayush412/real-estate-website/blob/main/backend/server.js"

    %% API calls from User Layer to API Server
    F -->|"API_Call"| API
    A -->|"API_Call"| API

    %% Backend Modules
    Controllers("Controllers"):::backend
    click Controllers "https://github.com/aayush412/real-estate-website/tree/main/backend/controller/"
    Routes("Routes"):::backend
    click Routes "https://github.com/aayush412/real-estate-website/tree/main/backend/routes/"
    Middleware("Middleware"):::backend
    click Middleware "https://github.com/aayush412/real-estate-website/tree/main/backend/middleware/"
    Services("Services"):::backend
    click Services "https://github.com/aayush412/real-estate-website/tree/main/backend/services/"

    %% API Server invoking backend modules
    API -->|"handles"| Controllers
    API -->|"routes"| Routes
    API -->|"middleware"| Middleware
    API -->|"services"| Services

    %% External Integrations from Services
    Azure("Azure AI Service"):::external
    click Azure "https://github.com/aayush412/real-estate-website/blob/main/backend/services/aiService.js"
    Firecrawl("FirecrawlJS"):::external
    click Firecrawl "https://github.com/aayush412/real-estate-website/blob/main/backend/services/firecrawlService.js"

    Services -->|"calls"| Azure
    Services -->|"calls"| Firecrawl

    %% Database Interaction
    Mongo("MongoDB Database"):::database
    click Mongo "https://github.com/aayush412/real-estate-website/blob/main/backend/config/mongodb.js"
    API -->|"persists"| Mongo

    %% Email Notifications Integration
    Email("Email Service"):::external
    API -->|"notifies"| Email

    subgraph "Email Notifications"
        EN1("Nodemailer Config"):::external
        click EN1 "https://github.com/aayush412/real-estate-website/blob/main/backend/config/nodemailer.js"
        EN2("Email Handler"):::external
        click EN2 "https://github.com/aayush412/real-estate-website/blob/main/backend/email.js"
    end
    Email --> EN1
    Email --> EN2

    %% Deployment - Docker Containerization
    subgraph "Docker Deployment"
        ADocker("Admin Dockerfile"):::docker
        click ADocker "https://github.com/aayush412/real-estate-website/tree/main/admin/Dockerfile"
        BDocker("Backend Dockerfile"):::docker
        click BDocker "https://github.com/aayush412/real-estate-website/tree/main/backend/Dockerfile"
        ADC("Admin Docker Compose"):::docker
        click ADC "https://github.com/aayush412/real-estate-website/blob/main/admin/docker-compose.yml"
        BDC("Backend Docker Compose"):::docker
        click BDC "https://github.com/aayush412/real-estate-website/blob/main/backend/docker-compose.yml"
    end
    A -->|"deployed_in"| ADC
    API -->|"deployed_in"| BDocker

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef admin fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef backend fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef external fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef database fill:#FFE4B5,stroke:#333,stroke-width:2px,stroke-dasharray:5,5;
    classDef docker fill:#DDA0DD,stroke:#333,stroke-width:2px;
```
