How rightmove/remote-front-end-test works
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).