A full-stack real estate search platform with AI-powered chat interface and semantic search capabilities. Built with React, TypeScript, Node.js, and MongoDB.
- AI-Powered Chat Interface: Natural language search for apartments using Hebrew language support
- Semantic Search: Vector-based search using embeddings for intelligent property matching
- Advanced Filtering: Filter apartments by city, price range, rooms, size, and more
- Property Details: Detailed view of each apartment with images and specifications
- Responsive Design: Modern UI built with Tailwind CSS and Radix UI components
- Admin Dashboard: Protected route for managing apartments
- CRUD Operations: Create, read, update, and delete apartment listings
- Authentication: Secure login system with JWT tokens
- Node.js with Express.js
- TypeScript for type safety
- MongoDB with Mongoose ODM
- JWT for authentication
- bcryptjs for password hashing
- @xenova/transformers for embeddings (multilingual-e5-base model)
- @langchain/ollama for AI chat (gemma2 model)
- express-session for session management
- React 18 with TypeScript
- Vite for build tooling
- React Router for navigation
- Tailwind CSS for styling
- Radix UI for accessible components
- Axios for API calls
- Embla Carousel for image carousels
apartments/
βββ back/ # Backend application
β βββ src/
β β βββ config/ # Configuration constants
β β βββ controllers/ # Route controllers
β β β βββ apartments.controller.ts
β β β βββ auth.controller.ts
β β β βββ embedding.controller.ts
β β βββ middleware/ # Authentication middleware
β β βββ models/ # MongoDB models
β β βββ routes/ # Express routes
β β βββ services/ # Business logic
β β βββ types/ # TypeScript type definitions
β β βββ server.ts # Entry point
β βββ package.json
β βββ tsconfig.json
β
βββ front/ # Frontend application
βββ src/
β βββ api/ # API client configuration
β βββ components/ # React components
β β βββ ui/ # Reusable UI components
β β βββ ChatWidget.tsx
β β βββ FiltersBar.tsx
β β βββ ...
β βββ contexts/ # React contexts (ChatContext)
β βββ hooks/ # Custom React hooks
β βββ pages/ # Page components
β βββ types/ # TypeScript type definitions
β βββ main.tsx # Entry point
βββ package.json
βββ vite.config.ts
- Node.js (v18 or higher)
- MongoDB (local or cloud instance)
- Ollama (for AI chat functionality - gemma2 model)
-
Clone the repository
git clone https://github.com/BarYosef212/Apartments-AI.git cd Apartments-AI -
Install backend dependencies
cd back npm install -
Install frontend dependencies
cd ../front npm install -
Set up environment variables
Create a
.envfile in theback/directory:PORT=4000 MONGO_URI=your_mongodb_connection_string SESSION_SECRET=your_session_secret_key JWT_SECRET=your_jwt_secret_key
-
Install and configure Ollama (for AI chat)
# Install Ollama from https://ollama.ai # Then pull the gemma2 model: ollama pull gemma2
-
Start the backend server
cd back npm run devThe backend will run on
http://localhost:4000 -
Start the frontend development server
cd front npm run devThe frontend will run on
http://localhost:5173
-
Build the backend
cd back npm run build npm start -
Build the frontend
cd front npm run build npm run preview
POST /auth/login- User loginPOST /auth/register- User registration (if implemented)
GET /apartments- Get paginated list of apartments with filters- Query params:
page,city,min_price,max_price,rooms,type,search
- Query params:
GET /apartments/:id- Get apartment by IDGET /apartments/cities- Get list of all citiesGET /apartments/types- Get list of all property typesPOST /apartments- Create new apartment (admin only)PUT /apartments/:id- Update apartment (admin only)DELETE /apartments/:id- Delete apartment (admin only)
POST /embedding/extract-filters- Extract search filters from natural languagePOST /embedding/talk- Chat with AI assistant
The chat widget uses Ollama's gemma2 model to:
- Understand natural language queries in Hebrew
- Extract search filters (city, price range) from conversations
- Provide friendly, conversational responses
- Switch between search mode and chat mode
Properties are embedded using the Xenova/multilingual-e5-base model:
- Each apartment is converted to a searchable text representation
- User queries are embedded and matched against property embeddings
- Enables intelligent, context-aware property matching
Protected route (/admin) that requires authentication:
- View all apartments in a table format
- Create, edit, and delete apartment listings
- Manage apartment data with a user-friendly interface
The application uses JWT tokens for authentication:
- Tokens are stored in HTTP-only cookies or localStorage
- Protected routes require valid authentication
- Session management via express-session
- Hebrew (Χ’ΧΧ¨ΧΧͺ): Primary language for UI and AI chat
- The AI assistant is configured to respond in Hebrew with a friendly, conversational tone
PORT- Server port (default: 4000)MONGO_URI- MongoDB connection stringSESSION_SECRET- Secret for express-sessionJWT_SECRET- Secret for JWT token signing
- The backend uses TypeScript with strict type checking
- Frontend uses Vite for fast HMR (Hot Module Replacement)
- Both projects have separate
tsconfig.jsonfiles - UI components are built with Radix UI for accessibility
Note: Make sure Ollama is running and the gemma2 model is available before using the chat functionality. The embedding models will be downloaded automatically on first use.