# rightmove/remote-front-end-test architecture

> Architecture diagram of the GitHub repository rightmove/remote-front-end-test, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rightmove/remote-front-end-test
- Repository: https://github.com/rightmove/remote-front-end-test

## Overview

##### Project type and purpose
- This is a full-stack property-listing demo application.
- Frontend: single-page React app built with Vite.
- Backend: Node.js/Express API serving property data from a JSON file.
- Purpose: display, filter, and sort real-estate properties via REST endpoints.

##### File structure
- Top-level: configuration files (babel, eslint, jest, Vite), package.json, public assets, frontend source (src), server code.
- “public/”: static SPA shell (index.html, manifest).
- “src/”: React components (App, Header, PropertyCard, PropertyListing, SortAndFilter), tests, constants, styles.
- “server/”: Express entrypoint (index.js), routes, controllers, service layer, data store (properties.json).

##### README insights
- npm start runs both API (port 3000) and React (port 5173) in parallel.
- Single GET endpoint /api/properties with query parameters for filtering/sorting.

##### Main components and relationships
a. Client (Browser)
- User interacts via browser at http://localhost:5173.
b. Frontend (React + Vite Dev Server)
- Entry: src/index.jsx → App → Header, PropertyListing, SortAndFilter, PropertyCard.
- Calls fetch(‘/api/properties?...’) to get data.
c. API Gateway (Express Server)
- server/index.js sets up routes under /api.
- server/routes/index.js wires GET /properties → controller.
d. Controller Layer (properties.js)
- Validates query parameters, forwards to service.
e. Service Layer (properties.js)
- Loads server/data/properties.json, applies filtering/sorting logic.
f. Data Store (properties.json)
- Static JSON array of property objects.

##### Architectural patterns and principles
- Clear separation of concerns (MVC-style):
- Routes → Controllers → Services → Data.
- Client-Server separation: React handles UI; Express handles data and business logic.
- Stateless API: each request retrieves fresh data.
- Testing: Jest + React Testing Library for unit/component tests in src/components.

- Labels on each component (e.g., “Vite Dev Server”, “Express API Server”).
- Ports: 5173 (frontend), 3000 (API).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Browser["Browser\n(http://localhost:5173)"]:::client

    %% Public Assets
    subgraph "Public (Static SPA Shell)"
        direction TB
        StaticShell["index.html"]:::public
        click StaticShell "https://github.com/rightmove/remote-front-end-test/blob/master/public/index.html"
        Manifest["manifest.json"]:::public
        click Manifest "https://github.com/rightmove/remote-front-end-test/blob/master/public/manifest.json"
    end

    %% Frontend Layer
    subgraph "Frontend (React + Vite)" 
        direction TB
        FrontendEntry["src/index.jsx\n(Entry Point)"]:::entry
        click FrontendEntry "https://github.com/rightmove/remote-front-end-test/blob/master/src/index.jsx"
        StylesEntry["src/index.scss"]:::styles
        click StylesEntry "https://github.com/rightmove/remote-front-end-test/blob/master/src/index.scss"
        ViteConfig["vite.config.js"]:::config
        click ViteConfig "https://github.com/rightmove/remote-front-end-test/blob/master/vite.config.js"
        ViteDev["Vite Dev Server\n(port 5173)"]:::frontend
        ReactApp["App"]:::component
        click ReactApp "https://github.com/rightmove/remote-front-end-test/blob/master/src/components/App/App.jsx"
        AppIndex["App index.js"]:::component
        click AppIndex "https://github.com/rightmove/remote-front-end-test/blob/master/src/components/App/index.js"
        Header["Header"]:::component
        click Header "https://github.com/rightmove/remote-front-end-test/blob/master/src/components/Header/Header.jsx"
        PropertyListing["PropertyListing"]:::component
        click PropertyListing "https://github.com/rightmove/remote-front-end-test/blob/master/src/components/PropertyListing/PropertyListing.jsx"
        PropertyCard["PropertyCard"]:::component
        click PropertyCard "https://github.com/rightmove/remote-front-end-test/blob/master/src/components/PropertyCard/PropertyCard.jsx"
        SortAndFilter["SortAndFilter"]:::component
        click SortAndFilter "https://github.com/rightmove/remote-front-end-test/blob/master/src/components/SortAndFilter/SortAndFilter.jsx"
    end

    %% Backend Layer
    subgraph "Backend (Express API)" 
        direction TB
        APIServer["server/index.js\n(Entrypoint)"]:::backend
        click APIServer "https://github.com/rightmove/remote-front-end-test/blob/master/server/index.js"
        Routes["Routes (/api)"]:::backend
        click Routes "https://github.com/rightmove/remote-front-end-test/blob/master/server/routes/index.js"
        Controller["Properties Controller"]:::backend
        click Controller "https://github.com/rightmove/remote-front-end-test/blob/master/server/controllers/properties.js"
        Service["Properties Service"]:::backend
        click Service "https://github.com/rightmove/remote-front-end-test/blob/master/server/service/properties.js"
    end

    %% Data Store
    DataStore["properties.json"]:::data
    click DataStore "https://github.com/rightmove/remote-front-end-test/blob/master/server/data/properties.json"

    %% Connections
    Browser -->|"loads SPA"| StaticShell
    Browser -->|"loads SPA"| Manifest
    Browser -->|"loads SPA"| FrontendEntry
    FrontendEntry --> ViteDev
    ViteDev --> ReactApp
    ReactApp --> Header
    ReactApp --> PropertyListing
    ReactApp --> SortAndFilter
    PropertyListing --> PropertyCard

    ReactApp -->|"fetch GET /api/properties"| APIServer
    APIServer --> Routes
    Routes --> Controller
    Controller -->|"validate params"| Service
    Service -->|"read data"| DataStore
    DataStore -->|"return JSON array"| Service
    Service --> Controller
    Controller --> APIServer
    APIServer --> ReactApp
    ReactApp --> Browser

    %% Styles
    classDef client fill:#D0E6FF,stroke:#0366D6,color:#0366D6;
    classDef public fill:#E8F5E9,stroke:#2E7D32,color:#2E7D32;
    classDef entry fill:#FFF3E0,stroke:#FB8C00,color:#BF360C;
    classDef styles fill:#F3E5F5,stroke:#6A1B9A,color:#4A148C;
    classDef config fill:#E1F5FE,stroke:#0277BD,color:#01579B;
    classDef frontend fill:#C8E6C9,stroke:#2E7D32,color:#1B5E20;
    classDef component fill:#FFECB3,stroke:#FFA000,color:#FF6F00;
    classDef backend fill:#FFE0B2,stroke:#FB8C00,color:#E65100;
    classDef data fill:#ECEFF1,stroke:#607D8B,color:#455A64;
```
