A modern Next.js application for real estate property management with Trestle API integration, advanced search capabilities, and interactive maps.
- Property Search & Discovery: Advanced search with semantic capabilities
- Interactive Maps: Leaflet-based maps with drawing tools and property visualization
- User Authentication: Secure JWT-based authentication system
- Property Comparison: Side-by-side property comparison functionality
- Saved Properties & Searches: User profile management with favorites
- Responsive Design: Mobile-first responsive UI with Tailwind CSS
- Real-time Updates: Automatic property data synchronization with Trestle API
Before starting development, ensure you have the following installed:
- Node.js (version 18.17 or higher)
- npm (comes with Node.js) or yarn or pnpm
- Git for version control
- Trestle API Credentials:
- API ID and Password from CoreLogic Trestle
- Required for property data integration
- Google Maps API Key:
- For maps functionality and street view
- Enable Maps JavaScript API and Street View Static API
- SQLite: Automatically handled by better-sqlite3 (no separate installation required)
git clone <your-repository-url>
cd backnpm install
# or
yarn install
# or
pnpm installAll required packages are listed in requirements.txt and will be installed from package.json.
Create a .env.local and '.env' file in the root directory and configure the following variables:
# Trestle API Configuration (Required)
TRESTLE_API_ID=your-trestle-api-id
TRESTLE_API_PASSWORD=your-trestle-api-password
TRESTLE_BASE_URL=https://api-trestle.corelogic.com/trestle
TRESTLE_OAUTH_URL=https://api-trestle.corelogic.com/trestle/oidc/connect/token
TRESTLE_UPDATE_INTERVAL=15
# Database Configuration
DATABASE_URL=./data/users.db
# Authentication
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production-make-it-at-least-32-characters-long
# Google Maps (Required for maps functionality)
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your-google-maps-api-key-here
# Application URLs
NEXT_PUBLIC_BASE_URL=http://localhost:3000
NEXT_PUBLIC_API_BASE_URL=https://api.crowncoastalhomes.com
API_BASE_URL=https://api.crowncoastalhomes.com
# Environment
NODE_ENV=developmentThe application uses SQLite with better-sqlite3. The database will be automatically created when you first run the application.
To populate the database with sample data: --not necessary--
node populate-database.jsTo test your Trestle API integration:
node test-trestle-api.jsnpm run dev
# or
yarn dev
# or
pnpm devThe application will start at http://localhost:3000
npm run build
npm run startnpm run lintback/
βββ src/
β βββ app/ # Next.js App Router pages
β β βββ api/ # API routes
β β βββ auth/ # Authentication pages
β β βββ properties/ # Property listing pages
β β βββ map/ # Map interface
β βββ components/ # Reusable React components
β β βββ ui/ # UI components (buttons, forms, etc.)
β β βββ filters/ # Search and filter components
β β βββ map/ # Map-related components
β βββ lib/ # Utility libraries
β β βββ auth.ts # Authentication logic
β β βββ database.ts # Database operations
β β βββ trestle-api.ts # Trestle API integration
β βββ hooks/ # Custom React hooks
β βββ types/ # TypeScript type definitions
β βββ styles/ # Global styles
βββ data/ # Database files
βββ requirements.txt # Package dependencies list
βββ package.json # Node.js dependencies
- Ensure all environment variables are configured
- Test API connections with provided test scripts
- Run database population script if needed
# Start development server with turbopack (faster)
npm run dev
# Generate API client (if API changes)
npm run generate-client
# Run database migrations
node run-migration.js
# Test specific features
node test-properties-api.js
node test-semantic-search.jsUse the provided test scripts to verify your setup:
test-trestle-api.js- Test Trestle API connectiontest-oauth-method.js- Test OAuth authenticationtest-properties-api.js- Test property data retrieval
- Ensure Google Maps API key is set in environment variables
- Enable required Google Maps APIs in Google Cloud Console
- Semantic search requires vector indexing (automatically handled)
- Property data syncs automatically based on TRESTLE_UPDATE_INTERVAL
- JWT tokens are used for session management
- User data is stored in SQLite database
The application integrates with CoreLogic's Trestle API for real estate data. Key endpoints:
- Property search and filtering
- Property details and media
- Market statistics
/api/properties- Property search and listing/api/auth- Authentication endpoints/api/user- User profile management
Ensure all environment variables are set in your production environment, especially:
JWT_SECRET(use a strong, unique secret)NODE_ENV=production- Valid API keys and credentials
npm run build- Next.js Documentation
- Trestle API Documentation
- Tailwind CSS Documentation
- React Leaflet Documentation
- Trestle API Connection Issues: Verify your API credentials and check test scripts
- Maps Not Loading: Ensure Google Maps API key is valid and APIs are enabled
- Database Errors: Check file permissions for SQLite database files
- Build Errors: Ensure all dependencies are installed and environment variables are set
Use the comprehensive test scripts in the root directory to diagnose issues:
debug-trestle-api.js- Debug Trestle API issuesverify-credentials.js- Verify all API credentials
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly using provided test scripts
- Submit a pull request
This project is proprietary. Please contact the development team for licensing information.