A full-stack real estate listing platform with AI-powered price estimation. Built with the MERN stack (MongoDB, Express.js, React, Node.js) and integrated with machine learning for property valuation.
Live Demo: https://varsha-estate.onrender.com
- Property Listings: Browse, search, and filter properties by type (rent/sale), location, price range, and amenities
- User Authentication: Secure JWT-based authentication with Firebase and Google OAuth
- User Profiles: View user profiles, manage personal listings, and edit property details
- Image Uploads: Upload property images directly to Firebase Cloud Storage
- Advanced Search: Filter by multiple criteria including furnished status, parking, amenities, and special offers
- Property Management: Full CRUD operations - create, read, update, and delete listings
- Price Estimator: Predict property prices using a PyTorch neural network trained on historical housing data
- Smart Valuations: Get instant property valuations based on features like area, bedrooms, bathrooms, amenities, and location
- Deep Learning: Multi-layer perceptron (MLP) architecture with 64β32β1 neurons for accurate price predictions
- React 18 with Vite
- Tailwind CSS for styling
- Redux for state management
- React Router for navigation
- Firebase Authentication for Google OAuth
- React Icons for UI icons
- Swiper for image carousels
- Node.js & Express.js for the REST API
- MongoDB for database
- JWT for authentication tokens
- Firebase Admin SDK for image uploads
- Bcryptjs for password hashing
- Python 3 with FastAPI
- PyTorch for neural network regression (MLP architecture)
- NumPy & Pandas for data preprocessing and feature engineering
- JSON for preprocessing metadata serialization
real-estate/
βββ api/ # Node.js backend
β βββ controllers/ # Route handlers
β β βββ auth.controller.js
β β βββ listing.controller.js
β β βββ user.controller.js
β βββ models/ # MongoDB schemas
β β βββ user.model.js
β β βββ listing.model.js
β βββ routes/ # API endpoints
β β βββ auth.route.js
β β βββ listing.route.js
β β βββ user.route.js
β βββ utils/ # Helper functions
β β βββ error.js
β β βββ verifyUser.js
β βββ index.js # Express app entry point
β βββ package.json
β βββ .env # Environment variables
β
βββ client/ # React frontend
β βββ src/
β β βββ components/ # Reusable components
β β β βββ Header.jsx
β β β βββ ListingItem.jsx
β β β βββ OAuth.jsx
β β β βββ PrivateRoute.jsx
β β β βββ Contact.jsx
β β βββ pages/ # Page components
β β β βββ Home.jsx
β β β βββ SignIn.jsx
β β β βββ SignUp.jsx
β β β βββ Profile.jsx
β β β βββ CreateListing.jsx
β β β βββ UpdateListing.jsx
β β β βββ Listing.jsx
β β β βββ Search.jsx
β β β βββ Estimate.jsx
β β β βββ About.jsx
β β βββ redux/ # Redux store & slices
β β β βββ store.js
β β β βββ user/userSlice.js
β β βββ App.jsx
β β βββ firebase.js # Firebase config
β β βββ main.jsx
β β βββ index.css
β βββ tailwind.config.js
β βββ vite.config.js
β βββ package.json
β βββ .env # Environment variables
β
βββ ml/ # Python ML service
β βββ app.py # FastAPI inference server
β βββ train.py # PyTorch model training script
β βββ model.pt # Trained PyTorch model weights
β βββ preprocessing.json # Feature normalization metadata
β βββ requirements.txt # Python dependencies
β
βββ Housing.csv # Dataset for ML training
βββ package.json
βββ README.md
- Node.js (v16 or higher)
- Python 3.8+
- MongoDB (local or Atlas)
- Firebase account
- Google OAuth credentials
- Clone the repository
git clone https://github.com/yourusername/real-estate.git
cd real-estate- Backend Setup
cd api
npm installCreate .env file in api/ directory:
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
FIREBASE_API_KEY=your_firebase_api_key
ML_URL=http://127.0.0.1:10000/predict
PORT=3000
- Frontend Setup
cd ../client
npm installCreate .env file in client/ directory:
VITE_FIREBASE_API_KEY=your_firebase_api_key
- ML Service Setup
cd ../ml
pip install -r requirements.txtTerminal 1 - Backend API (Port 3000)
cd api
npm startTerminal 2 - Frontend (Port 5173)
cd client
npm run devTerminal 3 - ML Service (Port 5000)
cd ml
uvicorn app:app --host 0.0.0.0 --port 5000Or run everything with Concurrently:
npm startThis starts both the Express server (port 3000) and FastAPI (port 5000) simultaneously.
The application will be available at http://localhost:5173
The model uses a Multi-Layer Perceptron (MLP) implemented in PyTorch:
Input Layer (14-16 features depending on furnishing categories)
β
Linear(64) β ReLU activation
β
Linear(32) β ReLU activation
β
Linear(1) β Price prediction (output)
-
Data Preprocessing
- Binary Features: Converts yes/no to 0/1 (mainroad, guestroom, basement, hotwaterheating, airconditioning, prefarea)
- Numeric Features: Standardizes using z-score normalization:
(value - mean) / stdarea,bedrooms,bathrooms,stories,parking
- Categorical Features: One-hot encodes
furnishingstatus(furnished/semi-furnished/unfurnished)
-
Training Process
- Optimizer: Adam with learning rate 0.001
- Loss Function: Mean Squared Error (MSE)
- Epochs: 300 iterations through the dataset
- Batch Size: 32 samples per gradient update
- Validation: 80/20 train/validation split to monitor performance
- Metrics: Root Mean Squared Error (RMSE) reported every 50 epochs
-
API Flow
- Frontend sends property details to
POST /api/estimate - Express proxy forwards request to FastAPI on port 5000 (
/predictendpoint) - FastAPI normalizes features using saved preprocessing metadata
- PyTorch model performs inference (forward pass)
- Predicted price returned to frontend
- Frontend sends property details to
-
Training the Model
cd ml python train.pyThis generates:
model.pt- PyTorch model weightspreprocessing.json- Feature means/stds and category mappings
| Feature | Type | Description |
|---|---|---|
area |
Numeric | Property area in sq ft |
bedrooms |
Numeric | Number of bedrooms |
bathrooms |
Numeric | Number of bathrooms |
stories |
Numeric | Number of floors |
parking |
Numeric | Parking spaces |
mainroad |
Binary | Access to main road (0/1) |
guestroom |
Binary | Has guest room (0/1) |
basement |
Binary | Has basement (0/1) |
hotwaterheating |
Binary | Has hot water heating (0/1) |
airconditioning |
Binary | Has AC (0/1) |
prefarea |
Binary | Located in preferred area (0/1) |
furnishingstatus |
Categorical | furnished/semi-furnished/unfurnished |
- Navigate to the Estimate page
- Enter property details (area, bedrooms, bathrooms, etc.)
- Select amenities and furnishing status
- Click "Get Estimate" to receive AI-powered price prediction
- Passwords hashed with bcryptjs
- JWT tokens stored securely
- Token validation on protected routes
- One-click sign-in with Google
- Automatic user account creation
- Profile data synced from Google
{
username: String,
email: String (unique),
password: String (hashed),
avatar: String (Firebase URL),
createdAt: Date
}{
name: String,
description: String,
address: String,
regularPrice: Number,
discountPrice: Number,
bathrooms: Number,
bedrooms: Number,
furnished: Boolean,
parking: Boolean,
type: String (rent/sale),
offer: Boolean,
imageUrls: [String],
userRef: ObjectId,
createdAt: Date
}- Color Scheme: Professional blue theme with light blue backgrounds
- Responsive Design: Mobile-first approach with Tailwind CSS
- Modern UI: Clean, intuitive interface with smooth interactions
- Font: DM Sans for typography
POST /api/auth/signup- Register new userPOST /api/auth/signin- Login userPOST /api/auth/google- Google OAuth login
GET /api/listing/get- Get listings with filtersGET /api/listing/:id- Get single listingPOST /api/listing/create- Create listingPUT /api/listing/update/:id- Update listingDELETE /api/listing/delete/:id- Delete listing
GET /api/user/:id- Get user profilePUT /api/user/update/:id- Update user profile
POST /api/estimate- Get price estimation
MONGO=mongodb+srv://username:password@cluster.mongodb.net/dbname
JWT_SECRET=your_secret_key_here
FIREBASE_API_KEY=your_firebase_key
PORT=3000
VITE_FIREBASE_API_KEY=your_firebase_key
The application is deployed on Render.com:
- Frontend hosted on Render
- Backend API on Render
- MongoDB Atlas for database
- Firebase for image storage
Contributions are welcome! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
This project is open source and available under the MIT License.