$ show trailheadapps/dreamhouse-lwc
This repository contains Dreamhouse, a Salesforce sample application for real estate property management built with Lightning Web Components (LWC) and Apex. It demonstrates key Salesforce platform capabilities including custom objects (Property__c, Broker__c), flexible page layouts, Lightning Message Service for inter-component communication, and mobile features like barcode scanning and geolocation. The application provides a property explorer with filtering, pagination, map visualization (using Leaflet), and a property creation flow with geocoding via OpenStreetMap. It also includes sample data import, accessibility testing, and comprehensive CI/CD pipelines. The codebase is well-structured with separate Apex controllers, reusable LWC components, and Jest unit tests, representing a professional implementation of Salesforce development best practices. While primarily an application, it includes sample data (JSON files) that could be considered a minor data aspect, but the dominant character is application.
The LLM identified 5 files worth highlighting for reuse:
A generic error display component for Lightning Web Components that supports two templates: inline message and no data illustration. It is self-contained (no internal dependencies beyond base Lightning components) and can be extracted into any Salesforce LWC project to provide consistent error and empty state handling. The component demonstrates clean conditional rendering and template switching.
A reusable pagination component that emits previous and next events. It is decoupled from any specific data source and can be added to any list-based LWC for paging functionality. The component pattern is clean, with minimal state management and clear event APIs.
A small utility module exporting a single function `reduceErrors` that normalizes errors from Lightning Data Service (LDS) or Apex wire adapters into a consistent array of error messages. This is a highly reusable pattern for any Salesforce LWC project to handle error display uniformly.
A simple Apex wrapper class that encapsulates paginated results (list of records, page size, total count). It is generic and reusable across any Apex controller that needs to return paginated data. The class has no external dependencies and can be copied verbatim.
A Jest mock for the `lightning/navigation` module that simulates `NavigationMixin` and `CurrentPageReference`. This mock is essential for unit testing LWC components that use navigation, and can be reused in any Salesforce LWC test setup with minimal adaptation.