A production-grade, agentic chatbot designed for premium real estate companies in Bangalore, India. This intelligent system provides personalized property recommendations, market insights, and expert consultation through natural language conversations.
- Natural Language Processing: Powered by OpenAI GPT-4 for human-like conversations
- Context Awareness: Maintains conversation context and user preferences
- Intent Recognition: Automatically detects user intent and extracts relevant information
- Property Recommendations: Smart property matching based on user requirements
- Market Insights: Real-time market trends and analysis for Bangalore
- Comprehensive Property Database: Detailed property listings with specifications
- Advanced Search: Filter by location, price, type, amenities, and more
- Featured Properties: Highlight premium and exclusive listings
- Property Analytics: View counts, inquiries, and performance metrics
- Similar Properties: AI-powered property recommendations
- Socket.IO Integration: Real-time chat with typing indicators
- Session Management: Persistent conversation history
- Suggested Actions: Context-aware quick action buttons
- Rich Media Support: Property images and documents
- Rate Limiting: Protect against abuse and DDoS attacks
- Input Validation: Comprehensive request validation
- CORS Protection: Secure cross-origin requests
- Helmet Security: HTTP headers security
- JWT Authentication: Secure user authentication
- Comprehensive Logging: Winston-based structured logging
- Performance Monitoring: Request/response tracking
- Error Handling: Graceful error management
- Health Checks: System health monitoring
- Node.js 16+
- MongoDB 4.4+
- Redis 6.0+
- OpenAI API Key
- Clone the repository
git clone <repository-url>
cd premium-real-estate-chatbot- Install dependencies
npm install- Set up environment variables
cp env.example .env
# Edit .env with your configuration- Start MongoDB and Redis
# MongoDB
mongod
# Redis
redis-server- Run the application
# Development
npm run dev
# Production
npm start- Access the application
http://localhost:3000
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 3000 |
NODE_ENV |
Environment | development |
MONGODB_URI |
MongoDB connection string | mongodb://localhost:27017/real-estate-chatbot |
REDIS_URL |
Redis connection string | redis://localhost:6379 |
OPENAI_API_KEY |
OpenAI API key | Required |
JWT_SECRET |
JWT secret key | Required |
The application uses MongoDB for data persistence. Key collections:
- Properties: Property listings and details
- Chats: Conversation history and context
- Users: User accounts and preferences
Redis is used for:
- Session caching
- Response caching
- Rate limiting
- Real-time features
โโโ server.js # Main server file
โโโ config/ # Configuration files
โ โโโ database.js # MongoDB connection
โ โโโ redis.js # Redis connection
โโโ models/ # Database models
โ โโโ Property.js # Property schema
โ โโโ Chat.js # Chat schema
โโโ services/ # Business logic
โ โโโ chatbotService.js # Chatbot core logic
โโโ routes/ # API routes
โ โโโ chat.js # Chat endpoints
โ โโโ properties.js # Property endpoints
โ โโโ auth.js # Authentication
โโโ middleware/ # Custom middleware
โ โโโ errorHandler.js # Error handling
โโโ socket/ # Socket.IO handlers
โ โโโ chatHandler.js # Real-time chat
โโโ utils/ # Utilities
โ โโโ logger.js # Logging utility
โโโ public/ # Frontend assets
โโโ index.html # Main HTML
โโโ styles.css # Styling
โโโ app.js # Frontend logic
- Responsive Design: Mobile-first approach
- Modern UI: Clean, premium interface
- Real-time Updates: Live chat and notifications
- Interactive Elements: Modals, forms, and animations
- Accessibility: WCAG compliant design
Property Search
User: "I'm looking for a 2BHK apartment in Indiranagar"
Bot: "I found several excellent 2BHK apartments in Indiranagar. Here are some options that match your requirements..."
Market Analysis
User: "What are the current market trends in Bangalore?"
Bot: "The Bangalore real estate market is showing strong growth, particularly in tech corridors. Here are the key trends..."
Property Details
User: "Tell me more about the luxury villa in Whitefield"
Bot: "This premium villa in Whitefield features 4 bedrooms, 5 bathrooms, and 5000 sqft of living space..."
Chat
POST /api/chat/message- Send chat messageGET /api/chat/history/:sessionId- Get chat historyPOST /api/chat/recommendations- Get property recommendationsGET /api/chat/market-insights- Get market insights
Properties
GET /api/properties- List properties with filtersGET /api/properties/:id- Get property detailsPOST /api/properties- Create new propertyPUT /api/properties/:id- Update propertyDELETE /api/properties/:id- Delete property
Authentication
POST /api/auth/login- User loginPOST /api/auth/register- User registrationGET /api/auth/profile- Get user profilePUT /api/auth/profile- Update profile
npm run dev # Start development server
npm start # Start production server
npm test # Run tests
npm run lint # Lint code
npm run format # Format code
npm run build # Build for production- Database Models: Add new schemas in
models/ - API Routes: Create new routes in
routes/ - Services: Add business logic in
services/ - Frontend: Update HTML, CSS, and JavaScript in
public/
# Run all tests
npm test
# Run specific test file
npm test -- --grep "chatbot"
# Run with coverage
npm test -- --coverageFROM node:16-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["npm", "start"]- Set
NODE_ENV=production - Configure production MongoDB and Redis
- Set secure JWT secret
- Enable HTTPS
- Configure reverse proxy (nginx)
- Health Check:
GET /health - Logs: Check
logs/directory - Metrics: Monitor via Winston logs
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE file for details
For support and questions:
- Create an issue in the repository
- Contact: support@premiumrealestate.com
- Documentation: [Wiki Link]
- Multi-language support
- Voice chat integration
- Advanced analytics dashboard
- Mobile app development
- AI-powered property valuation
- Virtual property tours
- Lead management system
- Payment integration
Built with โค๏ธ for the premium real estate industry in Bangalore