Onde:
AI-Powered Real Estate Platform
A full-stack real estate marketplace featuring advanced AI search capabilities, semantic property discovery, and intelligent chat assistance. Built with a modern dual-architecture approach combining traditional REST APIs with serverless edge functions.
🤖 AI & Machine Learning Integration
OpenAI Integration
► GPT-4o-mini for conversational AI chat and intent classification
► GPT-4o Vision API for automated property image analysis, extracting detailed visual descriptions of interiors, exteriors, colors, materials, and architectural features
► text-embedding-3-small (1536 dimensions) for property text embeddings
► text-embedding-3-large (3072 dimensions) for image and document embeddings
► Intelligent filter extraction from natural language queries
► Context-aware property recommendations
Semantic Search Pipeline
► Multi-stage AI processing pipeline with <3s response time
► Parallel intent classification and filter extraction
► Visual search mode for queries like "houses with green floors" or "properties with gardens"
► POI (Point of Interest) proximity search integration
► Smart context building from vector matches
Structured Data Output
► Zod schema validation for API responses
► Type-safe filter extraction with explicit TypeScript interfaces
► Structured JSON responses from AI models using function calling
► Deterministic property reference detection ("la primera", "that one")
🗄️ Vector Database & Embeddings
Pinecone Vector Database
► Three specialized indexes for different content types:
► Properties Index (text-embedding-3-small, 1536 dim): Property descriptions, addresses, features
► Images Index (text-embedding-3-large, 3072 dim): Visual analysis from property photos
► Documents Index (text-embedding-3-large, 3072 dim): Floor plans, contracts, certificates
► Parallel vector search across all indexes
► Metadata filtering (price, bedrooms, location, amenities)
► Deduplication by property_id
► Hash-based vector IDs for idempotent operations
Embedding Generation System
► Automated batch processing (5 images parallel, up to 50 images per property)
► Deterministic SHA-256 hash-based vector IDs to prevent duplicates
► Image analysis with detailed prompts for exterior/interior features
► Property text chunking with semantic sentence splitting
► Fire-and-forget async embedding generation with error tracking
☁️ Supabase Edge Functions (Deno)
Main AI chat orchestrator
► 5-step processing pipeline optimized for performance
► Parallel intent classification and filter extraction
► Vector search coordination across Pinecone indexes
► GPT-4o-mini response generation with context awareness
► Conversation history management with session tracking
Embedding generation service
► OpenAI Vision API integration for image analysis
► Multi-index embedding distribution
► Automatic metadata normalization
► Chunk-based text processing
► Document storage in Supabase with preview generation
Natural language query parser
► Intent classification (search, POI, compare, filter_update)
► Structured filter extraction from natural language
► AI filter tagging (pet-friendly, modern-kitchen, quiet-neighborhood)
► Region lookup with case-insensitive database matching
► Property reference detection
Semantic search coordinator
► Parallel embedding generation (small + large models)
► Multi-index vector search
► PostgreSQL property fetching with region filtering
► Result deduplication and scoring
► Google Places API integration for POI queries
🗺️ Maps Integration
Google Maps API
► Places API for POI proximity search
► Geocoding for address validation
► Distance matrix calculations
► Walking time estimations
► Place details with ratings and reviews
🏗️ Architecture & Backend
Dual Architecture System
Express.js API (Node.js)
► REST endpoints for property CRUD operations
► JWT + Supabase Auth integration
► Socket.io real-time chat with Redis pub/sub
► Worker clustering with per-worker connection pools
► CSRF protection and security middleware
Deno Edge Functions (Supabase)
► Serverless AI chat and semantic search
► Low-latency edge deployment
► Multi-tier caching strategy (in-memory FIFO)
► Automatic scaling and cold start optimization
Database & Storage
► PostgreSQL with PostGIS for geospatial queries
► Kysely type-safe query builder
► Connection pooler for production scaling
► Supabase Storage for property images
► Redis for caching and pub/sub
Performance Optimizations
► Multi-tier caching (embeddings: 24h, properties: 10min, searches: 5min)
► Batch parallel processing for image embeddings
► Debounced search inputs (500ms)
► Query result prefetching on hover
► localStorage persistence for chat history
🎨 Frontend Stack
React 19 + TypeScript + Vite
► Modern React patterns with hooks
► Type-safe development with strict TypeScript
► Fast HMR with Vite
State Management
► TanStack Query v5 for server state
► Optimistic updates for favorites and offers
► Smart caching with staleTime configuration
► URL params as single source of truth for search state
UI & Styling
► Tailwind CSS for utility-first styling
► ShadcnUI + Radix UI component library
► Custom design system (Montserrat, Saira, Inter fonts)
► Responsive design with mobile-first approach
Key Features
► AI-powered conversational search with persistent chat history
► Real-time property chat with Socket.io
► Interactive property cards with clickable AI chat links
► Region-based and radius-based search
► Advanced filters modal with amenities and conditions
► Favorite properties with optimistic updates
► Offer negotiation system
► Visit scheduling
🔧 Developer Experience
Type Safety
► End-to-end TypeScript coverage
► Generated database types with Kysely
► Zod runtime validation
► Strict ESLint + Prettier configuration
Build & Deploy
► Path aliases for clean imports (@/, @controllers/, @services/)
► Environment-based configuration
► Hot reload in development
► Production clustering with graceful shutdown
Testing & Monitoring
► Detailed console logging in edge functions
► Winston structured logging in Express
► Performance tracking (intent classification, cache hit rates)
► Error boundary handling
📊 Technical Metrics
► AI Response Time: <3 seconds end-to-end
► Embedding Processing: 5-10 minutes for 50 images (batch parallel)
► Vector Search: <500ms across 3 Pinecone indexes
► Cache Hit Rate: ~70% reduction in repeated queries
► Database Queries: Type-safe with <100ms response time
► Real-time Chat: Sub-second message delivery with Socket.io
🚀 Innovative Features
1. AI Chat with Memory - Persistent chat history using localStorage, property reference context
2. Semantic Visual Search - "Show me properties with marble kitchens" using image embeddings
3. Natural Language Regions - "Properties in Avenidas Novas" auto-completes region selection
4. Smart Filter Detection - Extracts price, bedrooms, amenities from conversational queries
5. Clickable Property Links in Chat - Navigate to property details directly from AI responses
6. Batch Parallel Embedding - Process 50 images in 5-10 minutes with deduplication
7. Multi-Index Vector Search - Combines text, image, and document embeddings for comprehensive results
8. POI Proximity Intelligence - "Properties near hospitals" with walking distance calculations