# adrianhajdin/projects_realestate architecture

> Architecture diagram of the GitHub repository adrianhajdin/projects_realestate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adrianhajdin/projects_realestate
- Repository: https://github.com/adrianhajdin/projects_realestate

## Overview

##### Project type and purpose
- This is a Next.js (React) real-estate listing application.
- It uses Next.js pages for server-side or static rendering, React components for UI, and a simple data-fetching utility to call an external real-estate API.

##### File structure
- Top-level dirs:
- components/ – reusable React UI pieces (Navbar, Footer, ImageScrollbar, SearchFilters, Property, Layout).
- pages/ – Next.js routing (index.js, search.js, dynamic route pages/property/[id].js, plus custom _app.js).
- utils/ – fetchApi.js (data‐fetching layer), filterData.js (client‐side filtering logic).
- assets/ and public/ – images and static assets.
- Config and tooling: .babelrc, .eslintrc, next.config.js, package.json, etc.
- No internal database or API routes—data comes from an external service via fetchApi.

##### Readme insights
- The README only contains a title and promotional badges, confirming it’s a demo/tutorial real-estate Next.js app.

##### Main components
a. User’s web browser (Client)
b. Next.js Application (deployed as serverless functions or Node server)
– pages/ (SSR/SSG routes)
– components/ (UI layer)
– utils/ (data‐fetching and filtering)
– next.config.js (build settings, environment variables)
c. External Real-Estate Data API (third-party data provider)
d. CDN / Static Asset Host (serving public/ and assets/)
e. (Optional) Vercel (or other) deployment platform

##### Relationships and data flow
1. User → Browser → HTTP request to Next.js page (e.g., “/”, “/search”, “/property/123”).
2. Next.js server (or serverless func)
- If SSR or SSG with getServerSideProps / getStaticProps, calls fetchApi.js with configured API host.
- Receives property data → passes props to React page component → returns HTML + JSON for hydration.
3. Browser hydrates React UI, invokes client-side filtering (filterData.js) on received data or triggers client-side fetches for search/pagination.
4. Static assets (images, CSS, JS bundles) are served via CDN from public/ and _next/static.
5. All external data fetches go fetchApi.js → External Real-Estate Data API.

##### Architectural patterns & principles
- Component-based UI (React).
- Hybrid rendering: SSR/SSG with dynamic routes.
- Layered separation: UI (components/pages) vs. Data layer (utils/fetchApi).
- Client-side filtering for instantaneous UX.
- Static assets via CDN for performance.

- Notes on which components run client vs. server side.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Client["Web Browser"]:::ui

    subgraph "Next.js App"
        PagesDir["Pages (pages/)"]:::server
        HomePage["Home Page<br>(index.js)"]:::server
        SearchPage["Search Results<br>(search.js)"]:::server
        PropertyPage["Property Detail<br>([id].js)"]:::server
        CustomApp["Custom App<br>(_app.js)"]:::server

        ComponentsDir["UI Components<br>(components/)"]:::ui
        Navbar["Navbar"]:::ui
        Footer["Footer"]:::ui
        Layout["Layout"]:::ui
        SearchFilters["SearchFilters"]:::ui
        ImageScrollbar["ImageScrollbar"]:::ui
        PropertyCard["Property Card"]:::ui

        UtilsDir["Utils (utils/)"]:::server
        FetchApi["fetchApi.js"]:::server
        FilterData["filterData.js"]:::server

        Config["next.config.js"]:::config

        PagesDir --> HomePage
        PagesDir --> SearchPage
        PagesDir --> PropertyPage
        PagesDir --> CustomApp

        CustomApp --> ComponentsDir
        ComponentsDir --> Navbar
        ComponentsDir --> Footer
        ComponentsDir --> Layout
        ComponentsDir --> SearchFilters
        ComponentsDir --> ImageScrollbar
        ComponentsDir --> PropertyCard

        CustomApp --> UtilsDir
        UtilsDir --> FetchApi
        UtilsDir --> FilterData

        CustomApp --> Config
    end

    RealEstateAPI["External Real-Estate API"]:::external
    CDN["CDN / Static Assets"]:::external

    Client -->|"GET /, /search, /property/:id"| HomePage
    Client -->|"GET /search"| SearchPage
    Client -->|"GET /property/123"| PropertyPage

    HomePage -->|"getServerSideProps / getStaticProps"| FetchApi
    SearchPage -->|"getServerSideProps / getStaticProps"| FetchApi
    PropertyPage -->|"getServerSideProps"| FetchApi

    FetchApi -.->|"HTTP Request"| RealEstateAPI

    Client -->|"Fetch JS/CSS/Images"| CDN

    click PagesDir "https://github.com/adrianhajdin/projects_realestate/tree/main/pages/"
    click HomePage "https://github.com/adrianhajdin/projects_realestate/blob/main/pages/index.js"
    click SearchPage "https://github.com/adrianhajdin/projects_realestate/blob/main/pages/search.js"
    click PropertyPage "https://github.com/adrianhajdin/projects_realestate/blob/main/pages/property/[id].js"
    click CustomApp "https://github.com/adrianhajdin/projects_realestate/blob/main/pages/_app.js"
    click ComponentsDir "https://github.com/adrianhajdin/projects_realestate/tree/main/components/"
    click Navbar "https://github.com/adrianhajdin/projects_realestate/blob/main/components/Navbar.jsx"
    click Footer "https://github.com/adrianhajdin/projects_realestate/blob/main/components/Footer.jsx"
    click Layout "https://github.com/adrianhajdin/projects_realestate/blob/main/components/Layout.jsx"
    click SearchFilters "https://github.com/adrianhajdin/projects_realestate/blob/main/components/SearchFilters.jsx"
    click ImageScrollbar "https://github.com/adrianhajdin/projects_realestate/blob/main/components/ImageScrollbar.jsx"
    click PropertyCard "https://github.com/adrianhajdin/projects_realestate/blob/main/components/Property.jsx"
    click FetchApi "https://github.com/adrianhajdin/projects_realestate/blob/main/utils/fetchApi.js"
    click FilterData "https://github.com/adrianhajdin/projects_realestate/blob/main/utils/filterData.js"
    click CDN "https://github.com/adrianhajdin/projects_realestate/tree/main/public/"
    click Config "https://github.com/adrianhajdin/projects_realestate/blob/main/next.config.js"

    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef server fill:#90EE90,stroke:#333,stroke-width:1px;
    classDef external fill:#FFA500,stroke:#333,stroke-width:1px;
    classDef config fill:#D3D3D3,stroke:#333,stroke-width:1px;
```
